mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-14 11:53:55 +00:00
* qfont.ttf:
* qfont.ttf: * QIcon.cs: Add LIST and LEFT_DIR icons * Info.plist: * AndroidManifest.xml: Update Version Numbers * App.xaml.cs: * QCue.cs: * MenuPage.xaml.cs: * QCueList.cs: * ControlPage.xaml.cs: * QWorkSpace.cs: * QCueListCell.cs: * qConnectionPage.xaml.cs: * QParser.cs: * QUpdater.cs: * QController.cs: Android v1.0.8 / iOS v2.0.8
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace qController
|
||||
{
|
||||
public class QCueListCell : Frame
|
||||
{
|
||||
public ListView cueListView;
|
||||
public Button closeButton;
|
||||
public QCueListCell(QCueList qCueList)
|
||||
{
|
||||
Margin = new Thickness(10);
|
||||
Padding = new Thickness(10);
|
||||
|
||||
|
||||
cueListView = new ListView
|
||||
{
|
||||
ItemsSource = qCueList.cues,
|
||||
RowHeight = (int)(App.HeightUnit * 6),
|
||||
ItemTemplate = new DataTemplate(() =>
|
||||
{
|
||||
var grid = new Grid { Padding = new Thickness(5, 10) };
|
||||
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(30) });
|
||||
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
|
||||
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(30) });
|
||||
|
||||
|
||||
var icon = new Label();
|
||||
icon.FontFamily = App.QFont;
|
||||
icon.SetBinding(Label.TextProperty, "IconText");
|
||||
icon.HorizontalTextAlignment = TextAlignment.Center;
|
||||
icon.VerticalTextAlignment = TextAlignment.Center;
|
||||
icon.FontSize = App.HeightUnit * 3;
|
||||
|
||||
var label = new Label { VerticalOptions = LayoutOptions.FillAndExpand };
|
||||
label.SetBinding(Label.TextProperty, "listName");
|
||||
|
||||
switch (Device.RuntimePlatform)
|
||||
{
|
||||
case Device.iOS:
|
||||
label.FontSize = App.HeightUnit * 3;
|
||||
break;
|
||||
case Device.Android:
|
||||
label.FontSize = App.HeightUnit * 2.2;
|
||||
break;
|
||||
}
|
||||
var selectedLabel = new Label {
|
||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
||||
FontFamily = App.QFont,
|
||||
Text = QIcon.LEFT_DIR,
|
||||
TextColor = Color.Green,
|
||||
FontSize = App.HeightUnit * 3
|
||||
};
|
||||
|
||||
grid.Children.Add(icon, 0, 0);
|
||||
grid.Children.Add(label, 1, 0);
|
||||
//grid.Children.Add(selectedLabel, 2, 0);
|
||||
return new ViewCell { View = grid };
|
||||
|
||||
})
|
||||
};
|
||||
StackLayout layout = new StackLayout();
|
||||
closeButton = new Button
|
||||
{
|
||||
BackgroundColor = Color.Gray,
|
||||
Text = "Close",
|
||||
TextColor = Color.White
|
||||
};
|
||||
|
||||
layout.Children.Add(closeButton);
|
||||
layout.Children.Add(cueListView);
|
||||
Content = layout;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,15 @@ namespace qController
|
||||
public QClient qClient;
|
||||
public QWorkspace qWorkspace;
|
||||
public string playbackPosition;
|
||||
public Stopwatch sw;
|
||||
private string ipAddress;
|
||||
private int port;
|
||||
|
||||
public QController(string address, int port)
|
||||
{
|
||||
qClient = new QClient(address, port);
|
||||
this.port = port;
|
||||
this.ipAddress = address;
|
||||
|
||||
qClient = new QClient(ipAddress, port);
|
||||
qUpdater = new QUpdater(this);
|
||||
|
||||
}
|
||||
@@ -25,8 +30,7 @@ namespace qController
|
||||
public void Connect(string workspace_id)
|
||||
{
|
||||
Console.WriteLine("QCONTROLLER CONNECT CALLED: " + workspace_id);
|
||||
qWorkspace = new QWorkspace();
|
||||
qWorkspace.workspace_id = workspace_id;
|
||||
qWorkspace = new QWorkspace(workspace_id);
|
||||
qUpdater.Start();
|
||||
qClient.sendArgsUDP("/workspace/"+workspace_id+"/connect");
|
||||
qClient.sendArgsUDP("/workspace/"+workspace_id+"/updates", 1);
|
||||
@@ -48,6 +52,16 @@ namespace qController
|
||||
qClient.sendArgsUDP("/workspace/" + qWorkspace.workspace_id + "/connect", pass);
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
//qClient = new QClient(ipAddress, port);
|
||||
//qUpdater = new QUpdater(this);
|
||||
if(qWorkspace != null)
|
||||
{
|
||||
Console.WriteLine("RESUMING " + qWorkspace.workspace_id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Kill(){
|
||||
if (qUpdater != null)
|
||||
qUpdater.Kill();
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace qController
|
||||
public delegate void ChildrenUpdateHandler(object source, ChildrenEventArgs args);
|
||||
public delegate void WorkspaceDisconnectHandler(object source, EventArgs args);
|
||||
public delegate void WorkspaceInfoHandler(object source, WorkspaceInfoArgs args);
|
||||
public delegate void WorkspaceLoadErrorHandler(object source, WorkspaceEventArgs args);
|
||||
public event WorkspaceLoadErrorHandler WorkspaceLoadError;
|
||||
public event WorkspaceInfoHandler WorkspaceInfoReceived;
|
||||
public event WorkspaceDisconnectHandler WorkspaceDisconnect;
|
||||
public event ChildrenUpdateHandler ChildrenUpdated;
|
||||
@@ -162,8 +164,29 @@ namespace qController
|
||||
{
|
||||
if (msg.Arguments.Count > 0)
|
||||
{
|
||||
QWorkspace workspace = JsonConvert.DeserializeObject<QWorkspace>(msg.Arguments[0].ToString());
|
||||
OnWorkspaceUpdated(workspace);
|
||||
var parts = msg.Address.Split('/');
|
||||
string id = parts[3];
|
||||
|
||||
if (msg.Arguments[0].ToString() != "")
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine(msg.Arguments.Count);
|
||||
Console.WriteLine(msg.Arguments[0].ToString().Length);
|
||||
|
||||
QWorkspace workspace = JsonConvert.DeserializeObject<QWorkspace>(msg.Arguments[0].ToString());
|
||||
OnWorkspaceUpdated(workspace);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OnWorkspaceLoadError(id);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
OnWorkspaceLoadError(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +248,11 @@ namespace qController
|
||||
if (WorkspaceInfoReceived != null)
|
||||
WorkspaceInfoReceived(this, new WorkspaceInfoArgs() { WorkspaceInfo = workspaces });
|
||||
}
|
||||
protected virtual void OnWorkspaceLoadError(string id)
|
||||
{
|
||||
if (WorkspaceLoadError != null)
|
||||
WorkspaceLoadError(this, new WorkspaceEventArgs { UpdatedWorkspace = new QWorkspace(id) });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,16 @@ namespace qController
|
||||
qController.qClient.qParser.CueInfoUpdated += OnCueUpdateReceived;
|
||||
qController.qClient.qParser.WorkspaceUpdated += OnWorkspaceUpdated;
|
||||
qController.qClient.qParser.PlaybackPositionUpdated += OnPlaybackPositionUpdated;
|
||||
qController.qClient.qParser.WorkspaceLoadError += OnWorkspaceLoadError;
|
||||
|
||||
}
|
||||
|
||||
private void OnWorkspaceLoadError(object source, WorkspaceEventArgs args)
|
||||
{
|
||||
Console.WriteLine("QUpdater: Loading cuelists has failed for some reason retrying");
|
||||
qController.qClient.sendArgsUDP("/workspace/" + args.UpdatedWorkspace.workspace_id + "/connect");
|
||||
qController.qClient.sendArgsUDP("/workspace/" + args.UpdatedWorkspace.workspace_id + "/updates", 1);
|
||||
qController.qClient.sendAndReceiveString("/workspace/" + args.UpdatedWorkspace.workspace_id + "/cueLists");
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +35,7 @@ namespace qController
|
||||
updateThread.Start();
|
||||
}
|
||||
|
||||
//Attemp at a "keep alive" message
|
||||
//Attempt at a "keep alive" message
|
||||
public void UpdateLoop()
|
||||
{
|
||||
active = true;
|
||||
@@ -64,6 +74,7 @@ namespace qController
|
||||
public void OnPlaybackPositionUpdated(object source, PlaybackPositionArgs args)
|
||||
{
|
||||
qController.playbackPosition = args.PlaybackPosition;
|
||||
Console.WriteLine("ControlPage: Update Specific Cue Called because of Playback Position Updated");
|
||||
qController.qClient.UpdateSpecificCue(qController.qWorkspace.workspace_id,args.PlaybackPosition);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace qController
|
||||
public bool isLoaded { get; set; }
|
||||
public string notes { get; set; }
|
||||
public List<List<double>> levels { get; set; }
|
||||
|
||||
|
||||
//info loaded from /children
|
||||
public List<QCue> cues { get; set; }
|
||||
|
||||
@@ -39,5 +39,13 @@ namespace qController
|
||||
{
|
||||
return QIcon.GetIconFromType(type);
|
||||
}
|
||||
|
||||
public string IconText
|
||||
{
|
||||
get
|
||||
{
|
||||
return QIcon.GetIconFromType(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,5 +13,13 @@ namespace qController
|
||||
public string colorName { get; set; }
|
||||
public string name { get; set; }
|
||||
public bool armed { get; set; }
|
||||
|
||||
public string IconText
|
||||
{
|
||||
get
|
||||
{
|
||||
return QIcon.LIST;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ namespace qController
|
||||
public string address { get; set; }
|
||||
public bool IsPopulated { get; set; }
|
||||
|
||||
//ONLY FOR PASSING A WORKSPACE LOAD ERROR
|
||||
public QWorkspace(string id)
|
||||
{
|
||||
workspace_id = id;
|
||||
}
|
||||
|
||||
public QCue GetCue(string cue_id)
|
||||
{
|
||||
foreach (var cueList in data)
|
||||
@@ -28,6 +34,18 @@ namespace qController
|
||||
return null;
|
||||
}
|
||||
|
||||
public QCueList GetCueList(string id)
|
||||
{
|
||||
foreach (var cueList in data)
|
||||
{
|
||||
if(cueList.uniqueID == id)
|
||||
{
|
||||
return cueList;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void UpdateCue(QCue cue)
|
||||
{
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
public const string DOLLAR = "\uF155";
|
||||
public const string MAIL = "\uE812";
|
||||
|
||||
public const string LEFT_DIR = "\uE813";
|
||||
public const string LIST = "\uE814";
|
||||
|
||||
public static string GetIconFromType(string type)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user