mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-22 07:29:13 +00:00
Relocate files
This commit is contained in:
@@ -1,45 +0,0 @@
|
|||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace qController
|
|
||||||
{
|
|
||||||
public class QButton : Button
|
|
||||||
{
|
|
||||||
public QCommand qCommand
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QButton(QCommand command)
|
|
||||||
{
|
|
||||||
|
|
||||||
qCommand = command;
|
|
||||||
Text = qCommand.text;
|
|
||||||
TextColor = Color.Black;
|
|
||||||
FontSize = App.HeightUnit * 2.5;
|
|
||||||
if (qCommand.osc.Contains("go"))
|
|
||||||
{
|
|
||||||
BackgroundColor = Color.SeaGreen;
|
|
||||||
switch (Device.RuntimePlatform)
|
|
||||||
{
|
|
||||||
case Device.iOS:
|
|
||||||
FontSize = App.HeightUnit * 4;
|
|
||||||
FontAttributes = FontAttributes.Bold;
|
|
||||||
break;
|
|
||||||
case Device.Android:
|
|
||||||
FontSize = App.HeightUnit * 4;
|
|
||||||
FontAttributes = FontAttributes.Bold;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (qCommand.osc.Contains("panic"))
|
|
||||||
{
|
|
||||||
BackgroundColor = Color.IndianRed;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BackgroundColor = Color.FromHex("D8D8D8");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using Xamarin.Forms;
|
|
||||||
namespace qController
|
|
||||||
{
|
|
||||||
public class QLevelsButton : ShadowButton
|
|
||||||
{
|
|
||||||
public Button button;
|
|
||||||
public QLevelsButton()
|
|
||||||
{
|
|
||||||
button = new Button
|
|
||||||
{
|
|
||||||
Text = QIcon.SLIDERS,
|
|
||||||
TextColor = Color.Black,
|
|
||||||
FontFamily = App.QFont,
|
|
||||||
FontSize = App.HeightUnit * 4,
|
|
||||||
VerticalOptions = LayoutOptions.FillAndExpand,
|
|
||||||
HorizontalOptions = LayoutOptions.FillAndExpand,
|
|
||||||
HeightRequest = App.HeightUnit * 8,
|
|
||||||
WidthRequest = App.HeightUnit * 8,
|
|
||||||
CornerRadius = (int)(App.HeightUnit * 4),
|
|
||||||
BackgroundColor = Color.LightBlue
|
|
||||||
};
|
|
||||||
|
|
||||||
HeightRequest = button.Height;
|
|
||||||
WidthRequest = button.Width;
|
|
||||||
CornerRadius = button.CornerRadius;
|
|
||||||
Content = button;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace qController
|
|
||||||
{
|
|
||||||
public class ShadowButton : Frame
|
|
||||||
{
|
|
||||||
public ShadowButton(Button b)
|
|
||||||
{
|
|
||||||
//Content = b;
|
|
||||||
HeightRequest = b.Height;
|
|
||||||
WidthRequest = b.Width;
|
|
||||||
CornerRadius = b.CornerRadius;
|
|
||||||
Padding = new Thickness(0);
|
|
||||||
Content = b;
|
|
||||||
HasShadow = true;
|
|
||||||
BorderColor = Color.Black;
|
|
||||||
IsVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShadowButton()
|
|
||||||
{
|
|
||||||
HasShadow = true;
|
|
||||||
BorderColor = Color.Black;
|
|
||||||
IsVisible = false;
|
|
||||||
Padding = new Thickness(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using qController.Communication;
|
using qController.UI.Buttons;
|
||||||
|
|
||||||
namespace qController.Cell
|
namespace qController.UI.Cells
|
||||||
{
|
{
|
||||||
public class QControlsBlock : Frame
|
public class QControlsBlock : Frame
|
||||||
{
|
{
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using qController.QItems;
|
using qController.QItems;
|
||||||
|
|
||||||
namespace qController.Cell
|
namespace qController.UI.Cells
|
||||||
{
|
{
|
||||||
public class QCueListCell : Frame
|
public class QCueListCell : Frame
|
||||||
{
|
{
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
namespace qController.Cell
|
namespace qController.UI.Cells
|
||||||
{
|
{
|
||||||
public class QInstanceCell : ViewCell
|
public class QInstanceCell : ViewCell
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace qController.Cell
|
namespace qController.UI.Cells
|
||||||
{
|
{
|
||||||
public class QLevelsCell : Frame
|
public class QLevelsCell : Frame
|
||||||
{
|
{
|
||||||
+1
-1
@@ -6,7 +6,7 @@ using Xamarin.Forms;
|
|||||||
using qController.QItems;
|
using qController.QItems;
|
||||||
using qController.Events;
|
using qController.Events;
|
||||||
|
|
||||||
namespace qController.Cell
|
namespace qController.UI.Cells
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
x:Class="qController.ControlPage"
|
|
||||||
BackgroundColor="#4A4A4A">
|
|
||||||
<ContentPage.Content>
|
|
||||||
<AbsoluteLayout x:Name="sLayout">
|
|
||||||
<Grid x:Name="topBar"
|
|
||||||
HorizontalOptions="FillAndExpand"
|
|
||||||
AbsoluteLayout.LayoutBounds="0,0,1,.09"
|
|
||||||
AbsoluteLayout.LayoutFlags="All"
|
|
||||||
BackgroundColor="#71AEFF">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="4*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Label x:Name="menuButton"
|
|
||||||
FontFamily="{StaticResource qfont}"
|
|
||||||
HorizontalOptions="Start"
|
|
||||||
VerticalOptions="End"
|
|
||||||
Margin="20,10,20,10"
|
|
||||||
Grid.Row="0" Grid.Column="0"
|
|
||||||
FontSize="25"
|
|
||||||
Text=""/>
|
|
||||||
<Label x:Name="instanceName"
|
|
||||||
HorizontalOptions = "FillAndExpand"
|
|
||||||
VerticalOptions="End"
|
|
||||||
HorizontalTextAlignment="End"
|
|
||||||
Margin="20,10,20,10"
|
|
||||||
Grid.Row="0" Grid.Column="1"/>
|
|
||||||
</Grid>
|
|
||||||
</AbsoluteLayout>
|
|
||||||
</ContentPage.Content>
|
|
||||||
</ContentPage>
|
|
||||||
@@ -1,394 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using Serilog;
|
|
||||||
using Acr.UserDialogs;
|
|
||||||
|
|
||||||
using qController.Dialogs;
|
|
||||||
using qController.QItems;
|
|
||||||
using qController.Cell;
|
|
||||||
using qController.Communication;
|
|
||||||
using qController.Events;
|
|
||||||
|
|
||||||
namespace qController
|
|
||||||
{
|
|
||||||
public partial class ControlPage : ContentPage
|
|
||||||
{
|
|
||||||
QController qController;
|
|
||||||
QSelectedCueCell qCell;
|
|
||||||
QLevelsCell qLevelsCell;
|
|
||||||
QCueListCell qCueListCell;
|
|
||||||
QLevelsButton showLevelsButton;
|
|
||||||
QControlsBlock qControlsBlock;
|
|
||||||
WorkspacePrompt workspacePrompt = new WorkspacePrompt();
|
|
||||||
|
|
||||||
public ControlPage(string name, string address)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
qController = new QController(address, 53000);
|
|
||||||
qController.qClient.qParser.WorkspaceInfoReceived += WorkspaceInfoReceived;
|
|
||||||
qController.qClient.qParser.WorkspaceUpdated += WorkspaceUpdated;
|
|
||||||
qController.qClient.qParser.WorkspaceDisconnect += WorkspaceDisconnected;
|
|
||||||
qController.qClient.qParser.PlaybackPositionUpdated += PlaybackPositionUpdated;
|
|
||||||
qController.qClient.qParser.ConnectionStatusChanged += OnConnectionStatusChanged;
|
|
||||||
qController.qClient.qParser.CueInfoUpdated += OnCueUpdateReceived;
|
|
||||||
qController.qClient.qParser.ChildrenUpdated += OnChildrenUpdated;
|
|
||||||
workspacePrompt.WorkspaceSelected += OnWorkspaceSelected;
|
|
||||||
|
|
||||||
App.rootPage.MenuItemSelected += OnMenuItemSelected;
|
|
||||||
|
|
||||||
instanceName.Text = name;
|
|
||||||
|
|
||||||
InitGUI();
|
|
||||||
|
|
||||||
if (!qController.qClient.connected)
|
|
||||||
{
|
|
||||||
App.showToast("Error connecting...make sure QLab is running");
|
|
||||||
Back();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qController.KickOff();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnWorkspaceSelected(object source, WorkspacePromptArgs args)
|
|
||||||
{
|
|
||||||
if (args.SelectedWorkspace != null)
|
|
||||||
{
|
|
||||||
qController.Connect(args.SelectedWorkspace);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.Debug("CONTROLPAGE - No Workspace selected backing out");
|
|
||||||
Back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnConnectionStatusChanged(object source, ConnectEventArgs args)
|
|
||||||
{
|
|
||||||
Log.Debug($"CONTROLPAGE - Connection Status Changed: {args.WorkspaceId} : {args.Status}");
|
|
||||||
if (args.Status.Equals("ok"))
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(() => {
|
|
||||||
FinishUI();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (args.Status.Equals("badpass"))
|
|
||||||
{
|
|
||||||
workspacePrompt.promptWorkspacePasscode(args.WorkspaceId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WorkspaceInfoReceived(object source, WorkspaceInfoArgs args)
|
|
||||||
{
|
|
||||||
if (args.WorkspaceInfo.Count > 1)
|
|
||||||
{
|
|
||||||
Log.Debug("CONTROLPAGE - MULTIPLE WORKSPACES ON SELECTED COMPUTER");
|
|
||||||
PromptForWorkspace(args.WorkspaceInfo);
|
|
||||||
}
|
|
||||||
else if (args.WorkspaceInfo.Count == 1)
|
|
||||||
{
|
|
||||||
Log.Debug("CONTROLPAGE - ONLY ONE WORKSPACE ON SELECTED COMPUTER");
|
|
||||||
if (!args.WorkspaceInfo[0].hasPasscode)
|
|
||||||
{
|
|
||||||
qController.Connect(args.WorkspaceInfo[0].uniqueID);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
workspacePrompt.promptWorkspacePasscode(args.WorkspaceInfo[0].uniqueID);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NoWorkspacesConfig noWorkspacesConfig = new NoWorkspacesConfig(NoWorkspaceDetected);
|
|
||||||
UserDialogs.Instance.Confirm(noWorkspacesConfig);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PromptForWorkspace(List<QWorkspaceInfo> workspaces)
|
|
||||||
{
|
|
||||||
|
|
||||||
UserDialogs.Instance.ActionSheet(workspacePrompt.getActionSheetConfigForWorkspaces(workspaces));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitGUI()
|
|
||||||
{
|
|
||||||
App.rootPage.MenuPage.ChangeToControl();
|
|
||||||
NavigationPage.SetHasNavigationBar(this, false);
|
|
||||||
|
|
||||||
qCell = new QSelectedCueCell();
|
|
||||||
|
|
||||||
qCell.SelectedCueEdited += OnSelectedCueEdited;
|
|
||||||
|
|
||||||
AbsoluteLayout.SetLayoutFlags(qCell, AbsoluteLayoutFlags.All);
|
|
||||||
|
|
||||||
instanceName.FontSize = App.HeightUnit * 3;
|
|
||||||
|
|
||||||
switch (Device.RuntimePlatform)
|
|
||||||
{
|
|
||||||
case Device.iOS:
|
|
||||||
AbsoluteLayout.SetLayoutBounds(qCell, new Rectangle(0, 0.13, 1, 0.30));
|
|
||||||
topBar.HeightRequest = App.Height * .09;
|
|
||||||
menuButton.FontSize = App.Height * .04;
|
|
||||||
break;
|
|
||||||
case Device.Android:
|
|
||||||
AbsoluteLayout.SetLayoutBounds(qCell, new Rectangle(0, 0.13, 1, 0.35));
|
|
||||||
topBar.HeightRequest = App.Height * .06;
|
|
||||||
menuButton.FontSize = App.Height * .05;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Menu Button Setup
|
|
||||||
var menuButtonGesture = new TapGestureRecognizer();
|
|
||||||
|
|
||||||
menuButtonGesture.Tapped += ShowMenu;
|
|
||||||
menuButton.GestureRecognizers.Add(menuButtonGesture);
|
|
||||||
menuButton.Margin = new Thickness(App.WidthUnit * 2, 0, 0, App.WidthUnit * 2);
|
|
||||||
|
|
||||||
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;
|
|
||||||
qController.qClient.sendTCP(address, args.NewValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FinishUI()
|
|
||||||
{
|
|
||||||
string workspace_prefix = "/workspace/" + qController.qWorkspace.workspace_id;
|
|
||||||
|
|
||||||
qLevelsCell = new QLevelsCell();
|
|
||||||
|
|
||||||
qLevelsCell.mainSlider.ValueChanged += (sender, args) =>
|
|
||||||
{
|
|
||||||
qController.qClient.sendTCP(workspace_prefix + "/cue_id/" + qLevelsCell.activeCue + "/sliderLevel/0", (float)args.NewValue);
|
|
||||||
};
|
|
||||||
qLevelsCell.leftSlider.ValueChanged += (sender, args) =>
|
|
||||||
{
|
|
||||||
qController.qClient.sendTCP(workspace_prefix + "/cue_id/" + qLevelsCell.activeCue + "/sliderLevel/1", (float)args.NewValue);
|
|
||||||
};
|
|
||||||
qLevelsCell.rightSlider.ValueChanged += (sender, args) =>
|
|
||||||
{
|
|
||||||
qController.qClient.sendTCP(workspace_prefix + "/cue_id/" + qLevelsCell.activeCue + "/sliderLevel/2", (float)args.NewValue);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
showLevelsButton = new QLevelsButton();
|
|
||||||
showLevelsButton.button.Clicked += ToggeQLevelsCellVisiblity;
|
|
||||||
|
|
||||||
qControlsBlock = new QControlsBlock(SendOSCFromButton);
|
|
||||||
|
|
||||||
AbsoluteLayout.SetLayoutFlags(qControlsBlock, AbsoluteLayoutFlags.All);
|
|
||||||
AbsoluteLayout.SetLayoutFlags(qLevelsCell, AbsoluteLayoutFlags.All);
|
|
||||||
AbsoluteLayout.SetLayoutFlags(showLevelsButton, AbsoluteLayoutFlags.PositionProportional);
|
|
||||||
|
|
||||||
|
|
||||||
switch (Device.RuntimePlatform)
|
|
||||||
{
|
|
||||||
case Device.iOS:
|
|
||||||
AbsoluteLayout.SetLayoutBounds(qControlsBlock, new Rectangle(0, 0.53, 1, 0.25));
|
|
||||||
AbsoluteLayout.SetLayoutBounds(qLevelsCell, new Rectangle(0.9, 0.40, 0.8, 0.25));
|
|
||||||
AbsoluteLayout.SetLayoutBounds(showLevelsButton, new Rectangle(0.02, 0.34, App.HeightUnit * 8, App.HeightUnit * 8));
|
|
||||||
break;
|
|
||||||
case Device.Android:
|
|
||||||
AbsoluteLayout.SetLayoutBounds(qControlsBlock, new Rectangle(0, 0.58, 1, 0.25));
|
|
||||||
AbsoluteLayout.SetLayoutBounds(qLevelsCell, new Rectangle(0.9, 0.45, 0.8, 0.25));
|
|
||||||
AbsoluteLayout.SetLayoutBounds(showLevelsButton, new Rectangle(0.02, 0.39, App.HeightUnit * 8, App.HeightUnit * 8));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
sLayout.Children.Add(qControlsBlock);
|
|
||||||
sLayout.Children.Add(qLevelsCell);
|
|
||||||
sLayout.Children.Add(showLevelsButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ToggeQLevelsCellVisiblity(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
qLevelsCell.IsVisible = !qLevelsCell.IsVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowMenu(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
App.MenuIsPresented = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Back()
|
|
||||||
{
|
|
||||||
if(qController.qClient.connected)
|
|
||||||
qController.Kill();
|
|
||||||
App.rootPage.MenuItemSelected -= OnMenuItemSelected;
|
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
|
||||||
{
|
|
||||||
App.rootPage.MenuPage.ChangeToHome();
|
|
||||||
App.NavigationPage.Navigation.PopAsync();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void NoWorkspaceDetected(bool resp)
|
|
||||||
{
|
|
||||||
if (resp)
|
|
||||||
Back();
|
|
||||||
}
|
|
||||||
public void WorkspaceDisconnected(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Back();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WorkspaceUpdated(object sender, WorkspaceEventArgs e)
|
|
||||||
{
|
|
||||||
if(e.UpdatedWorkspace.data.Count > 0)
|
|
||||||
{
|
|
||||||
qController.qWorkspace = e.UpdatedWorkspace;
|
|
||||||
qController.qWorkspace.CheckPopulated();
|
|
||||||
|
|
||||||
if (qController.qWorkspace.IsPopulated)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
|
||||||
{
|
|
||||||
App.rootPage.MenuPage.ChangeToWorkspace(e.UpdatedWorkspace);
|
|
||||||
});
|
|
||||||
if (qCell.activeCue == null)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(() => {
|
|
||||||
qCell.UpdateSelectedCue(new NoQCueSelected());
|
|
||||||
});
|
|
||||||
Log.Debug("CONTROLPAGE - Update Selected Cue Called because of Inital Workspace Load");
|
|
||||||
qController.qClient.UpdateSelectedCue(qController.qWorkspace.workspace_id);
|
|
||||||
}
|
|
||||||
Log.Debug("CONTROLPAGE - Workspace Updated " + qController.qWorkspace.workspace_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PlaybackPositionUpdated(object sender, PlaybackPositionArgs e)
|
|
||||||
{
|
|
||||||
qController.playbackPosition = e.PlaybackPosition;
|
|
||||||
Log.Debug("CONTROLPAGE - Playback Position Updated " + qController.playbackPosition);
|
|
||||||
QCue cue = qController.qWorkspace.GetCue(qController.playbackPosition);
|
|
||||||
if(cue != null)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(() => {
|
|
||||||
if (cue.levels != null)
|
|
||||||
showLevelsButton.IsVisible = true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
showLevelsButton.IsVisible = false;
|
|
||||||
qLevelsCell.IsVisible = false;
|
|
||||||
}
|
|
||||||
qCell.UpdateSelectedCue(cue);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCueUpdateReceived(object sender, CueEventArgs args)
|
|
||||||
{
|
|
||||||
if(qController != null)
|
|
||||||
{
|
|
||||||
if(qController.qWorkspace != null)
|
|
||||||
{
|
|
||||||
qController.qWorkspace.UpdateCue(args.Cue);
|
|
||||||
if (qController.playbackPosition == null)
|
|
||||||
{
|
|
||||||
qController.playbackPosition = args.Cue.uniqueID;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.Cue.uniqueID == qController.playbackPosition)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
|
||||||
{
|
|
||||||
Log.Debug("CONTROLPAGE - Refreshing Currently Displayed Cue");
|
|
||||||
if (args.Cue.levels != null)
|
|
||||||
showLevelsButton.IsVisible = true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
showLevelsButton.IsVisible = false;
|
|
||||||
qLevelsCell.IsVisible = false;
|
|
||||||
}
|
|
||||||
qCell.UpdateSelectedCue(args.Cue);
|
|
||||||
if(qLevelsCell != null)
|
|
||||||
{
|
|
||||||
qLevelsCell.activeCue = args.Cue.uniqueID;
|
|
||||||
if (args.Cue.levels != null)
|
|
||||||
{
|
|
||||||
qLevelsCell.UpdateLevels(args.Cue.levels[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnChildrenUpdated(object source, ChildrenEventArgs args)
|
|
||||||
{
|
|
||||||
if(qController != null)
|
|
||||||
{
|
|
||||||
if(qController.qWorkspace != null)
|
|
||||||
{
|
|
||||||
qController.qWorkspace.UpdateChildren(args.cue_id, args.children);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnMenuItemSelected(object source, MenuEventArgs args)
|
|
||||||
{
|
|
||||||
if (args.Command.Contains("/"))
|
|
||||||
{
|
|
||||||
qController.qClient.sendTCP(args.Command);
|
|
||||||
}
|
|
||||||
else if (args.Command == "disconnect")
|
|
||||||
{
|
|
||||||
Back();
|
|
||||||
}else if (args.Command.Contains("cueList"))
|
|
||||||
{
|
|
||||||
var parts = args.Command.Split(' ');
|
|
||||||
if(parts.Length > 1)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
|
||||||
{
|
|
||||||
qCueListCell = new QCueListCell(qController.qWorkspace.GetCueList(parts[1]));
|
|
||||||
qCueListCell.closeButton.Clicked += CloseCueList;
|
|
||||||
qCueListCell.cueListView.ItemSelected += OnCueListItemSelected;
|
|
||||||
AbsoluteLayout.SetLayoutFlags(qCueListCell, AbsoluteLayoutFlags.All);
|
|
||||||
AbsoluteLayout.SetLayoutBounds(qCueListCell, new Rectangle(0, 0.2, 1, 0.9));
|
|
||||||
sLayout.Children.Add(qCueListCell);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CloseCueList(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
|
||||||
{
|
|
||||||
sLayout.Children.Remove(qCueListCell);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCueListItemSelected(object sender, SelectedItemChangedEventArgs e)
|
|
||||||
{
|
|
||||||
OSCListItem cue = (OSCListItem)e.SelectedItem;
|
|
||||||
string selectCueOSC = "/workspace/" + qController.qWorkspace.workspace_id + cue.Command;
|
|
||||||
qController.qClient.sendTCP(selectCueOSC);
|
|
||||||
CloseCueList(sender,e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.HomePage">
|
|
||||||
<ContentPage.Content>
|
|
||||||
</ContentPage.Content>
|
|
||||||
</ContentPage>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace qController
|
|
||||||
{
|
|
||||||
public partial class HomePage : ContentPage
|
|
||||||
{
|
|
||||||
public HomePage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
x:Class="qController.MenuPage">
|
|
||||||
<StackLayout>
|
|
||||||
<ListView x:Name="listView">
|
|
||||||
</ListView>
|
|
||||||
</StackLayout>
|
|
||||||
</ContentPage>
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using qController.QItems;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace qController
|
|
||||||
{
|
|
||||||
public partial class MenuPage : ContentPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public ObservableCollection<MenuPageItem> items { get; } = new ObservableCollection<MenuPageItem>();
|
|
||||||
public MenuPage()
|
|
||||||
{
|
|
||||||
Title = "Menu";
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
ChangeToHome();
|
|
||||||
|
|
||||||
listView.ItemsSource = items;
|
|
||||||
listView.RowHeight = (int)(App.HeightUnit * 6);
|
|
||||||
listView.ItemTemplate = new DataTemplate(() =>
|
|
||||||
{
|
|
||||||
var grid = new Grid {
|
|
||||||
Padding = new Thickness(5, 10),
|
|
||||||
ColumnDefinitions =
|
|
||||||
{
|
|
||||||
new ColumnDefinition{Width = new GridLength(30)},
|
|
||||||
new ColumnDefinition { Width = GridLength.Star }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
var icon = new Label {
|
|
||||||
FontFamily = App.QFont,
|
|
||||||
HorizontalTextAlignment = TextAlignment.Center,
|
|
||||||
VerticalTextAlignment = TextAlignment.Center,
|
|
||||||
FontSize = App.HeightUnit * 3
|
|
||||||
};
|
|
||||||
|
|
||||||
icon.SetBinding(Label.TextProperty, "Icon");
|
|
||||||
|
|
||||||
var label = new Label {
|
|
||||||
VerticalOptions = LayoutOptions.FillAndExpand
|
|
||||||
};
|
|
||||||
label.SetBinding(Label.TextProperty, "Title");
|
|
||||||
|
|
||||||
if (label.Text == "Disconnect")
|
|
||||||
label.TextColor = Color.DarkRed;
|
|
||||||
|
|
||||||
switch (Device.RuntimePlatform)
|
|
||||||
{
|
|
||||||
case Device.iOS:
|
|
||||||
label.FontSize = App.HeightUnit * 3;
|
|
||||||
break;
|
|
||||||
case Device.Android:
|
|
||||||
label.FontSize = App.HeightUnit * 2.2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
grid.Children.Add(icon);
|
|
||||||
grid.Children.Add(label, 1, 0);
|
|
||||||
return new ViewCell { View = grid };
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemSelected(EventHandler<SelectedItemChangedEventArgs> ItemSelected){
|
|
||||||
listView.ItemSelected += ItemSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearSelectedItem()
|
|
||||||
{
|
|
||||||
listView.SelectedItem = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeToControl()
|
|
||||||
{
|
|
||||||
items.Clear();
|
|
||||||
items.Add(new MenuPageItem
|
|
||||||
{
|
|
||||||
Title = "Disconnect",
|
|
||||||
Icon = QIcon.CANCEL,
|
|
||||||
Command = "disconnect"
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
public void ChangeToWorkspace(QOldWorkspace workspace)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < workspace.data.Count; i++)
|
|
||||||
{
|
|
||||||
var cueList = workspace.data[i];
|
|
||||||
items.Add(new MenuPageItem
|
|
||||||
{
|
|
||||||
Title = cueList.listName,
|
|
||||||
Icon = cueList.IconText,
|
|
||||||
Command = "cueList " + cueList.uniqueID
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeToHome()
|
|
||||||
{
|
|
||||||
items.Clear();
|
|
||||||
items.Add(new MenuPageItem
|
|
||||||
{
|
|
||||||
Title = "Scan Network",
|
|
||||||
Icon = "\uE800",
|
|
||||||
Command = "scan"
|
|
||||||
});
|
|
||||||
items.Add(new MenuPageItem
|
|
||||||
{
|
|
||||||
Title = "Add Manually",
|
|
||||||
Icon = "\uE801",
|
|
||||||
Command = "add"
|
|
||||||
});
|
|
||||||
items.Add(new MenuPageItem
|
|
||||||
{
|
|
||||||
Title = "Send Feedback",
|
|
||||||
Icon = QIcon.MAIL,
|
|
||||||
Command = "feedback"
|
|
||||||
});
|
|
||||||
items.Add(new MenuPageItem
|
|
||||||
{
|
|
||||||
Title = "Support Project",
|
|
||||||
Icon = QIcon.DOLLAR,
|
|
||||||
Command = "support"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
x:Class="qController.Pages.QBrowserPage">
|
|
||||||
<ContentPage.Content>
|
|
||||||
|
|
||||||
<StackLayout x:Name="sLayout" Spacing="0">
|
|
||||||
|
|
||||||
<!--Old "Instance" listview -->
|
|
||||||
<ListView x:Name="storageListView"
|
|
||||||
HasUnevenRows="true"
|
|
||||||
BackgroundColor="#4a4a4a"
|
|
||||||
SeparatorVisibility="None">
|
|
||||||
|
|
||||||
</ListView>
|
|
||||||
|
|
||||||
|
|
||||||
<!--Beginning of new style of "server" view-->
|
|
||||||
|
|
||||||
<BoxView HeightRequest="10" BackgroundColor="DarkGray"/>
|
|
||||||
|
|
||||||
<Frame BackgroundColor="SlateGray"
|
|
||||||
CornerRadius="0"
|
|
||||||
HasShadow="False"
|
|
||||||
Margin="0"
|
|
||||||
Padding="0">
|
|
||||||
<!--Need to try and remove the group spacing caused by ios:GroupHeaderStyle-->
|
|
||||||
<ListView x:Name="serverListView"
|
|
||||||
ios:ListView.GroupHeaderStyle="Grouped"
|
|
||||||
GroupDisplayBinding="{Binding name}"
|
|
||||||
IsGroupingEnabled="True"
|
|
||||||
d:IsGroupingEnabled="False"
|
|
||||||
BackgroundColor="Transparent"
|
|
||||||
SeparatorVisibility="None"
|
|
||||||
ItemsSource="{Binding ServersGrouped}"
|
|
||||||
Margin="0">
|
|
||||||
<ListView.GroupHeaderTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<ViewCell>
|
|
||||||
<Frame BackgroundColor="#ffffff"
|
|
||||||
Margin="0,0,0,0"
|
|
||||||
Padding="10,0,10,0"
|
|
||||||
CornerRadius="0">
|
|
||||||
<Grid BackgroundColor="Transparent" VerticalOptions="FillAndExpand"
|
|
||||||
RowSpacing="0"
|
|
||||||
ColumnSpacing="0">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<Label Grid.Column="0"
|
|
||||||
Text="{Binding GroupName}"
|
|
||||||
HorizontalOptions="FillAndExpand"
|
|
||||||
VerticalOptions="FillAndExpand"
|
|
||||||
VerticalTextAlignment="Center"
|
|
||||||
HorizontalTextAlignment="Start"/>
|
|
||||||
<Label Grid.Column="1"
|
|
||||||
Text="{Binding version}"
|
|
||||||
HorizontalOptions="FillAndExpand"
|
|
||||||
VerticalOptions="FillAndExpand"
|
|
||||||
VerticalTextAlignment="Center"
|
|
||||||
HorizontalTextAlignment="End"/>
|
|
||||||
</Grid>
|
|
||||||
</Frame>
|
|
||||||
|
|
||||||
</ViewCell>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListView.GroupHeaderTemplate>
|
|
||||||
<ListView.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<ViewCell>
|
|
||||||
<Frame BackgroundColor="#D8D8D8"
|
|
||||||
BorderColor="Black"
|
|
||||||
Margin="5,0,5,0"
|
|
||||||
Padding="10,0,10,0"
|
|
||||||
CornerRadius="0"
|
|
||||||
HasShadow="False">
|
|
||||||
<Grid Margin="0"
|
|
||||||
BackgroundColor="Transparent"
|
|
||||||
RowSpacing="0"
|
|
||||||
ColumnSpacing="0">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
|
|
||||||
<Label Grid.Column="0" Text="{Binding Name}"
|
|
||||||
HorizontalOptions="FillAndExpand"
|
|
||||||
VerticalOptions="FillAndExpand"
|
|
||||||
VerticalTextAlignment="Center"
|
|
||||||
HorizontalTextAlignment="Start"/>
|
|
||||||
|
|
||||||
<Label Grid.Column="1" Text="󱆄"
|
|
||||||
FontFamily="{StaticResource MaterialFontFamily}"
|
|
||||||
FontSize="Large"
|
|
||||||
IsVisible="{Binding HasPasscode}"
|
|
||||||
HorizontalOptions="FillAndExpand"
|
|
||||||
VerticalOptions="FillAndExpand"
|
|
||||||
VerticalTextAlignment="Center"
|
|
||||||
HorizontalTextAlignment="End"/>
|
|
||||||
</Grid>
|
|
||||||
</Frame>
|
|
||||||
</ViewCell>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListView.ItemTemplate>
|
|
||||||
</ListView>
|
|
||||||
</Frame>
|
|
||||||
</StackLayout>
|
|
||||||
</ContentPage.Content>
|
|
||||||
</ContentPage>
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
using QControlKit;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using Serilog;
|
|
||||||
using qController.Cell;
|
|
||||||
using Acr.UserDialogs;
|
|
||||||
using qController.Dialogs;
|
|
||||||
using Xamarin.Essentials;
|
|
||||||
using System;
|
|
||||||
using qController.ViewModels;
|
|
||||||
|
|
||||||
namespace qController.Pages
|
|
||||||
{
|
|
||||||
public partial class QBrowserPage : ContentPage
|
|
||||||
{
|
|
||||||
public QBrowserPage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
App.rootPage.MenuItemSelected += OnMenuItemSelected;
|
|
||||||
|
|
||||||
serverListView.BindingContext = new QBrowserViewModel(new QBrowser());
|
|
||||||
serverListView.ItemSelected += QWorkspaceSelected;
|
|
||||||
|
|
||||||
storageListView.ItemsSource = QStorage.qInstances;
|
|
||||||
storageListView.ItemTemplate = new DataTemplate(typeof(QInstanceCell));
|
|
||||||
storageListView.ItemTapped += (object sender, ItemTappedEventArgs e) =>
|
|
||||||
{
|
|
||||||
// don't do anything if we just de-selected the row
|
|
||||||
if (e.Item == null) return;
|
|
||||||
// do something with e.SelectedItem
|
|
||||||
((ListView)sender).SelectedItem = null; // de-select the row
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async void QWorkspaceSelected(object sender, SelectedItemChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.SelectedItem == null)
|
|
||||||
return;
|
|
||||||
QWorkspace selectedWorkspace = (e.SelectedItem as QWorkspaceViewModel).workspace;
|
|
||||||
Log.Debug($"[demo] workspace: {selectedWorkspace.nameWithoutPathExtension} has been selected");
|
|
||||||
((ListView)sender).SelectedItem = null;
|
|
||||||
|
|
||||||
if (selectedWorkspace.hasPasscode)
|
|
||||||
{
|
|
||||||
UserDialogs.Instance.Prompt(new PromptConfig
|
|
||||||
{
|
|
||||||
InputType = InputType.Number,
|
|
||||||
MaxLength = 4,
|
|
||||||
Title = "Workspace Requires Passcode",
|
|
||||||
OkText = "Connect",
|
|
||||||
IsCancellable = true,
|
|
||||||
OnTextChanged = args =>
|
|
||||||
{
|
|
||||||
args.IsValid = args.Value != null && !args.Value.Equals("") && args.Value.Length == 4;
|
|
||||||
},
|
|
||||||
OnAction = async (resp) =>
|
|
||||||
{
|
|
||||||
if (resp.Ok)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Passcode is null: {resp.Value == null}");
|
|
||||||
await Navigation.PushAsync(new WorkspacePage(selectedWorkspace, resp.Value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await Navigation.PushAsync(new WorkspacePage(selectedWorkspace));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void AddWorkspace()
|
|
||||||
{
|
|
||||||
UserDialogs.Instance.Prompt(new AddInstancePrompt());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnMenuItemSelected(object source, MenuEventArgs args)
|
|
||||||
{
|
|
||||||
if (args.Command == "add")
|
|
||||||
{
|
|
||||||
AddWorkspace();
|
|
||||||
}
|
|
||||||
else if (args.Command == "feedback")
|
|
||||||
{
|
|
||||||
Launcher.OpenAsync(new Uri("mailto:feedback@jwetzell.com?subject=qController%20feedback"));
|
|
||||||
}
|
|
||||||
else if (args.Command == "support")
|
|
||||||
{
|
|
||||||
UserDialogs.Instance.Confirm(new DonatePrompt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.RootPage" xmlns:pages="clr-namespace:qController">
|
|
||||||
|
|
||||||
</MasterDetailPage>
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace qController
|
|
||||||
{
|
|
||||||
public class MenuEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public string Command
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial class RootPage : MasterDetailPage
|
|
||||||
{
|
|
||||||
public MenuPage MenuPage;
|
|
||||||
public delegate void MenuItemSelectedHandler(object source, MenuEventArgs args);
|
|
||||||
public event MenuItemSelectedHandler MenuItemSelected;
|
|
||||||
|
|
||||||
public RootPage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
MenuPage = (MenuPage)Master;
|
|
||||||
|
|
||||||
MenuPage.setItemSelected(OnItemSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
|
|
||||||
{
|
|
||||||
var item = e.SelectedItem as MenuPageItem;
|
|
||||||
if (item != null)
|
|
||||||
{
|
|
||||||
MenuPage.clearSelectedItem();
|
|
||||||
IsPresented = false;
|
|
||||||
if (MenuItemSelected != null)
|
|
||||||
MenuItemSelected(this, new MenuEventArgs { Command = item.Command });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.Pages.RootPageDetail" Title="Detail">
|
|
||||||
<StackLayout Padding="10">
|
|
||||||
<Label Text="This is a detail page. To get the 'triple' line icon on each platform add a icon to each platform and update the 'Master' page with an Icon that references it." />
|
|
||||||
</StackLayout>
|
|
||||||
</ContentPage>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using Xamarin.Forms.Xaml;
|
|
||||||
|
|
||||||
namespace qController.Pages
|
|
||||||
{
|
|
||||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
|
||||||
public partial class RootPageDetail : ContentPage
|
|
||||||
{
|
|
||||||
public RootPageDetail()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="qController.Pages.RootPageMaster" Title="Master">
|
|
||||||
<StackLayout>
|
|
||||||
<ListView x:Name="MenuItemsListView" SeparatorVisibility="None" HasUnevenRows="true" ItemsSource="{Binding MenuItems}">
|
|
||||||
<ListView.Header>
|
|
||||||
<Grid BackgroundColor="#03A9F4">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="10" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="10" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="30" />
|
|
||||||
<RowDefinition Height="80" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="10" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Label Grid.Column="1" Grid.Row="2" Text="AppName" Style="{DynamicResource SubtitleStyle}" />
|
|
||||||
</Grid>
|
|
||||||
</ListView.Header>
|
|
||||||
<ListView.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<ViewCell>
|
|
||||||
<StackLayout Padding="15,10" HorizontalOptions="FillAndExpand">
|
|
||||||
<Label VerticalOptions="FillAndExpand" VerticalTextAlignment="Center" Text="{Binding Title}" FontSize="24" />
|
|
||||||
</StackLayout>
|
|
||||||
</ViewCell>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListView.ItemTemplate>
|
|
||||||
</ListView>
|
|
||||||
</StackLayout>
|
|
||||||
</ContentPage>
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using Xamarin.Forms.Xaml;
|
|
||||||
|
|
||||||
namespace qController.Pages
|
|
||||||
{
|
|
||||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
|
||||||
public partial class RootPageMaster : ContentPage
|
|
||||||
{
|
|
||||||
public ListView ListView;
|
|
||||||
|
|
||||||
public RootPageMaster()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
BindingContext = new RootPageMasterViewModel();
|
|
||||||
ListView = MenuItemsListView;
|
|
||||||
}
|
|
||||||
|
|
||||||
class RootPageMasterViewModel : INotifyPropertyChanged
|
|
||||||
{
|
|
||||||
public ObservableCollection<RootPageMenuItem> MenuItems { get; set; }
|
|
||||||
|
|
||||||
public RootPageMasterViewModel()
|
|
||||||
{
|
|
||||||
MenuItems = new ObservableCollection<RootPageMenuItem>(new[]
|
|
||||||
{
|
|
||||||
new RootPageMenuItem { Id = 0, Title = "Page 1" },
|
|
||||||
new RootPageMenuItem { Id = 1, Title = "Page 2" },
|
|
||||||
new RootPageMenuItem { Id = 2, Title = "Page 3" },
|
|
||||||
new RootPageMenuItem { Id = 3, Title = "Page 4" },
|
|
||||||
new RootPageMenuItem { Id = 4, Title = "Page 5" },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
#region INotifyPropertyChanged Implementation
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
|
||||||
void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
|
||||||
{
|
|
||||||
if (PropertyChanged == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:qui="clr-namespace:qController.UI"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
x:Class="qController.WorkspacePage"
|
|
||||||
BackgroundColor="#8F8A99">
|
|
||||||
<Grid RowSpacing="0">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="175"/>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<qui:QSelectedCueFrame x:Name="selectedCueFrame"
|
|
||||||
Grid.Row="0"/>
|
|
||||||
|
|
||||||
|
|
||||||
<!--<Grid x:Name="selectedCueGrid2"
|
|
||||||
Grid.Row="0"
|
|
||||||
RowSpacing="0"
|
|
||||||
BackgroundColor="#D8D8D8">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<Frame Grid.RowSpan="3" Grid.ColumnSpan="5" BorderColor="Black" BackgroundColor="Transparent"/>
|
|
||||||
|
|
||||||
<Label Grid.Row ="0"
|
|
||||||
Grid.Column="0"
|
|
||||||
Text="{Binding number}"
|
|
||||||
d:Text="100"
|
|
||||||
VerticalOptions="CenterAndExpand"
|
|
||||||
HorizontalOptions="CenterAndExpand"
|
|
||||||
FontSize="Medium"/>
|
|
||||||
|
|
||||||
<Label Grid.Row ="1"
|
|
||||||
Grid.Column="0"
|
|
||||||
Grid.ColumnSpan="5"
|
|
||||||
Text="{Binding name}"
|
|
||||||
d:Text="Cue 1"
|
|
||||||
VerticalOptions="CenterAndExpand"
|
|
||||||
HorizontalOptions="CenterAndExpand"
|
|
||||||
FontSize="Large"/>
|
|
||||||
</Grid>-->
|
|
||||||
|
|
||||||
<ScrollView x:Name="cueListScrollView"
|
|
||||||
Grid.Row="1">
|
|
||||||
<Grid x:Name="cueListsGrid"
|
|
||||||
RowSpacing="0"
|
|
||||||
ColumnSpacing="0"
|
|
||||||
BackgroundColor="#808080">
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</ScrollView>
|
|
||||||
</Grid>
|
|
||||||
</ContentPage>
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Serilog;
|
|
||||||
using Xamarin.Essentials;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using Acr.UserDialogs;
|
|
||||||
|
|
||||||
using qController.ViewModels;
|
|
||||||
using qController.UI;
|
|
||||||
|
|
||||||
using QControlKit;
|
|
||||||
using QControlKit.Events;
|
|
||||||
using QControlKit.Constants;
|
|
||||||
|
|
||||||
namespace qController
|
|
||||||
{
|
|
||||||
public partial class WorkspacePage : ContentPage
|
|
||||||
{
|
|
||||||
private QWorkspace connectedWorkspace;
|
|
||||||
private Dictionary<string, Grid> cueGridDict = new Dictionary<string, Grid>();
|
|
||||||
public WorkspacePage(QWorkspace workspace, string passcode = null)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
connectedWorkspace = workspace;
|
|
||||||
connectedWorkspace.WorkspaceUpdated += Workspace_WorkspaceUpdated;
|
|
||||||
connectedWorkspace.WorkspaceConnectionError += ConnectedWorkspace_WorkspaceConnectionError;
|
|
||||||
connectedWorkspace.defaultSendUpdatesOSC = true;
|
|
||||||
connectedWorkspace.CueListChangedPlaybackPosition += ConnectedWorkspace_CueListChangedPlaybackPosition;
|
|
||||||
|
|
||||||
connectedWorkspace.connect(passcode);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConnectedWorkspace_WorkspaceConnectionError(object source, QWorkspaceConnectionErrorArgs connectionErrorArgs)
|
|
||||||
{
|
|
||||||
System.Console.WriteLine("WorkspaceConnectionError Called");
|
|
||||||
if (connectionErrorArgs.status.Equals("badpass"))
|
|
||||||
{
|
|
||||||
UserDialogs.Instance.Prompt(new PromptConfig
|
|
||||||
{
|
|
||||||
InputType = InputType.Number,
|
|
||||||
MaxLength = 4,
|
|
||||||
Title = "Incorrect Passcode!",
|
|
||||||
OkText = "Connect",
|
|
||||||
IsCancellable = true,
|
|
||||||
OnTextChanged = args =>
|
|
||||||
{
|
|
||||||
args.IsValid = args.Value != null && !args.Value.Equals("") && args.Value.Length == 4;
|
|
||||||
},
|
|
||||||
OnAction = (resp) =>
|
|
||||||
{
|
|
||||||
if (resp.Ok)
|
|
||||||
{
|
|
||||||
connectedWorkspace.connect(resp.Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectedWorkspace_CueListChangedPlaybackPosition(object source, QCueListChangedPlaybackPositionArgs args)
|
|
||||||
{
|
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
|
||||||
{
|
|
||||||
QCue selectedCue = connectedWorkspace.cueWithID(args.cueID);
|
|
||||||
connectedWorkspace.fetchDefaultPropertiesForCue(selectedCue);
|
|
||||||
selectedCueFrame.BindingContext = new QCueViewModel(selectedCue, false);
|
|
||||||
if (cueGridDict.ContainsKey(args.cueID))
|
|
||||||
{
|
|
||||||
var cueGrid = cueGridDict[args.cueID]; //element to scroll to
|
|
||||||
cueListScrollView.ScrollToAsync(cueGrid, ScrollToPosition.Center, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace_WorkspaceUpdated(object source, QWorkspaceUpdatedArgs args)
|
|
||||||
{
|
|
||||||
Log.Debug("[workspacepage] Workspace Updated");
|
|
||||||
|
|
||||||
foreach (var cue in connectedWorkspace.cueLists)
|
|
||||||
{
|
|
||||||
if (cue.cues.Count > 0)
|
|
||||||
{
|
|
||||||
List<Task> cueAddTasks = new List<Task>();
|
|
||||||
foreach (var aCue in cue.cues)
|
|
||||||
{
|
|
||||||
QCueGrid cueGrid = cueToGrid(aCue);
|
|
||||||
cueGridDict.Add(aCue.uid, cueGrid);
|
|
||||||
MainThread.InvokeOnMainThreadAsync(() =>
|
|
||||||
{
|
|
||||||
cueListsGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
|
||||||
cueListsGrid.Children.Add(cueGrid, 0, aCue.sortIndex);
|
|
||||||
}).Wait();
|
|
||||||
}
|
|
||||||
connectedWorkspace.valueForKey(cue, QOSCKey.PlaybackPositionId); //fetch playback position for cueList once all cue loading is done.
|
|
||||||
break; //only load first cue list with cues.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDisappearing()
|
|
||||||
{
|
|
||||||
base.OnDisappearing();
|
|
||||||
|
|
||||||
//unsubscribe from events
|
|
||||||
connectedWorkspace.WorkspaceUpdated -= Workspace_WorkspaceUpdated;
|
|
||||||
connectedWorkspace.CueListChangedPlaybackPosition -= ConnectedWorkspace_CueListChangedPlaybackPosition;
|
|
||||||
connectedWorkspace.WorkspaceConnectionError -= ConnectedWorkspace_WorkspaceConnectionError;
|
|
||||||
//disconnect
|
|
||||||
connectedWorkspace.disconnect();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QCueGrid cueToGrid(QCue cue)
|
|
||||||
{
|
|
||||||
QCueGrid cueGrid = new QCueGrid(cue);
|
|
||||||
|
|
||||||
if (cue.cues.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (var aCue in cue.cues)
|
|
||||||
{
|
|
||||||
cueGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
|
||||||
var aCueGrid = cueToGrid(aCue);
|
|
||||||
cueGridDict.Add(aCue.uid, aCueGrid);
|
|
||||||
aCueGrid.Margin = new Thickness(10, 0, 0, 0);
|
|
||||||
cueGrid.Children.Add(aCueGrid, 0, aCue.sortIndex + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cueGrid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
x:Class="qController.QConnectionPage">
|
|
||||||
<StackLayout x:Name="sLayout">
|
|
||||||
<Grid x:Name="topBar"
|
|
||||||
HorizontalOptions="FillAndExpand"
|
|
||||||
BackgroundColor="#71AEFF">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Label x:Name = "menuButton"
|
|
||||||
FontFamily = "{StaticResource qfont}"
|
|
||||||
HorizontalOptions = "Start"
|
|
||||||
VerticalOptions="End"
|
|
||||||
Margin="20,10,20,10"
|
|
||||||
Grid.Row="0" Grid.Column="0"
|
|
||||||
Text=""/>
|
|
||||||
</Grid>
|
|
||||||
<ListView x:Name="listView"
|
|
||||||
HasUnevenRows="true"
|
|
||||||
BackgroundColor="#4A4A4A"
|
|
||||||
SeparatorVisibility="None">
|
|
||||||
|
|
||||||
</ListView>
|
|
||||||
</StackLayout>
|
|
||||||
</ContentPage>
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
using Xamarin.Forms;
|
|
||||||
using System;
|
|
||||||
using Acr.UserDialogs;
|
|
||||||
using Zeroconf;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Serilog;
|
|
||||||
using qController.QItems;
|
|
||||||
using qController.Dialogs;
|
|
||||||
using qController.Cell;
|
|
||||||
using Xamarin.Essentials;
|
|
||||||
|
|
||||||
namespace qController
|
|
||||||
{
|
|
||||||
|
|
||||||
public partial class QConnectionPage : ContentPage
|
|
||||||
{
|
|
||||||
public QConnectionPage()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
InitGUI();
|
|
||||||
App.rootPage.MenuItemSelected += OnMenuItemSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnMenuItemSelected(object source, MenuEventArgs args)
|
|
||||||
{
|
|
||||||
if(args.Command == "scan")
|
|
||||||
{
|
|
||||||
Scan();
|
|
||||||
}
|
|
||||||
else if(args.Command == "add")
|
|
||||||
{
|
|
||||||
AddWorkspace();
|
|
||||||
}
|
|
||||||
else if (args.Command == "feedback")
|
|
||||||
{
|
|
||||||
Launcher.OpenAsync(new Uri("mailto:feedback@jwetzell.com?subject=qController%20feedback"));
|
|
||||||
}
|
|
||||||
else if(args.Command == "support")
|
|
||||||
{
|
|
||||||
UserDialogs.Instance.Confirm(new DonatePrompt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitGUI()
|
|
||||||
{
|
|
||||||
NavigationPage.SetHasNavigationBar(this, false);
|
|
||||||
|
|
||||||
//ListView Setup
|
|
||||||
listView.ItemsSource = QStorage.qInstances;
|
|
||||||
listView.ItemTemplate = new DataTemplate(typeof(QInstanceCell));
|
|
||||||
listView.ItemTapped += (object sender, ItemTappedEventArgs e) =>
|
|
||||||
{
|
|
||||||
// don't do anything if we just de-selected the row
|
|
||||||
if (e.Item == null) return;
|
|
||||||
// do something with e.SelectedItem
|
|
||||||
((ListView)sender).SelectedItem = null; // de-select the row
|
|
||||||
};
|
|
||||||
|
|
||||||
//Platform Specific Setup
|
|
||||||
switch (Device.RuntimePlatform)
|
|
||||||
{
|
|
||||||
case Device.iOS:
|
|
||||||
topBar.HeightRequest = App.Height * .09;
|
|
||||||
menuButton.FontSize = App.Height * .04;
|
|
||||||
menuButton.Margin = new Thickness(App.WidthUnit * 2, 0, 0, App.WidthUnit * 2);
|
|
||||||
break;
|
|
||||||
case Device.Android:
|
|
||||||
topBar.HeightRequest = App.Height * .09;
|
|
||||||
menuButton.FontSize = App.Height * .05;
|
|
||||||
menuButton.Margin = new Thickness(App.WidthUnit * 2, 0, 0, App.WidthUnit * 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
BackgroundColor = Color.FromHex("4A4A4A");
|
|
||||||
|
|
||||||
//MenuButton Setup
|
|
||||||
var menuButtonGesture = new TapGestureRecognizer();
|
|
||||||
menuButtonGesture.Tapped += showMenu;
|
|
||||||
menuButton.GestureRecognizers.Add(menuButtonGesture);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddWorkspace(){
|
|
||||||
UserDialogs.Instance.Prompt(new AddInstancePrompt());
|
|
||||||
}
|
|
||||||
|
|
||||||
async void Scan(){
|
|
||||||
bool workspacesFound = false;
|
|
||||||
App.showToast("Scanning for Instances...");
|
|
||||||
Log.Debug("QCONNECTIONPAGE - Begin Scanning");
|
|
||||||
|
|
||||||
IReadOnlyList<IZeroconfHost> results = await ZeroconfResolver.ResolveAsync("_qlab._udp.local.",TimeSpan.FromSeconds(3));
|
|
||||||
if(results != null){
|
|
||||||
foreach (var result in results)
|
|
||||||
{
|
|
||||||
if (result != null)
|
|
||||||
{
|
|
||||||
QInstance instance = new QInstance(result.DisplayName, result.IPAddress);
|
|
||||||
if(QStorage.AddInstance(instance)){
|
|
||||||
Log.Debug($"QCONNECTIONPAGE - {result.DisplayName} @ {result.IPAddress} added");
|
|
||||||
workspacesFound = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(workspacesFound){
|
|
||||||
App.showToast("Instance Found and Added!");
|
|
||||||
}else{
|
|
||||||
App.showToast("No New Instances Found!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void showMenu(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
App.MenuIsPresented = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user