mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-13 19:33:52 +00:00
General Housekeeping
This commit is contained in:
@@ -18,11 +18,9 @@ namespace qController
|
||||
InitializeComponent();
|
||||
|
||||
qController = new QController(address, 53000);
|
||||
qController.qClient.qParser.SelectedCueUpdated += SelectedCueUpdated;
|
||||
qController.qClient.qParser.WorkspaceUpdated += WorkspaceUpdated;
|
||||
qController.qClient.qParser.PlaybackPositionUpdated += PlaybackPositionUpdated;
|
||||
qController.qClient.qParser.CueInfoUpdated += OnCueUpdateReceived;
|
||||
qController.qClient.qParser.ConnectionStatusChanged += OnConnectionStatusChanged;
|
||||
qController.qClient.qParser.ChildrenUpdated += OnChildrenUpdated;
|
||||
instanceName.Text = name;
|
||||
App.rootPage.MenuItemSelected += OnMenuItemSelected;
|
||||
@@ -31,58 +29,6 @@ namespace qController
|
||||
|
||||
}
|
||||
|
||||
private void OnChildrenUpdated(object source, ChildrenEventArgs args)
|
||||
{
|
||||
Console.WriteLine("Children Updated in ControlPage: " + args.cue_id);
|
||||
qController.qWorkspace.UpdateChildren(args.cue_id, args.children);
|
||||
if (qController.qWorkspace.ChildrenPopulated())
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
if (App.MenuIsPresented)
|
||||
{
|
||||
//App.MenuIsPresented = false;
|
||||
App.rootPage.MenuPage.ChangeToWorkspace(qController.qWorkspace);
|
||||
//App.MenuIsPresented = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
App.rootPage.MenuPage.ChangeToWorkspace(qController.qWorkspace);
|
||||
|
||||
}
|
||||
});
|
||||
qController.qClient.UpdateSelectedCue();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnConnectionStatusChanged(object source, ConnectEventArgs args)
|
||||
{
|
||||
if (args.Status == "ok")
|
||||
{
|
||||
Console.WriteLine("Workspace has successfully connected");
|
||||
}
|
||||
else if (args.Status == "badpass")
|
||||
{
|
||||
Console.WriteLine("Password incorrect or no password supplied");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Workspace not found");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMenuItemSelected(object source, MenuEventArgs args)
|
||||
{
|
||||
if (args.Command.Contains("/"))
|
||||
{
|
||||
Console.WriteLine("Cue selected: " + args.Command);
|
||||
qController.qClient.sendStringUDP(args.Command);
|
||||
}else if (args.Command == "disconnect")
|
||||
{
|
||||
Back();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitGUI()
|
||||
{
|
||||
|
||||
@@ -94,7 +40,7 @@ namespace qController
|
||||
topBar.BackgroundColor = Color.FromHex("71AEFF");
|
||||
|
||||
BackgroundColor = Color.FromHex("4A4A4A");
|
||||
menuButton.Text = "\uF0C9";
|
||||
menuButton.Text = QIcon.MENU;
|
||||
switch (Device.RuntimePlatform)
|
||||
{
|
||||
case Device.iOS:
|
||||
@@ -162,7 +108,6 @@ namespace qController
|
||||
row = 0;
|
||||
column = 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QButton goButton = new QButton("GO","/go");
|
||||
@@ -194,22 +139,6 @@ namespace qController
|
||||
App.NavigationPage.Navigation.PopAsync();
|
||||
}
|
||||
|
||||
public void SelectedCueUpdated(object sender, CueEventArgs e){
|
||||
Device.BeginInvokeOnMainThread(()=>{
|
||||
if (e.Cue.type.Equals("Audio"))
|
||||
{
|
||||
//Console.WriteLine("CUE IS AN AUDIO CUE");
|
||||
sLayout.Children.Add(qSelectedCueOptions);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Console.WriteLine("CUE IS NOT AN AUDIO CUE");
|
||||
sLayout.Children.Remove(qSelectedCueOptions);
|
||||
}
|
||||
qCell.UpdateSelectedCue(e.Cue);
|
||||
});
|
||||
}
|
||||
|
||||
public void WorkspaceUpdated(object sender, WorkspaceEventArgs e)
|
||||
{
|
||||
if(e.UpdatedWorkspace.data.Count > 0)
|
||||
@@ -248,7 +177,7 @@ namespace qController
|
||||
Console.WriteLine("Cue that was updated is equal to the playback position.");
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
if (args.Cue.type.Equals("Audio"))
|
||||
if (args.Cue.levels != null)
|
||||
sLayout.Children.Add(qSelectedCueOptions);
|
||||
else
|
||||
sLayout.Children.Remove(qSelectedCueOptions);
|
||||
@@ -257,6 +186,42 @@ namespace qController
|
||||
}
|
||||
}
|
||||
|
||||
private void OnChildrenUpdated(object source, ChildrenEventArgs args)
|
||||
{
|
||||
Console.WriteLine("Children Updated in ControlPage: " + args.cue_id);
|
||||
qController.qWorkspace.UpdateChildren(args.cue_id, args.children);
|
||||
if (qController.qWorkspace.ChildrenPopulated())
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
if (App.MenuIsPresented)
|
||||
{
|
||||
//App.MenuIsPresented = false;
|
||||
App.rootPage.MenuPage.ChangeToWorkspace(qController.qWorkspace);
|
||||
//App.MenuIsPresented = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
App.rootPage.MenuPage.ChangeToWorkspace(qController.qWorkspace);
|
||||
|
||||
}
|
||||
});
|
||||
qController.qClient.UpdateSelectedCue();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMenuItemSelected(object source, MenuEventArgs args)
|
||||
{
|
||||
if (args.Command.Contains("/"))
|
||||
{
|
||||
qController.qClient.sendStringUDP(args.Command);
|
||||
}
|
||||
else if (args.Command == "disconnect")
|
||||
{
|
||||
Back();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDisappearing()
|
||||
{
|
||||
base.OnDisappearing();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace qController
|
||||
@@ -69,16 +70,19 @@ namespace qController
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public void ChangeToWorkspace(QWorkSpace workspace)
|
||||
public void ChangeToControl()
|
||||
{
|
||||
items.Clear();
|
||||
items.Add(new MenuPageItem
|
||||
{
|
||||
Title = "Disconnect",
|
||||
Icon = "\uE803",
|
||||
Icon = QIcon.CANCEL,
|
||||
Command = "disconnect"
|
||||
});
|
||||
}
|
||||
public void ChangeToWorkspace(QWorkSpace workspace)
|
||||
{
|
||||
ChangeToControl();
|
||||
foreach (var cueList in workspace.data)
|
||||
{
|
||||
items.Add(new MenuPageItem
|
||||
@@ -90,7 +94,6 @@ namespace qController
|
||||
foreach (var cue in cueList.cues)
|
||||
{
|
||||
AddSubCues(cue, 0);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,10 +125,10 @@ namespace qController
|
||||
});
|
||||
|
||||
//uncomment to load nested group cues
|
||||
/*foreach (var sub_cue in cue.cues)
|
||||
foreach (var sub_cue in cue.cues)
|
||||
{
|
||||
AddSubCues(sub_cue,level + 1);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user