public App() { InitializeComponent(); SplashFactory = (e) => new Views.Splash(e); ssdpClient = new SSDPClient(); ssdpClient.DeviceFound += SsdpClient_DeviceFound; wifiClient = new WiFiClient(); wifiClient.DeviceFound += WifiClient_DeviceFound; #region App settings var _settings = SettingsService.Instance; RequestedTheme = _settings.AppTheme; CacheMaxDuration = _settings.CacheMaxDuration; ShowShellBackButton = _settings.UseShellBackButton; #endregion }
private async void WifiClient_DeviceFound(object sender, WiFiClient.DeviceFoundEventArgs e) { var device = devices.FirstOrDefault(D => D.GivenName == e.Device.GivenName); await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => { if (device == null) { devices.Add(DeviceTypeFactory.MakeDevice(e.Device.FirmwareName, e.Device)); db.InsertNewDevice(e.Device); } else { device.DeviceDetails.Status = DeviceStatus.UnProvisioned; } }); }