mirror of
https://github.com/jwetzell/QControlKit.git
synced 2026-08-16 21:03:28 +00:00
Implement Cue Properties Updating
This commit is contained in:
@@ -61,6 +61,11 @@ namespace QSharp
|
|||||||
public JToken data { get; set; }
|
public JToken data { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class QCuePropertiesUpdatedArgs : EventArgs
|
||||||
|
{
|
||||||
|
public List<string> properties { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class QCueListsUpdatedArgs : EventArgs
|
public class QCueListsUpdatedArgs : EventArgs
|
||||||
{
|
{
|
||||||
public JToken data { get; set; }
|
public JToken data { get; set; }
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
namespace QSharp
|
||||||
namespace QSharp
|
|
||||||
{
|
{
|
||||||
public delegate void QServerFoundHandler(object source, QServerFoundArgs args);
|
public delegate void QServerFoundHandler(object source, QServerFoundArgs args);
|
||||||
public delegate void QServerUpdatedHandler(object source, QServerUpdatedArgs args);
|
public delegate void QServerUpdatedHandler(object source, QServerUpdatedArgs args);
|
||||||
@@ -16,6 +15,7 @@ namespace QSharp
|
|||||||
|
|
||||||
|
|
||||||
public delegate void QCueUpdatedHandler(object source, QCueUpdatedArgs args);
|
public delegate void QCueUpdatedHandler(object source, QCueUpdatedArgs args);
|
||||||
|
public delegate void QCuePropertiesUpdatedHandler(object source, QCuePropertiesUpdatedArgs args);
|
||||||
public delegate void QCueListsUpdatesHandler(object source, QCueListsUpdatedArgs args);
|
public delegate void QCueListsUpdatesHandler(object source, QCueListsUpdatedArgs args);
|
||||||
public delegate void QCueNeedsUpdatedHandler(object source, QCueNeedsUpdatedArgs args);
|
public delegate void QCueNeedsUpdatedHandler(object source, QCueNeedsUpdatedArgs args);
|
||||||
public delegate void QCueListChangedPlaybackPositionHandler(object source, QCueListChangedPlaybackPositionArgs args);
|
public delegate void QCueListChangedPlaybackPositionHandler(object source, QCueListChangedPlaybackPositionArgs args);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Zeroconf;
|
using Zeroconf;
|
||||||
using System;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -1,12 +1,9 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using SharpOSC;
|
using SharpOSC;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace QSharp
|
namespace QSharp
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-7
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace QSharp
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace QSharp
|
|
||||||
{
|
{
|
||||||
public class QColor
|
public class QColor
|
||||||
{
|
{
|
||||||
|
|||||||
+17
-3
@@ -22,6 +22,8 @@ namespace QSharp
|
|||||||
|
|
||||||
public bool ignoreUpdates;
|
public bool ignoreUpdates;
|
||||||
|
|
||||||
|
public event QCuePropertiesUpdatedHandler CuePropertiesUpdated;
|
||||||
|
|
||||||
public QCue()
|
public QCue()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@@ -540,6 +542,7 @@ namespace QSharp
|
|||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
JObject dictObj = (JObject)dict;
|
JObject dictObj = (JObject)dict;
|
||||||
|
List<string> propertiesUpdated = new List<string>();
|
||||||
foreach (var obj in dictObj)
|
foreach (var obj in dictObj)
|
||||||
{
|
{
|
||||||
JToken value = obj.Value;
|
JToken value = obj.Value;
|
||||||
@@ -553,16 +556,17 @@ namespace QSharp
|
|||||||
{
|
{
|
||||||
bool didSetProptery = setProperty(value, obj.Key, false);
|
bool didSetProptery = setProperty(value, obj.Key, false);
|
||||||
if (didSetProptery)
|
if (didSetProptery)
|
||||||
|
{
|
||||||
cueUpdated = true;
|
cueUpdated = true;
|
||||||
|
propertiesUpdated.Add(obj.Key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cueUpdated)
|
if (!cueUpdated)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Log.Debug($"[cue] <{nonEmptyName}> has been updated.");
|
OnCuePropertiesUpdated(propertiesUpdated);
|
||||||
//something about notifying cueUpdated ? OnCueUpdated event handler maybe?
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,6 +824,16 @@ namespace QSharp
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region Event Handling
|
||||||
|
void OnCuePropertiesUpdated(List<string> properties)
|
||||||
|
{
|
||||||
|
Log.Debug($"[cue] <{nonEmptyName}> properties have been updated.");
|
||||||
|
CuePropertiesUpdated?.Invoke(this, new QCuePropertiesUpdatedArgs { properties = properties });
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Printing
|
#region Printing
|
||||||
public void Print()
|
public void Print()
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-5
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
namespace QSharp
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace QSharp
|
|
||||||
{
|
{
|
||||||
static class QBonjour
|
static class QBonjour
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Dynamic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using SharpOSC;
|
using SharpOSC;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Security;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using QSharp;
|
using QSharp;
|
||||||
using QSharpXamDemo.ViewModels;
|
using QSharpXamDemo.ViewModels;
|
||||||
@@ -29,7 +28,7 @@ namespace QSharpXamDemo
|
|||||||
{
|
{
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
Device.BeginInvokeOnMainThread(() =>
|
||||||
{
|
{
|
||||||
selectedCueGrid.BindingContext = new SelectedQCueViewModel(connectedWorkspace.cueWithID(args.cueID));
|
selectedCueGrid.BindingContext = new QCueViewModel(connectedWorkspace.cueWithID(args.cueID), false);
|
||||||
|
|
||||||
if (cueGridDict.ContainsKey(args.cueID))
|
if (cueGridDict.ContainsKey(args.cueID))
|
||||||
{
|
{
|
||||||
@@ -65,7 +64,7 @@ namespace QSharpXamDemo
|
|||||||
Grid cueToGrid(QCue cue)
|
Grid cueToGrid(QCue cue)
|
||||||
{
|
{
|
||||||
Grid cueGrid = new Grid { RowSpacing = 0 };
|
Grid cueGrid = new Grid { RowSpacing = 0 };
|
||||||
QCueViewModel qCueViewModel = new QCueViewModel(cue);
|
QCueViewModel qCueViewModel = new QCueViewModel(cue, true);
|
||||||
cueGrid.RowDefinitions = new RowDefinitionCollection();
|
cueGrid.RowDefinitions = new RowDefinitionCollection();
|
||||||
cueGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
|
cueGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
|
||||||
var cueLabel = new Label
|
var cueLabel = new Label
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using QSharp;
|
using QSharp;
|
||||||
|
using Serilog;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
@@ -10,10 +11,27 @@ namespace QSharpXamDemo.ViewModels
|
|||||||
bool isSelected = false;
|
bool isSelected = false;
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
public QCueViewModel(QCue cue)
|
public QCueViewModel(QCue cue, bool checkPlayback)
|
||||||
{
|
{
|
||||||
this.cue = cue;
|
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 = "")
|
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