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