private async void ToggleUpdater_Click(object sender, RoutedEventArgs e) { if (UpdaterController.IsRunning()) { UpdaterController.StopUpdater(); ToggleUpdater.Content = "Start"; } else { await UpdaterController.StartUpdater(); ToggleUpdater.Content = "Stop"; } }
private async void Save_Click(object sender, RoutedEventArgs e) { if (Interval.Text != "" && Domain.Text != "" && Token.Text != "" && SettingsController.SetSettings(Domain.Text, Token.Text, byte.Parse(Interval.Text)) && await UpdaterController.StartUpdater()) { ToggleUpdater.Content = "Stop"; PopulateToolTip(byte.Parse(Interval.Text)); DisableEdition(); } else { MessageBox.Show("Complete all fields with valid data!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); SettingsController.ResetSettings(); } }
private async void SetupWindow() { Settings settings = SettingsController.GetSettings(); if (settings.Domain != "" && settings.Token != "" && settings.Interval != 0) { Hide(); PopulateFields(settings.Domain, settings.Token, settings.Interval); DisableEdition(); PopulateToolTip(settings.Interval); } if (SettingsController.IsSettedOnStartup()) { OnStartup.IsChecked = true; } else { OnStartup.IsChecked = false; } if (await UpdaterController.StartUpdater()) { ToggleUpdater.Content = "Stop"; } }