public async Task LogoutAsync() { bool logout = await _dialogService.ShowConfirmationDialogAsync( "Confirmation", "Are you sure you want to log out?", "Yes", "No"); if (logout) { //TODO: DELETE ALL !! //delete all from the db //delete user settings //delete all view models OpenPane(false); ShowLoading(true, "Logging out... Please wait.."); BackgroundTasksManager.UnregisterBackgroundTask(); _appSettings.ResetAppSettings(); await _dataService .UserService .ChangeCurrentUserStatus(false); string currentLoggedUsername = _userCredentialService.GetCurrentLoggedUsername(); if (string.IsNullOrEmpty(currentLoggedUsername)) { currentLoggedUsername = _userCredentialService.DefaultUsername; } _userCredentialService.DeleteUserCredential(ResourceType.ALL, currentLoggedUsername); _navigationService.GoBack(); ShowLoading(false); } }
private void SetCommands() { SaveChangesCommand = new RelayCommand (async() => await SaveChangesAsync()); DeleteTaskCommand = new RelayCommand (async() => await DeleteTaskAsync()); MarkAsCompletedCommand = new RelayCommand(async() => { await ChangeTaskStatusAsync(CurrentTask, GoogleTaskStatus.COMPLETED); if (CurrentTask.HasSubTasks) { foreach (var st in CurrentTask.SubTasks) { await ChangeTaskStatusAsync(st, GoogleTaskStatus.COMPLETED); } } }); ClosePaneCommand = new RelayCommand(async() => { if (!AppSettings.AskBeforeDiscardChanges || !ChangesWereMade()) { CleanPanel(); return; } var result = await _dialogService.ShowConfirmationDialogAsync( "Discard changes", "Are you sure you want to discard the changes made?"); if (result == true) { CleanPanel(); //Kinda hack to avoid that below msg gets delivered first await Task.Delay(100); _messenger.Send(CurrentTask.TaskID, $"{MessageType.TASK_CHANGES_WERE_DISCARDED}"); } }); NewSubTaskCommand = new RelayCommand (async() => await NewSubTaskAsync()); DeleteSubTaskCommand = new RelayCommand <TaskItemViewModel> (async(subTask) => await DeleteSubTaskAsync(subTask)); MarkSubTaskAsCompletedCommand = new RelayCommand <TaskItemViewModel> (async(subTask) => await ChangeTaskStatusAsync(subTask, GoogleTaskStatus.COMPLETED)); MarkSubTaskAsIncompletedCommand = new RelayCommand <TaskItemViewModel> (async(subTask) => await ChangeTaskStatusAsync(subTask, GoogleTaskStatus.NEEDS_ACTION)); RemoveTaskNotificationDateCommand = new RelayCommand <TaskNotificationDateType> (async(dateType) => await RemoveTaskNotificationDateAsync(dateType)); }
private async void Navigate(string page) { if (page.Contains("Login")) { var confResult = await _dialogService.ShowConfirmationDialogAsync("Çıkış Yapmak Istediğinize Emin Misiniz ? "); if (confResult == ConfirmationDialogResult.Accepted) { Application.Current.Properties.Clear(); await _navigationService.NavigateAsync(new Uri(page, UriKind.Relative)); } } else { await _navigationService.NavigateAsync(new Uri(page, UriKind.Relative)); } }
private async void SaveCustomer() { if (string.IsNullOrEmpty(Firstname)) { await _customDialogService.ShowMessageDialogAsync("Isim Alanı Boş Bırakılamaz."); return; } if (string.IsNullOrEmpty(Lastname)) { await _customDialogService.ShowMessageDialogAsync("Soyad Alanı Boş Bırakılamaz."); return; } if (string.IsNullOrEmpty(ProfessionCode)) { await _customDialogService.ShowMessageDialogAsync("Uzmanlık Alanı Boş Bırakılamaz."); return; } if (string.IsNullOrEmpty(LocationName)) { await _customDialogService.ShowMessageDialogAsync("Kurum Alanı Boş Bırakılamaz."); return; } var confResult = await _customDialogService.ShowConfirmationDialogAsync(Firstname + " " + Lastname + " Kişisini Eklemek Istediğinize Emin Misiniz ?"); if (confResult == Models.ConfirmationDialogResult.Accepted) { CustomerData customerData = new CustomerData(); customerData.CardName = Firstname + " " + Lastname; customerData.LocationName = LocationName; customerData.CardProfessionCode = ProfessionCode; if (Application.Current.Properties.ContainsKey("CustomerData")) { var list = Application.Current.Properties["CustomerData"] as List <CustomerData>; list.Add(customerData); Application.Current.Properties["CustomerData"] = list; } else { List <CustomerData> localCustomerList = new List <CustomerData>(); localCustomerList.Add(customerData); Application.Current.Properties.Add("CustomerData", localCustomerList); } IDialogParameters parameters = new DialogParameters(); parameters.Add("Result", true); parameters.Add("Model", customerData); RequestClose(parameters); } else { return; } }