Work on Workspace loading

This commit is contained in:
2019-04-23 11:05:28 -05:00
parent 2bbf837b9e
commit 924a8e7af0
10 changed files with 79 additions and 29 deletions
+19 -6
View File
@@ -84,7 +84,8 @@ namespace qController
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)},
new ColumnDefinition{Width = new GridLength(1,GridUnitType.Star)}
},
Margin = new Thickness(10)
Margin = new Thickness(10),
IsVisible = false
};
@@ -143,10 +144,21 @@ namespace qController
{
if(e.UpdatedWorkspace.data.Count > 0)
{
App.rootPage.MenuPage.ChangeToWorkspace(e.UpdatedWorkspace);
qController.qWorkspace = e.UpdatedWorkspace;
//qController.RefreshGroupCues();
qController.qWorkspace.CheckPopulated();
if (qController.qWorkspace.IsPopulated)
{
if (qCell.activeCue == null)
{
QCue noSelect = new QCue();
noSelect.listName = "No Cue Selected";
noSelect.type = "";
noSelect.notes = "Workspace has loaded but no cue is selected";
noSelect.number = "!";
qCell.UpdateSelectedCue(noSelect);
}
}
Console.WriteLine("Workspace updated in ControlPage: " + qController.qWorkspace.workspace_id);
}
}
@@ -182,6 +194,8 @@ namespace qController
else
sLayout.Children.Remove(qSelectedCueOptions);
qCell.UpdateSelectedCue(args.Cue);
if (!mainG.IsVisible)
mainG.IsVisible = true;
});
}
}
@@ -190,15 +204,13 @@ namespace qController
{
Console.WriteLine("Children Updated in ControlPage: " + args.cue_id);
qController.qWorkspace.UpdateChildren(args.cue_id, args.children);
if (qController.qWorkspace.ChildrenPopulated())
if (qController.qWorkspace.IsPopulated)
{
Device.BeginInvokeOnMainThread(() =>
{
if (App.MenuIsPresented)
{
//App.MenuIsPresented = false;
App.rootPage.MenuPage.ChangeToWorkspace(qController.qWorkspace);
//App.MenuIsPresented = true;
}
else
{
@@ -207,6 +219,7 @@ namespace qController
}
});
qController.qClient.UpdateSelectedCue();
App.showToast("Workspace cues loaded...");
}
}
@@ -5,6 +5,7 @@ using Acr.UserDialogs;
using Acr.Settings;
using Zeroconf;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace qController
{
@@ -38,7 +39,6 @@ namespace qController
NavigationPage.SetHasNavigationBar(this, false);
lstView.ItemsSource = QStorage.qInstances;
lstView.ItemTemplate = new DataTemplate(typeof(QInstanceCell));
lstView.SeparatorVisibility = SeparatorVisibility.None;
lstView.ItemTapped += (object sender, ItemTappedEventArgs e) =>
@@ -98,7 +98,7 @@ namespace qController
if (!qName.Ok)
return;
QStorage.AddInstance(qName.Text,qAddress.Text);
showToast("Manual Workspace Added!");
App.showToast("Manual Workspace Added!");
}
});
@@ -109,7 +109,7 @@ namespace qController
async void Scan(){
bool workspacesFound = false;
showToast("Scanning for Workspaces...");
App.showToast("Scanning for Workspaces...");
Console.WriteLine("Begin Scanning");
IReadOnlyList<IZeroconfHost> results = await ZeroconfResolver.ResolveAsync("_qlab._udp.local.",TimeSpan.FromSeconds(3));
@@ -118,7 +118,8 @@ namespace qController
{
if (result != null)
{
QStorage.AddInstance(result.DisplayName, result.IPAddress);
QInstance instance = new QInstance(result.DisplayName, result.IPAddress);
QStorage.AddInstance(instance);
Console.WriteLine(result.DisplayName + " @ " + result.IPAddress + " added");
workspacesFound = true;
}
@@ -126,9 +127,9 @@ namespace qController
}
if(workspacesFound){
showToast("Workspace Found and Added!");
App.showToast("Workspace Found and Added!");
}else{
showToast("No Workspaces Found!");
App.showToast("No Workspaces Found!");
}
}