mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-09 01:13: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));
|
||||
|
||||
Reference in New Issue
Block a user