mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-15 04:13:52 +00:00
* QCueGrid.cs: Rebuild cue grid when children cue change
* QCueGridListHelper.cs: Helper class for linking cue id with cue grid * QCueViewModel.cs: Revoe unused import * QBrowserPage.xaml.cs: * ControlPage.xaml.cs: * QWorkspaceViewModel.cs: * qConnectionPage.xaml.cs: Remove unused import * QWorkspacePage.xaml.cs: Fix scrolling to select cue and handle no selected cue
This commit is contained in:
@@ -4,7 +4,7 @@ using Xamarin.Forms;
|
||||
using Serilog;
|
||||
using Acr.UserDialogs;
|
||||
|
||||
using qController.Dialogs;
|
||||
using qController.UI.Dialogs;
|
||||
using qController.QItems;
|
||||
using qController.UI.Cells;
|
||||
using qController.UI.Buttons;
|
||||
|
||||
@@ -5,7 +5,7 @@ using Zeroconf;
|
||||
using System.Collections.Generic;
|
||||
using Serilog;
|
||||
using qController.QItems;
|
||||
using qController.Dialogs;
|
||||
using qController.UI.Dialogs;
|
||||
using qController.UI.Cells;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using Xamarin.Forms;
|
||||
using Serilog;
|
||||
using qController.UI.Cells;
|
||||
using Acr.UserDialogs;
|
||||
using qController.Dialogs;
|
||||
using qController.UI.Dialogs;
|
||||
using Xamarin.Essentials;
|
||||
using System;
|
||||
using qController.ViewModels;
|
||||
@@ -110,5 +110,5 @@ namespace qController.Pages
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -19,14 +19,16 @@ namespace qController
|
||||
{
|
||||
private QWorkspace connectedWorkspace;
|
||||
private string passcode;
|
||||
private Dictionary<string, Grid> cueGridDict = new Dictionary<string, Grid>();
|
||||
|
||||
public QWorkspacePage(QWorkspace workspace, string passcode = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
connectedWorkspace = workspace;
|
||||
this.passcode = passcode;
|
||||
|
||||
QCueGridListHelper.reset();
|
||||
|
||||
SetupTopBar();
|
||||
|
||||
connectedWorkspace.WorkspaceUpdated += Workspace_WorkspaceUpdated;
|
||||
@@ -90,49 +92,69 @@ namespace qController
|
||||
QCue selectedCue = connectedWorkspace.cueWithID(args.cueID);
|
||||
if(selectedCue != null)
|
||||
{
|
||||
//update properties for selected cue to ensure latest data for cue preview
|
||||
connectedWorkspace.fetchDefaultPropertiesForCue(selectedCue);
|
||||
|
||||
selectedCueFrame.BindingContext = new QCueViewModel(selectedCue, false);
|
||||
if (cueGridDict.ContainsKey(args.cueID))
|
||||
|
||||
//Find cue grid for selected cue and scroll to it if it exists
|
||||
QCueGrid gridToScrollTo = QCueGridListHelper.get(args.cueID);
|
||||
if(gridToScrollTo != null)
|
||||
{
|
||||
var cueGrid = cueGridDict[args.cueID]; //element to scroll to
|
||||
//TODO: FIX THIS
|
||||
cueListScrollView.ScrollToAsync(cueGrid, ScrollToPosition.Center, true);
|
||||
cueListScrollView.ScrollToAsync(gridToScrollTo, ScrollToPosition.Center,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Setup and "empty" cue for when no cue is selected
|
||||
QCue emptyCue = new QCue();
|
||||
emptyCue.workspace = connectedWorkspace;
|
||||
emptyCue.type = "Memo";
|
||||
emptyCue.listName = "No Cue Selected";
|
||||
|
||||
selectedCueFrame.BindingContext = new QCueViewModel(emptyCue, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Workspace_WorkspaceUpdated(object source, QWorkspaceUpdatedArgs args)
|
||||
{
|
||||
Log.Debug("[workspacepage] Workspace Updated");
|
||||
|
||||
//Workspace updated means we connected so update the recent workspace
|
||||
App.SetRecentWorkspace(connectedWorkspace);
|
||||
|
||||
if (connectedWorkspace.cueLists.Count > 0)
|
||||
{
|
||||
List<Task> cueAddTasks = new List<Task>();
|
||||
|
||||
|
||||
foreach (var aCue in connectedWorkspace.cueLists)
|
||||
{
|
||||
|
||||
if(aCue.cues.Count > 0)
|
||||
{
|
||||
QCueGrid cueGrid = new QCueGrid(aCue);
|
||||
|
||||
cueGridDict.Add(aCue.uid, cueGrid);
|
||||
|
||||
QCueGrid mainCueGrid = new QCueGrid(aCue);
|
||||
MainThread.InvokeOnMainThreadAsync(() =>
|
||||
{
|
||||
QCueGridListHelper.insert(aCue.uid, mainCueGrid);
|
||||
cueListsGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||
cueListsGrid.Children.Add(cueGrid, 0, aCue.sortIndex);
|
||||
cueListsGrid.Children.Add(mainCueGrid, 0, aCue.sortIndex);
|
||||
}).Wait();
|
||||
}
|
||||
break; //TODO: Make the displayed cue list selectable
|
||||
}
|
||||
|
||||
connectedWorkspace.valueForKey(connectedWorkspace.firstCueList, QOSCKey.PlaybackPositionId); //fetch playback position for cueList once all cue loading is done.
|
||||
//TODO: fetch playback position for first cue list once all cue loading is done.
|
||||
connectedWorkspace.valueForKey(connectedWorkspace.firstCueList, QOSCKey.PlaybackPositionId);
|
||||
|
||||
|
||||
//Display cuelist and selected cue info
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
selectedCueFrame.IsVisible = true;
|
||||
cueListScrollView.IsVisible = true;
|
||||
});
|
||||
//break; //only load first cue list with cues.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +170,9 @@ namespace qController
|
||||
if (connectedWorkspace.connected)
|
||||
connectedWorkspace.disconnect(); //TODO: This might not be implemented?
|
||||
|
||||
//purge QCueGridListHelper
|
||||
QCueGridListHelper.reset();
|
||||
|
||||
//unsubscribe from events
|
||||
App.rootPage.MenuItemSelected -= OnMenuItemSelected;
|
||||
connectedWorkspace.WorkspaceUpdated -= Workspace_WorkspaceUpdated;
|
||||
|
||||
Reference in New Issue
Block a user