mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-07 16:33:45 +00:00
31a10d9b16
* QWorkspaceInfo.cs: * QParser.cs: * WorkspacePrompt.cs: * QEventArgs.cs: Remove redundant QWorkspaceInfo class * QRecentWorkspaceInfo.cs: Add bundle info class for recent workspace info * ControlPage.xaml.cs: * QBrowserPage.xaml.cs: * QButton.cs: * qConnectionPage.xaml.cs: * QLevelsCell.cs: * QCueListCell.cs: * QInstanceCell.cs: * QControlsBlock.cs: * ShadowButton.cs: * QLevelsButton.cs: * QSelectedCueCell.cs: Move Cells classess under UI * AppDelegate.cs: * packages.config: * MainActivity.cs: * packages.config: * qController.iOS.csproj: * qController.Droid.csproj: * qController.csproj: Update dependencies * App.xaml.cs: Add AppAction code for recent workspace * QStorage.cs: Add recent workspace to persistent storage * QCueGrid.cs: Start on interactivity with cue list grid * QCueViewModel.cs: debug for children updated start on reactive QCueGrid * WorkspacePage.xaml.cs: Start handling a "no selected cue" state and recent workspace * QInstance.cs: * IPHelper.cs: move reachable check to IPHelper - TODO: implement
166 lines
3.8 KiB
C#
166 lines
3.8 KiB
C#
using Serilog;
|
|
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
using Xamarin.Forms;
|
|
|
|
using QControlKit;
|
|
using QControlKit.Constants;
|
|
using QControlKit.Events;
|
|
|
|
namespace qController.ViewModels
|
|
{
|
|
public class QCueViewModel : INotifyPropertyChanged
|
|
{
|
|
QCue cue;
|
|
bool isSelected = false;
|
|
bool isCollapsed = false;
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
public QCueViewModel(QCue cue, bool checkPlayback)
|
|
{
|
|
this.cue = cue;
|
|
if (checkPlayback)
|
|
this.cue.workspace.CueListChangedPlaybackPosition += Workspace_CueListChangedPlaybackPosition;
|
|
this.cue.CuePropertiesUpdated += OnCuePropertiesUpdated;
|
|
}
|
|
|
|
private void OnCuePropertiesUpdated(object source, QCuePropertiesUpdatedArgs args)
|
|
{
|
|
foreach (var property in args.properties)
|
|
{
|
|
if (property.Equals(QOSCKey.Name) || property.Equals(QOSCKey.ListName))
|
|
{
|
|
OnPropertyChanged("name");
|
|
}
|
|
else if (property.Equals(QOSCKey.Number))
|
|
{
|
|
OnPropertyChanged("number");
|
|
}
|
|
else if (property.Equals(QOSCKey.Notes))
|
|
{
|
|
OnPropertyChanged("notes");
|
|
}
|
|
else if (property.Equals(QOSCKey.ColorName))
|
|
{
|
|
OnPropertyChanged("color");
|
|
}
|
|
else if (property.Equals(QOSCKey.Children))
|
|
{
|
|
Log.Debug("children property updated");
|
|
}
|
|
}
|
|
}
|
|
|
|
void OnPropertyChanged([CallerMemberName] string name = "")
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
}
|
|
|
|
private void Workspace_CueListChangedPlaybackPosition(object source, QCueListChangedPlaybackPositionArgs args)
|
|
{
|
|
IsSelected = args.cueID == cue.uid;
|
|
}
|
|
|
|
public Thickness nestPadding
|
|
{
|
|
get
|
|
{
|
|
return new Thickness((cue.nestLevel - 1) * 10,0,0,0);
|
|
}
|
|
}
|
|
|
|
public string name
|
|
{
|
|
get
|
|
{
|
|
return cue.listName;
|
|
}
|
|
|
|
set
|
|
{
|
|
cue.name = value;
|
|
}
|
|
}
|
|
|
|
public string type
|
|
{
|
|
get
|
|
{
|
|
return QIcon.GetIconFromType(cue.type);
|
|
}
|
|
}
|
|
|
|
public string uid
|
|
{
|
|
get
|
|
{
|
|
return cue.uid;
|
|
}
|
|
}
|
|
|
|
public string number
|
|
{
|
|
get
|
|
{
|
|
return cue.number;
|
|
}
|
|
|
|
set
|
|
{
|
|
cue.number = value;
|
|
}
|
|
}
|
|
|
|
public string notes
|
|
{
|
|
get
|
|
{
|
|
return cue.notes;
|
|
}
|
|
|
|
set
|
|
{
|
|
cue.notes = value;
|
|
}
|
|
}
|
|
|
|
public Color color
|
|
{
|
|
get
|
|
{
|
|
return Color.FromHex(cue.color.Hex);
|
|
}
|
|
set
|
|
{
|
|
cue.color = new QColor("none");
|
|
}
|
|
}
|
|
|
|
public bool IsSelected
|
|
{
|
|
get
|
|
{
|
|
return isSelected;
|
|
}
|
|
set
|
|
{
|
|
isSelected = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public bool IsCollapsed
|
|
{
|
|
get
|
|
{
|
|
return isCollapsed;
|
|
}
|
|
set
|
|
{
|
|
isCollapsed = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
}
|
|
}
|