private async void Page_Loaded(object sender, RoutedEventArgs e) { CaptivePortalDetector.DefaultDetectionMethod = SettingsService.Instance.DetectionMethod; _currentSsid = await WifiInfo.GetSsid(); _profile = ProfilesService.Instance.ProfilesDbCollection.FindOne(x => x.Ssid == _currentSsid); _checkConnectTimer.Start(); UpdateButtonStates(); }
private async void GetProfileNameButton_Click(object sender, RoutedEventArgs e) { var ssid = await WifiInfo.GetSsid(); if (!string.IsNullOrEmpty(ssid)) { ViewModel.SelectedProfile.Ssid = ssid; } else { var noWifiDialog = new ContentDialog { Title = "No WiFi connected", Content = "Cannot get current WiFi network's SSID.", PrimaryButtonText = "Ok" }; await noWifiDialog.ShowAsync(); } }
private async void SaveButton_Click(object sender, RoutedEventArgs e) { var result = await MainWebView.InvokeScriptAsync("eval", new[] { ScriptBuilder.GetSaveScript() }); List <List <ProfileField> > forms; try { forms = JsonConvert.DeserializeObject <List <List <ProfileField> > >(result, JsonStorage.GetJsonSerializerSettings()); } catch (JsonException) { await ShowDialog("Error", "Cannot save form."); return; } if (!forms.Any()) { await ShowDialog("Forms not found", "We didn't find any forms that can be saved."); return; } var newSSid = await WifiInfo.GetSsid(); if (!string.IsNullOrWhiteSpace(newSSid)) { _currentSsid = newSSid; } var saveFormContentDialog = new SaveFormContentDialog(_currentSsid, forms); await saveFormContentDialog.ShowAsync(); Page_Loaded(null, null); }