mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-19 06:04:12 +00:00
Remove qController calls from QControlsBlock
This commit is contained in:
@@ -8,12 +8,12 @@ namespace qController.Cell
|
|||||||
public class QControlsBlock : Frame
|
public class QControlsBlock : Frame
|
||||||
{
|
{
|
||||||
Grid mainG;
|
Grid mainG;
|
||||||
QController qController;
|
|
||||||
|
|
||||||
|
EventHandler callback;
|
||||||
|
|
||||||
public QControlsBlock(QController controller)
|
public QControlsBlock(EventHandler callback)
|
||||||
{
|
{
|
||||||
qController = controller;
|
this.callback = callback;
|
||||||
|
|
||||||
Margin = new Thickness(10);
|
Margin = new Thickness(10);
|
||||||
Padding = new Thickness(0);
|
Padding = new Thickness(0);
|
||||||
@@ -68,7 +68,7 @@ namespace qController.Cell
|
|||||||
for (int i = 0; i < buttons.Count; i++)
|
for (int i = 0; i < buttons.Count; i++)
|
||||||
{
|
{
|
||||||
QButton b = buttons[i];
|
QButton b = buttons[i];
|
||||||
b.Clicked += sendOSC;
|
b.Clicked += callback;
|
||||||
mainG.Children.Add(b, column, row);
|
mainG.Children.Add(b, column, row);
|
||||||
row++;
|
row++;
|
||||||
if (row == 3)
|
if (row == 3)
|
||||||
@@ -79,7 +79,7 @@ namespace qController.Cell
|
|||||||
}
|
}
|
||||||
|
|
||||||
QButton goButton = new QButton(QCommands.GO);
|
QButton goButton = new QButton(QCommands.GO);
|
||||||
goButton.Clicked += sendOSC;
|
goButton.Clicked += callback;
|
||||||
mainG.Children.Add(goButton, 1, 0);
|
mainG.Children.Add(goButton, 1, 0);
|
||||||
Grid.SetRowSpan(goButton, 3);
|
Grid.SetRowSpan(goButton, 3);
|
||||||
Content = mainG;
|
Content = mainG;
|
||||||
@@ -108,7 +108,7 @@ namespace qController.Cell
|
|||||||
for (int i = 0; i < commands.Count; i++)
|
for (int i = 0; i < commands.Count; i++)
|
||||||
{
|
{
|
||||||
QButton b = new QButton(commands[i]);
|
QButton b = new QButton(commands[i]);
|
||||||
b.Clicked += sendOSC;
|
b.Clicked += callback;
|
||||||
mainG.Children.Add(b, column, row);
|
mainG.Children.Add(b, column, row);
|
||||||
row++;
|
row++;
|
||||||
if (row == 3)
|
if (row == 3)
|
||||||
@@ -119,20 +119,10 @@ namespace qController.Cell
|
|||||||
}
|
}
|
||||||
|
|
||||||
QButton goButton = new QButton(QCommands.GO);
|
QButton goButton = new QButton(QCommands.GO);
|
||||||
goButton.Clicked += sendOSC;
|
goButton.Clicked += callback;
|
||||||
mainG.Children.Add(goButton, 1, 0);
|
mainG.Children.Add(goButton, 1, 0);
|
||||||
Grid.SetRowSpan(goButton, 3);
|
Grid.SetRowSpan(goButton, 3);
|
||||||
Content = mainG;
|
Content = mainG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendOSC(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (((QButton)sender).qCommand.type == "WORKSPACE")
|
|
||||||
{
|
|
||||||
string workspace_prefix = "/workspace/" + qController.qWorkspace.workspace_id;
|
|
||||||
string command = workspace_prefix + ((QButton)sender).qCommand.osc;
|
|
||||||
qController.qClient.sendTCP(command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,6 +150,16 @@ namespace qController
|
|||||||
sLayout.Children.Add(qCell);
|
sLayout.Children.Add(qCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendOSCFromButton(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (((QButton)sender).qCommand.type == "WORKSPACE")
|
||||||
|
{
|
||||||
|
string workspace_prefix = "/workspace/" + qController.qWorkspace.workspace_id;
|
||||||
|
string command = workspace_prefix + ((QButton)sender).qCommand.osc;
|
||||||
|
qController.qClient.sendTCP(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnSelectedCueEdited(object source, CueEditArgs args)
|
private void OnSelectedCueEdited(object source, CueEditArgs args)
|
||||||
{
|
{
|
||||||
string address = "/workspace/" + qController.qWorkspace.workspace_id + "/cue_id/" + args.CueID + "/" + args.Property;
|
string address = "/workspace/" + qController.qWorkspace.workspace_id + "/cue_id/" + args.CueID + "/" + args.Property;
|
||||||
@@ -177,11 +187,9 @@ namespace qController
|
|||||||
|
|
||||||
|
|
||||||
showLevelsButton = new QLevelsButton();
|
showLevelsButton = new QLevelsButton();
|
||||||
showLevelsButton.button.Clicked += (s, e) =>
|
showLevelsButton.button.Clicked += ToggeQLevelsCellVisiblity;
|
||||||
{
|
|
||||||
qLevelsCell.IsVisible = !qLevelsCell.IsVisible;
|
qControlsBlock = new QControlsBlock(SendOSCFromButton);
|
||||||
};
|
|
||||||
qControlsBlock = new QControlsBlock(qController);
|
|
||||||
|
|
||||||
AbsoluteLayout.SetLayoutFlags(qControlsBlock, AbsoluteLayoutFlags.All);
|
AbsoluteLayout.SetLayoutFlags(qControlsBlock, AbsoluteLayoutFlags.All);
|
||||||
AbsoluteLayout.SetLayoutFlags(qLevelsCell, AbsoluteLayoutFlags.All);
|
AbsoluteLayout.SetLayoutFlags(qLevelsCell, AbsoluteLayoutFlags.All);
|
||||||
@@ -207,6 +215,11 @@ namespace qController
|
|||||||
sLayout.Children.Add(showLevelsButton);
|
sLayout.Children.Add(showLevelsButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ToggeQLevelsCellVisiblity(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
qLevelsCell.IsVisible = !qLevelsCell.IsVisible;
|
||||||
|
}
|
||||||
|
|
||||||
void ShowMenu(object sender, EventArgs e)
|
void ShowMenu(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user