mirror of
https://github.com/jwetzell/QControlKit.git
synced 2026-08-11 18:33:51 +00:00
Implement Cue Properties Updating
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Security;
|
||||
using System.Threading.Tasks;
|
||||
using QSharp;
|
||||
using QSharpXamDemo.ViewModels;
|
||||
@@ -29,7 +28,7 @@ namespace QSharpXamDemo
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
selectedCueGrid.BindingContext = new SelectedQCueViewModel(connectedWorkspace.cueWithID(args.cueID));
|
||||
selectedCueGrid.BindingContext = new QCueViewModel(connectedWorkspace.cueWithID(args.cueID), false);
|
||||
|
||||
if (cueGridDict.ContainsKey(args.cueID))
|
||||
{
|
||||
@@ -65,7 +64,7 @@ namespace QSharpXamDemo
|
||||
Grid cueToGrid(QCue cue)
|
||||
{
|
||||
Grid cueGrid = new Grid { RowSpacing = 0 };
|
||||
QCueViewModel qCueViewModel = new QCueViewModel(cue);
|
||||
QCueViewModel qCueViewModel = new QCueViewModel(cue, true);
|
||||
cueGrid.RowDefinitions = new RowDefinitionCollection();
|
||||
cueGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
|
||||
var cueLabel = new Label
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using QSharp;
|
||||
using Serilog;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Xamarin.Forms;
|
||||
@@ -10,10 +11,27 @@ namespace QSharpXamDemo.ViewModels
|
||||
bool isSelected = false;
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public QCueViewModel(QCue cue)
|
||||
public QCueViewModel(QCue cue, bool checkPlayback)
|
||||
{
|
||||
this.cue = cue;
|
||||
this.cue.workspace.CueListChangedPlaybackPosition += Workspace_CueListChangedPlaybackPosition;
|
||||
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)
|
||||
{
|
||||
Log.Debug($"[cueviewmodel] property <{property}> has been updated.");
|
||||
if (property.Equals(QOSCKey.Name))
|
||||
{
|
||||
OnPropertyChanged("name");
|
||||
}else if (property.Equals(QOSCKey.ColorName))
|
||||
{
|
||||
OnPropertyChanged("color");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnPropertyChanged([CallerMemberName] string name = "")
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
using QSharp;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Xamarin.Forms;
|
||||
namespace QSharpXamDemo.ViewModels
|
||||
{
|
||||
public class SelectedQCueViewModel : INotifyPropertyChanged
|
||||
{
|
||||
QCue cue;
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public SelectedQCueViewModel(QCue cue)
|
||||
{
|
||||
this.cue = cue;
|
||||
}
|
||||
|
||||
void OnPropertyChanged([CallerMemberName] string name = "")
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
|
||||
public string name {
|
||||
get
|
||||
{
|
||||
return cue.nonEmptyName;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
cue.name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string number
|
||||
{
|
||||
get
|
||||
{
|
||||
return cue.number;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
cue.number = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color color
|
||||
{
|
||||
get
|
||||
{
|
||||
return Color.FromHex(cue.color.Hex);
|
||||
}
|
||||
set
|
||||
{
|
||||
cue.color = new QColor("none");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user