protected override async void OnNavigatedTo(NavigationEventArgs e) { if (!string.IsNullOrEmpty(SettingsHelper.Instance.MallKioskDemoCustomSettings)) { try { string escapedContent = SettingsHelper.Instance.MallKioskDemoCustomSettings.Replace("&", "&"); this.kioskSettings = await MallKioskDemoSettings.FromContentAsync(escapedContent); } catch (Exception ex) { await Util.GenericApiCallExceptionHandler(ex, "Failure parsing custom recommendation URLs. Will use default values instead."); } } if (this.kioskSettings == null) { this.kioskSettings = await MallKioskDemoSettings.FromFileAsync("Views\\MallKioskDemoConfig\\MallKioskDemoSettings.xml"); } EnterKioskMode(); if (string.IsNullOrEmpty(SettingsHelper.Instance.FaceApiKey)) { await new MessageDialog("Missing Face API Key. Please enter a key in the Settings page.", "Missing Face API Key").ShowAsync(); } await this.cameraControl.StartStreamAsync(isForRealTimeProcessing : true); this.UpdateWebCamHostGridSize(); this.StartEmotionProcessingLoop(); base.OnNavigatedTo(e); }
private async Task <bool> ReloadSyncedSettingsAsync() { try { StorageFile syncedSettings = await ApplicationData.Current.LocalFolder.GetFileAsync("SyncedSettings.xml"); this.kioskSettings = await MallKioskDemoSettings.FromFileAsync(syncedSettings.Path); return(true); } catch (Exception x) { return(false); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { //if (!string.IsNullOrEmpty(SettingsHelper.Instance.MallKioskDemoCustomSettings)) //{ // try // { // string escapedContent = SettingsHelper.Instance.MallKioskDemoCustomSettings.Replace("&", "&"); // this.kioskSettings = await MallKioskDemoSettings.FromContentAsync(escapedContent); // } // catch (Exception ex) // { // await Util.GenericApiCallExceptionHandler(ex, "Failure parsing custom recommendation URLs. Will use default values instead."); // } //} if (this.kioskSettings == null) { try { StorageFile syncedSettings = await ApplicationData.Current.LocalFolder.GetFileAsync("SyncedSettings.xml"); var data = await syncedSettings.GetBasicPropertiesAsync(); if (data.DateModified < DateTime.Now.AddDays(-2)) { if (await UpdateSyncedSettingsAsync()) { await ReloadSyncedSettingsAsync(); } else { this.kioskSettings = await MallKioskDemoSettings.FromFileAsync("Views\\MallKioskDemoConfig\\MallKioskDemoSettings.xml"); } } else { this.kioskSettings = await MallKioskDemoSettings.FromFileAsync(syncedSettings.Path); } } catch (FileNotFoundException) { UpdateSyncedSettingsAsync(); } catch (Exception) { this.kioskSettings = await MallKioskDemoSettings.FromFileAsync("Views\\MallKioskDemoConfig\\MallKioskDemoSettings.xml"); //load for next time UpdateSyncedSettingsAsync(); } //last check, if any errors occured load defaults. if (this.kioskSettings == null) { this.kioskSettings = await MallKioskDemoSettings.FromFileAsync("Views\\MallKioskDemoConfig\\MallKioskDemoSettings.xml"); } } EnterKioskMode(); //if (string.IsNullOrEmpty(SettingsHelper.Instance.FaceApiKey)) //{ // await new MessageDialog("Missing Face API Key. Please enter a key in the Settings page.", "Missing Face API Key").ShowAsync(); //} await this.cameraControl.StartStreamAsync(isForRealTimeProcessing : true); this.UpdateWebCamHostGridSize(); this.StartEmotionProcessingLoop(); base.OnNavigatedTo(e); }