From 071ce36821be1c899ea7951261776e420b4e0402 Mon Sep 17 00:00:00 2001 From: jwetzell Date: Mon, 15 Jul 2019 16:37:23 -0500 Subject: [PATCH] * QControlsBlock.cs: Make Background Transparent * QSelectedCueCell.cs: Add edit abilities for name and number * ControlPage.xaml: * ControlPage.xaml.cs: Begin switch to AbsoluteLayout --- .../Classes/Cell/QControlsBlock.cs | 2 +- .../Classes/Cell/QSelectedCueCell.cs | 116 +++++++++++++----- qController.Standard/Pages/ControlPage.xaml | 6 +- .../Pages/ControlPage.xaml.cs | 46 +++++-- 4 files changed, 123 insertions(+), 47 deletions(-) diff --git a/qController.Standard/Classes/Cell/QControlsBlock.cs b/qController.Standard/Classes/Cell/QControlsBlock.cs index a188f85..b130cd7 100644 --- a/qController.Standard/Classes/Cell/QControlsBlock.cs +++ b/qController.Standard/Classes/Cell/QControlsBlock.cs @@ -21,7 +21,7 @@ namespace qController IsVisible = true; - BackgroundColor = Color.FromHex("4A4A4A"); + BackgroundColor = Color.Transparent; //highlight Button Grid //BackgroundColor = Color.FromHex("FF0000"); diff --git a/qController.Standard/Classes/Cell/QSelectedCueCell.cs b/qController.Standard/Classes/Cell/QSelectedCueCell.cs index 2855d37..41c53e9 100644 --- a/qController.Standard/Classes/Cell/QSelectedCueCell.cs +++ b/qController.Standard/Classes/Cell/QSelectedCueCell.cs @@ -35,10 +35,7 @@ namespace qController public QCue activeCue; public QSelectedCueCell() { - Padding = new Thickness(5); - CornerRadius = 20; - BackgroundColor = Color.FromHex("D8D8D8"); - HeightRequest = App.HeightUnit * 25; + Grid mainG = new Grid { Padding = new Thickness(0), @@ -115,13 +112,56 @@ namespace qController notes = new Label { Text = "Loading Cue Lists and Playhead Position", HorizontalTextAlignment = TextAlignment.Center, - Margin = new Thickness(0,0,0,10) + Margin = new Thickness(0,0,0,10), + VerticalOptions = LayoutOptions.FillAndExpand, + HorizontalOptions = LayoutOptions.FillAndExpand }; - notes.VerticalOptions = LayoutOptions.FillAndExpand; - notes.HorizontalOptions = LayoutOptions.FillAndExpand; + + //BACKGROUND COLORS FOR TESTING ONLY + //notes.BackgroundColor = Color.Red; + //number.BackgroundColor = Color.Red; + //name.BackgroundColor = Color.Red; + //type.BackgroundColor = Color.Red; + //topGrid.BackgroundColor = Color.Green; + //bottomGrid.BackgroundColor = Color.Green; + + topGrid.Children.Add(number, 0, 0); + topGrid.Children.Add(type, 4, 0); + Grid.SetColumnSpan(number, 3); + Grid.SetColumnSpan(type, 1); + + 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); + + Padding = new Thickness(5); + CornerRadius = 20; + BackgroundColor = Color.FromHex("D8D8D8"); + HeightRequest = App.HeightUnit * 25; + Margin = new Thickness(10); + Content = mainG; + + SetupDoubleTapEdit(); + } + + void SetupDoubleTapEdit() + { var notesDoubleTap = new TapGestureRecognizer(); + var nameDoubleTap = new TapGestureRecognizer(); + var numberDoubleTap = new TapGestureRecognizer(); + notesDoubleTap.NumberOfTapsRequired = 2; + nameDoubleTap.NumberOfTapsRequired = 2; + numberDoubleTap.NumberOfTapsRequired = 2; + notesDoubleTap.Tapped += (s, e) => { UserDialogs.Instance.Prompt(new PromptConfig @@ -140,33 +180,43 @@ namespace qController } }); }; + + nameDoubleTap.Tapped += (s, e) => + { + UserDialogs.Instance.Prompt(new PromptConfig + { + Title = "Update Name", + Message = "Change name to update", + OkText = "Update", + Text = name.Text, + OnAction = (qName) => + { + if (!qName.Ok) + return; + OnSelectedCueEdited("name", qName.Text); + } + }); + }; + + numberDoubleTap.Tapped += (s, e) => + { + UserDialogs.Instance.Prompt(new PromptConfig + { + Title = "Update Number", + Message = "Change number to update", + OkText = "Update", + Text = number.Text, + OnAction = (qNumber) => + { + if (!qNumber.Ok) + return; + OnSelectedCueEdited("number", qNumber.Text); + } + }); + }; notes.GestureRecognizers.Add(notesDoubleTap); - - notes.BackgroundColor = Color.FromHex("FF0000"); - number.BackgroundColor = Color.Red; - name.BackgroundColor = Color.Red; - type.BackgroundColor = Color.Red; - - topGrid.Children.Add(number, 0, 0); - topGrid.Children.Add(type, 4, 0); - Grid.SetColumnSpan(number, 3); - Grid.SetColumnSpan(type, 1); - - 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); - - topGrid.BackgroundColor = Color.FromHex("00FF00"); - bottomGrid.BackgroundColor = Color.FromHex("00FF00"); - Margin = new Thickness(10); - Content = mainG; + name.GestureRecognizers.Add(nameDoubleTap); + number.GestureRecognizers.Add(numberDoubleTap); } public void UpdateSelectedCue(QCue cue) diff --git a/qController.Standard/Pages/ControlPage.xaml b/qController.Standard/Pages/ControlPage.xaml index bd30c0d..16cdf8d 100644 --- a/qController.Standard/Pages/ControlPage.xaml +++ b/qController.Standard/Pages/ControlPage.xaml @@ -1,8 +1,8 @@  - - + + @@ -13,6 +13,6 @@ - + diff --git a/qController.Standard/Pages/ControlPage.xaml.cs b/qController.Standard/Pages/ControlPage.xaml.cs index d80994a..f88d989 100644 --- a/qController.Standard/Pages/ControlPage.xaml.cs +++ b/qController.Standard/Pages/ControlPage.xaml.cs @@ -99,15 +99,18 @@ namespace qController qCell = new QSelectedCueCell(); - + qCell.SelectedCueEdited += OnSelectedCueEdited; + + AbsoluteLayout.SetLayoutBounds(qCell, new Rectangle(0, 0.13, 1, 0.30)); + AbsoluteLayout.SetLayoutFlags(qCell, AbsoluteLayoutFlags.All); sLayout.Children.Add(qCell); } 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; qController.qClient.sendArgsUDP(address, args.NewValue); } void FinishUI() @@ -130,8 +133,22 @@ namespace qController }; qControlsBlock = new QControlsBlock(qController); - + + AbsoluteLayout.SetLayoutBounds(qControlsBlock, new Rectangle(0, 0.53, 1, 0.25)); + AbsoluteLayout.SetLayoutFlags(qControlsBlock, AbsoluteLayoutFlags.All); sLayout.Children.Add(qControlsBlock); + + Button b = new Button{ + Text = "L", + TextColor = Color.Black, + HeightRequest = App.HeightUnit * 10, + WidthRequest = App.HeightUnit * 10, + CornerRadius = (int)(App.HeightUnit * 5), + BackgroundColor = Color.Blue + }; + AbsoluteLayout.SetLayoutBounds(b, new Rectangle(0.99, 0.99, App.HeightUnit * 10, App.HeightUnit * 10)); + AbsoluteLayout.SetLayoutFlags(b, AbsoluteLayoutFlags.PositionProportional); + //sLayout.Children.Add(b); } void ShowMenu(object sender, EventArgs e) @@ -143,7 +160,10 @@ namespace qController void Back() { qController.Disconnect(); - App.rootPage.MenuPage.ChangeToHome(); + Device.BeginInvokeOnMainThread(() => + { + App.rootPage.MenuPage.ChangeToHome(); + }); App.NavigationPage.Navigation.PopAsync(); } @@ -156,7 +176,10 @@ namespace qController if (qController.qWorkspace.IsPopulated) { - App.rootPage.MenuPage.ChangeToWorkspace(e.UpdatedWorkspace); + Device.BeginInvokeOnMainThread(() => + { + App.rootPage.MenuPage.ChangeToWorkspace(e.UpdatedWorkspace); + }); if (qCell.activeCue == null) { Device.BeginInvokeOnMainThread(() => { @@ -181,20 +204,23 @@ namespace qController QCue cue = qController.qWorkspace.GetCue(qController.playbackPosition); if(cue != null) { - Device.BeginInvokeOnMainThread(() => { + /*Device.BeginInvokeOnMainThread(() => { if (cue.type.Equals("Audio")) sLayout.Children.Add(qSelectedCueOptions); else sLayout.Children.Remove(qSelectedCueOptions); qCell.UpdateSelectedCue(cue); - }); + });*/ } } public void OnCueUpdateReceived(object sender, CueEventArgs args) { qController.qWorkspace.UpdateCue(args.Cue); - App.rootPage.MenuPage.ChangeCueName(args.Cue.uniqueID, args.Cue.listName); + Device.BeginInvokeOnMainThread(() => + { + App.rootPage.MenuPage.ChangeCueName(args.Cue.uniqueID, args.Cue.listName); + }); if (qController.playbackPosition == null) { qController.playbackPosition = args.Cue.uniqueID; @@ -205,10 +231,10 @@ namespace qController Device.BeginInvokeOnMainThread(() => { Console.WriteLine("Refreshing Currently Displayed Cue"); - if (args.Cue.levels != null) + /*if (args.Cue.levels != null) sLayout.Children.Add(qSelectedCueOptions); else - sLayout.Children.Remove(qSelectedCueOptions); + sLayout.Children.Remove(qSelectedCueOptions);*/ qCell.UpdateSelectedCue(args.Cue); //if (!mainG.IsVisible) // mainG.IsVisible = true;