diff --git a/qController.Standard/Classes/Cell/QSelectedCueCell.cs b/qController.Standard/Classes/Cell/QSelectedCueCell.cs
index 52a44ba..a88968b 100644
--- a/qController.Standard/Classes/Cell/QSelectedCueCell.cs
+++ b/qController.Standard/Classes/Cell/QSelectedCueCell.cs
@@ -18,12 +18,13 @@ namespace qController
Grid mainG = new Grid
{
Padding = new Thickness(0),
- RowDefinitions = {
- new RowDefinition{Height = GridLength.Auto},
+ RowDefinitions =
+ {
new RowDefinition{Height = GridLength.Auto},
new RowDefinition{Height = GridLength.Auto}
},
- ColumnDefinitions = {
+ ColumnDefinitions =
+ {
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
@@ -31,6 +32,40 @@ namespace qController
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
}
};
+ Grid topGrid = new Grid
+ {
+ Padding = new Thickness(0),
+ RowDefinitions =
+ {
+ new RowDefinition{Height = GridLength.Auto}
+ },
+ ColumnDefinitions =
+ {
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
+ }
+ };
+ Grid bottomGrid = new Grid
+ {
+ Padding = new Thickness(0),
+ RowDefinitions =
+ {
+ new RowDefinition{Height = GridLength.Auto},
+ new RowDefinition{Height = GridLength.Auto}
+ },
+ ColumnDefinitions =
+ {
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
+ new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
+ }
+ };
+
number = new Label { Text = "N/A"};
number.FontAttributes = FontAttributes.Bold;
number.FontSize = 30;
@@ -46,20 +81,28 @@ namespace qController
type = new Label { Text = "N/A" };
type.FontAttributes = FontAttributes.Bold;
type.VerticalTextAlignment = TextAlignment.Center;
- type.HorizontalTextAlignment = TextAlignment.Center;
+ type.HorizontalTextAlignment = TextAlignment.End;
type.Margin = new Thickness(5);
notes = new Label { Text = "Viewing Notes Currently Unavailable" };
notes.HorizontalTextAlignment = TextAlignment.Center;
notes.Margin = new Thickness(0, 0, 0, 10);
- mainG.Children.Add(number, 0, 0);
- mainG.Children.Add(type, 4, 0);
- mainG.Children.Add(name, 0, 1);
- mainG.Children.Add(notes, 0, 2);
+ topGrid.Children.Add(number, 0, 0);
+ topGrid.Children.Add(type, 4, 0);
+ Grid.SetColumnSpan(number, 2);
+ Grid.SetColumnSpan(type, 3);
+
+ bottomGrid.Children.Add(name, 0, 0);
+ bottomGrid.Children.Add(notes, 0, 1);
Grid.SetColumnSpan(name, 5);
Grid.SetColumnSpan(notes,5);
+ mainG.Children.Add(topGrid, 0, 0);
+ Grid.SetColumnSpan(topGrid, 5);
+
+ mainG.Children.Add(bottomGrid, 0, 1);
+ Grid.SetColumnSpan(bottomGrid, 5);
Margin = new Thickness(10);
Content = mainG;
diff --git a/qController.Standard/Classes/Cell/QSelectedCueOptionsCell.cs b/qController.Standard/Classes/Cell/QSelectedCueOptionsCell.cs
index 930c5f8..6b1a67d 100644
--- a/qController.Standard/Classes/Cell/QSelectedCueOptionsCell.cs
+++ b/qController.Standard/Classes/Cell/QSelectedCueOptionsCell.cs
@@ -32,7 +32,7 @@ namespace qController
Slider rightSlider;
public QSelectedCueOptionsCell(QController qController)
{
- qController.qParser.AudioLevelsUpdated += AudioLevelsUpdated;
+ qController.qClient.qParser.AudioLevelsUpdated += AudioLevelsUpdated;
Padding = new Thickness(5);
CornerRadius = 20;
BackgroundColor = Color.FromHex("D8D8D8");
diff --git a/qController.Standard/Classes/Communication/QClient.cs b/qController.Standard/Classes/Communication/QClient.cs
index aca4cc0..ff0e61d 100644
--- a/qController.Standard/Classes/Communication/QClient.cs
+++ b/qController.Standard/Classes/Communication/QClient.cs
@@ -6,12 +6,19 @@ namespace qController
public class QClient
{
TCPSender tcpSender;
- UDPSender udpSender;
+ public QParser qParser;
public QClient(string address, int port)
{
+ qParser = new QParser();
tcpSender = new TCPSender(address, port);
- udpSender = new UDPSender(address, port);
+ tcpSender.MessageReceived += OnMessageReceived;
+
+ }
+
+ private void OnMessageReceived(object source, MessageEventArgs args)
+ {
+ qParser.ParseMessage(args.Message);
}
public void sendString(string address)
@@ -19,6 +26,11 @@ namespace qController
tcpSender.Send(new OscMessage(address));
}
+ public void sendArgs(string address, object args)
+ {
+ tcpSender.Send(new OscMessage(address, args));
+ }
+
public OscMessage sendAndReceiveString(string address)
{
return tcpSender.SendAndReceive(new OscMessage(address));
@@ -29,17 +41,7 @@ namespace qController
return tcpSender.SendAndReceive(new OscMessage(address, args));
}
- public void sendStringUDP(string address)
- {
- udpSender.Send(new OscMessage(address));
- }
- public void sendArgs(string address, object args)
- {
- tcpSender.Send(new OscMessage(address, args));
- }
- public void sendArgsUDP(string address, object args)
- {
- udpSender.Send(new OscMessage(address, args));
- }
+
+
}
}
diff --git a/qController.Standard/Classes/Communication/QController.cs b/qController.Standard/Classes/Communication/QController.cs
index 1e9968f..4c39f1c 100644
--- a/qController.Standard/Classes/Communication/QController.cs
+++ b/qController.Standard/Classes/Communication/QController.cs
@@ -9,7 +9,6 @@ namespace qController
{
QUpdater qUpdater;
- public QParser qParser;
QCue selectedCue;
public QClient qClient;
QWorkSpace qWorkspace;
@@ -17,12 +16,12 @@ namespace qController
{
qClient = new QClient(address, port);
- qParser = new QParser();
qUpdater = new QUpdater(this);
qUpdater.Start();
- qParser.SelectedCueUpdated += this.OnSelectedCueUpdated;
- qParser.WorkspaceUpdated += this.OnWorkspaceUpdated;
+ qClient.qParser.SelectedCueUpdated += this.OnSelectedCueUpdated;
+ qClient.qParser.WorkspaceUpdated += this.OnWorkspaceUpdated;
+
}
@@ -31,10 +30,6 @@ namespace qController
qClient.sendString(cmd);
}
- public void sendCommandUDP(string cmd)
- {
- qClient.sendStringUDP(cmd);
- }
public void updateCueValue(QCue cue, string property, object newValue){
// qSender.sendArgs("/cue_id/"+cue.uniqueID+"/"+property, newValue);
}
diff --git a/qController.Standard/Classes/Communication/QParser.cs b/qController.Standard/Classes/Communication/QParser.cs
index 564deb8..8e5daa7 100644
--- a/qController.Standard/Classes/Communication/QParser.cs
+++ b/qController.Standard/Classes/Communication/QParser.cs
@@ -46,16 +46,20 @@ namespace qController
public event WorkspaceUpdatedHandler WorkspaceUpdated;
public void ParseMessage(OscMessage msg){
- if (msg.Address.Contains("selectedCues"))
- ParseSelectedCueInfo(msg);
- else if (msg.Address.Contains("notes"))
- ParseNoteInfo(msg);
- else if (msg.Address.Contains("levels"))
- ParseLevelInfo(msg);
- else if (msg.Address.Contains("cueLists"))
- ParseWorkspaceInfo(msg);
- else
- Console.WriteLine(msg.Address);
+ if (!msg.Address.Contains("null"))
+ {
+ if (msg.Address.Contains("selectedCues"))
+ ParseSelectedCueInfo(msg);
+ else if (msg.Address.Contains("notes"))
+ ParseNoteInfo(msg);
+ else if (msg.Address.Contains("levels"))
+ ParseLevelInfo(msg);
+ else if (msg.Address.Contains("cueLists"))
+ ParseWorkspaceInfo(msg);
+ else
+ Console.WriteLine(msg.Address);
+ }
+
}
public void ParseSelectedCueInfo(OscMessage msg){
JArray selectedCues = (JArray)OSC2JSON(msg);
diff --git a/qController.Standard/Classes/Communication/QSender.cs b/qController.Standard/Classes/Communication/QSender.cs
index 60dd852..a484e37 100644
--- a/qController.Standard/Classes/Communication/QSender.cs
+++ b/qController.Standard/Classes/Communication/QSender.cs
@@ -7,29 +7,26 @@ namespace qController
public class QSender
{
TCPSender tcpSender;
- UDPSender udpSender;
public QSender(string address, int port)
{
tcpSender = new TCPSender(address, port);
- udpSender = new UDPSender(address, port);
+ tcpSender.MessageReceived += OnMessageReceived;
}
+ void OnMessageReceived(object source, MessageEventArgs args)
+ {
+ Console.WriteLine("New Message Received");
+ }
+
+
public void sendString(string address) {
tcpSender.Send(new OscMessage(address));
}
- public void sendStringUDP(string address)
- {
- udpSender.Send(new OscMessage(address));
- }
public void sendArgs(string address, object args){
tcpSender.Send(new OscMessage(address, args));
}
- public void sendArgsUDP(string address, object args)
- {
- udpSender.Send(new OscMessage(address, args));
- }
}
}
diff --git a/qController.Standard/Classes/Communication/QUpdater.cs b/qController.Standard/Classes/Communication/QUpdater.cs
index f2d4345..35489ef 100644
--- a/qController.Standard/Classes/Communication/QUpdater.cs
+++ b/qController.Standard/Classes/Communication/QUpdater.cs
@@ -25,11 +25,11 @@ namespace qController
public void UpdateSelected()
{
- qController.qParser.ParseMessage(qController.qClient.sendAndReceiveString("/selectedCues"));
+ qController.qClient.sendAndReceiveString("/selectedCues");
}
public void UpdateLevels()
{
- qController.qParser.ParseMessage(qController.qClient.sendAndReceiveString("/cue/selected/levels"));
+ qController.qClient.sendAndReceiveString("/cue/selected/levels");
}
public void Kill(){
diff --git a/qController.Standard/Classes/Communication/SharpOSC/TCPSender.cs b/qController.Standard/Classes/Communication/SharpOSC/TCPSender.cs
index 2cd1ba6..0d9cc45 100644
--- a/qController.Standard/Classes/Communication/SharpOSC/TCPSender.cs
+++ b/qController.Standard/Classes/Communication/SharpOSC/TCPSender.cs
@@ -7,6 +7,15 @@ using System.Threading;
namespace SharpOSC
{
+ public class MessageEventArgs : EventArgs
+ {
+ public OscMessage Message
+ {
+ get;
+ set;
+ }
+ }
+
public class TCPSender
{
public int Port
@@ -19,6 +28,9 @@ namespace SharpOSC
{
get { return _address; }
}
+ public delegate void MessageReceivedHandler(object source, MessageEventArgs args);
+ public event MessageReceivedHandler MessageReceived;
+
string _address;
TcpClient client;
Thread receivingThread;
@@ -88,6 +100,7 @@ namespace SharpOSC
{
byte[] data = packet.GetBytes();
OscMessage response = SendAndReceive(data);
+ OnMessageReceived(response);
return response;
}
public void StartReceiving()
@@ -135,5 +148,11 @@ namespace SharpOSC
receivingThread.Abort();
client.Close();
}
+
+ protected virtual void OnMessageReceived(OscMessage msg)
+ {
+ if (MessageReceived != null)
+ MessageReceived(this, new MessageEventArgs() { Message = msg });
+ }
}
}
diff --git a/qController.Standard/Pages/ControlPage.xaml.cs b/qController.Standard/Pages/ControlPage.xaml.cs
index ce73183..aeb6115 100644
--- a/qController.Standard/Pages/ControlPage.xaml.cs
+++ b/qController.Standard/Pages/ControlPage.xaml.cs
@@ -17,10 +17,10 @@ namespace qController
InitializeComponent();
qController = new QController(address, 53000);
- qController.qParser.SelectedCueUpdated += SelectedCueUpdated;
- qController.qParser.WorkspaceUpdated += WorkspaceUpdated;
+ qController.qClient.qParser.SelectedCueUpdated += SelectedCueUpdated;
+ qController.qClient.qParser.WorkspaceUpdated += WorkspaceUpdated;
- qController.qParser.ParseWorkspaceInfo(qController.qClient.sendAndReceiveString("/cueLists"));
+ qController.qClient.sendAndReceiveString("/cueLists");
NavigationPage.SetHasNavigationBar(this, false);
instanceName.Text = name;
diff --git a/qController.Standard/qController.csproj b/qController.Standard/qController.csproj
index 9e8806c..db76674 100644
--- a/qController.Standard/qController.csproj
+++ b/qController.Standard/qController.csproj
@@ -39,6 +39,8 @@
+
+