private async void Tela_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { History del = new History(); del = DetailListView.SelectedItem as History; DataProfile.Accounts[_lastSelectedItem.Idacc].Histories.Remove(del); await ReadWrite.saveStringToLocalFile("data", JsonSerilizer.ToJson(DataProfile)); }
private async void AddHistory(object sender, RoutedEventArgs e) { double accStart; if (!Double.TryParse(AmountBox.Text, out accStart)) { Error("Введите сумму в рублях"); AmountBox.Text = ""; AmountBox.Focus(FocusState.Keyboard); } else if(Convert.ToDouble(AmountBox.Text) < 0) { Error("Некорректные данные. Необходимо ввести число"); AmountBox.Text = ""; AmountBox.Focus(FocusState.Keyboard); } else if (Convert.ToDouble(AmountBox.Text) > 1000000000000) { Error("Слишком большое число"); } else if (AutoSuggestBox.Text == "") { Error("Введите название категории"); } else if (AutoSuggestBox.Text.Length > 19) { Error("Введите название не длинее 20-ти символов"); } else { History NewHistory = new History(); NewHistory.CurrentCategory.name = AutoSuggestBox.Text; NewHistory.Amount = Convert.ToDouble(AmountBox.Text); if (((ComboBoxItem)IncomeBox.SelectedItem).Content.ToString() == "Доход") NewHistory.Income = true; else NewHistory.Income = false; NewHistory.Idhis = acc.MyProfile.Accounts[myID].Histories.Count; NewHistory.DateOfOperation = DateBox.Date; CurrentProfile.Accounts[myID].Histories.Add(NewHistory); CurrentProfile.Accounts[myID].Histories.OrderBy(o => o.DateOfOperation).Reverse(); await ReadWrite.saveStringToLocalFile("data", JsonSerilizer.ToJson(CurrentProfile)); if (CheckLastPageForward(typeof(AccountPage))) //Переход с AddNewAccount via Forward { this.Frame.Navigate( typeof(AccountPage), acc.id, new Windows.UI.Xaml.Media.Animation.DrillInNavigationTransitionInfo()); } else if (CheckLastPage(typeof(AccountPage))) { this.Frame.Navigate( typeof(AccountPage), acc.id, new Windows.UI.Xaml.Media.Animation.DrillInNavigationTransitionInfo()); } else { DataToProvide data = new DataToProvide(); data.MyProfile = CurrentProfile; data.id = myID; this.Frame.Navigate( typeof(HistoryPage), data, new Windows.UI.Xaml.Media.Animation.DrillInNavigationTransitionInfo()); } } }
private async void Tela_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { History del = new History(); del = HistoryList.SelectedItem as History; CurrentProfile.Accounts[myID].Histories.Remove(del); await ReadWrite.saveStringToLocalFile("data", JsonSerilizer.ToJson(CurrentProfile)); }