mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-09 17:33:50 +00:00
* AppDelegate.cs:
* packages.config: * packages.config: * qController.iOS.csproj: * qController.Droid.csproj: * qController.csproj: Update Packages * App.xaml: Add some static styles * App.xaml.cs: Trying out Sharpnado Stuff * QCueGrid.cs: Move QCueGrid Recursive stuff inside class * QBrowserViewModel.cs: Hook into new ServerFound/Lost Methods * QCueViewModel.cs: Start work on cue children updating * QServerViewModel.cs: Hook into WorkspaceAdded/Removed methods * MenuPage.xaml.cs: Remove Add from side menu * QBrowserPage.xaml: Further work on front page design * QBrowserPage.xaml.cs: Add Manually add button to main page * QWorkspacePage.xaml.cs: Move recursive stuff out of Page code behind
This commit is contained in:
@@ -5,6 +5,8 @@ using Xamarin.Forms;
|
||||
|
||||
using QControlKit;
|
||||
using QControlKit.Events;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace qController.ViewModels
|
||||
{
|
||||
@@ -21,6 +23,18 @@ namespace qController.ViewModels
|
||||
ServersGrouped = new ObservableCollection<QServerViewModel>();
|
||||
|
||||
this.browser.ServerFound += OnServerFound;
|
||||
this.browser.ServerLost += OnServerLost;
|
||||
|
||||
Device.StartTimer(TimeSpan.FromSeconds(4), () =>
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
this.browser.ProbeForQLabInstances();
|
||||
// do something with time...
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void OnServerFound(object source, QServerFoundArgs args)
|
||||
@@ -32,6 +46,30 @@ namespace qController.ViewModels
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void OnServerLost(object source, QServerLostArgs args)
|
||||
{
|
||||
QServerViewModel serverToRemove = null;
|
||||
|
||||
foreach(var serverGroup in ServersGrouped)
|
||||
{
|
||||
if (serverGroup.host.Equals(args.server.host))
|
||||
{
|
||||
serverToRemove = serverGroup;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(serverToRemove != null)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
System.Console.WriteLine($"[QBrowserViewModel] removing server: {args.server.description}");
|
||||
ServersGrouped.Remove(serverToRemove);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void OnPropertyChanged([CallerMemberName] string name = "")
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
|
||||
@@ -6,12 +6,13 @@ using Xamarin.Forms;
|
||||
using QControlKit;
|
||||
using QControlKit.Constants;
|
||||
using QControlKit.Events;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace qController.ViewModels
|
||||
{
|
||||
public class QCueViewModel : INotifyPropertyChanged
|
||||
{
|
||||
QCue cue;
|
||||
public QCue cue;
|
||||
bool isSelected = false;
|
||||
bool isCollapsed = false;
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
@@ -46,7 +47,11 @@ namespace qController.ViewModels
|
||||
}
|
||||
else if (property.Equals(QOSCKey.Children))
|
||||
{
|
||||
Log.Debug("children property updated");
|
||||
//Log.Debug("children property updated");
|
||||
if (cue.IsGroup)
|
||||
{
|
||||
OnPropertyChanged("cues");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,6 +141,14 @@ namespace qController.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public List<QCue> cues
|
||||
{
|
||||
get
|
||||
{
|
||||
return cue.cues;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get
|
||||
|
||||
@@ -67,25 +67,48 @@ namespace qController.ViewModels
|
||||
this.Add(new QWorkspaceViewModel(workspace));
|
||||
});
|
||||
}
|
||||
this.server.WorkspaceAdded += Server_WorkspaceAdded;
|
||||
this.server.WorkspaceRemoved += Server_WorkspaceRemoved;
|
||||
this.server.ServerUpdated += OnServerUpdated;
|
||||
}
|
||||
|
||||
private void Server_WorkspaceRemoved(object source, QServerWorkspaceChangedArgs args)
|
||||
{
|
||||
QWorkspaceViewModel workspaceToRemove = null;
|
||||
|
||||
foreach(var workspaceViewModel in this)
|
||||
{
|
||||
if(workspaceViewModel.workspace.uniqueID == args.workspace.uniqueID)
|
||||
{
|
||||
workspaceToRemove = workspaceViewModel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(workspaceToRemove != null)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
Remove(workspaceToRemove);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Server_WorkspaceAdded(object source, QServerWorkspaceChangedArgs args)
|
||||
{
|
||||
QWorkspaceViewModel workspaceViewModel = new QWorkspaceViewModel(args.workspace);
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
Add(workspaceViewModel);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnServerUpdated(object source, QServerUpdatedArgs args)
|
||||
{
|
||||
OnPropertyChanged("GroupName");
|
||||
OnPropertyChanged("version");
|
||||
|
||||
foreach (var workspace in this.server.workspaces)
|
||||
{
|
||||
QWorkspaceViewModel workspaceViewModel = new QWorkspaceViewModel(workspace);
|
||||
if (!Contains(workspaceViewModel))
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
Add(workspaceViewModel);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnPropertyChanged([CallerMemberName] string name = "")
|
||||
|
||||
Reference in New Issue
Block a user