Beispiel #1
0
        /// <summary>
        /// 新建一个Subscribtion
        /// </summary>
        private async void EditFeedButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            EditDialog EditFeedDialog = new EditDialog();
            await EditFeedDialog.ShowAsync();

            FeedEditListView.SelectedItem = null;
        }
Beispiel #2
0
        private async void AddResultButton_Click(object sender, RoutedEventArgs e)
        {
            DBT.Text         = SomeSeparator.ActualWidth.ToString();
            EditTextBox.Text = String.Empty;
            NonePunishmentRadioButton.IsChecked = true;

            var dialogResult = await EditDialog.ShowAsync();

            if (dialogResult == ContentDialogResult.Primary)
            {
                var result = Double.TryParse(EditTextBox.Text, out double value);

                if (result && value > 0)
                {
                    App.MainPageInstance.UpdateResult(new Result(
                                                          value,
                                                          MainPage.Results.Count + 2, GetCheckedPunishment(),
                                                          null));
                }
                else
                {
                    ShowAlertDialogAsync("Input Format Error!");
                }

                UpdateTotalStatistics();
            }
        }
Beispiel #3
0
        private async void ModifyFlyoutItem_Click(object sender, RoutedEventArgs e)
        {
            var indexToModify = (int)(sender as MenuFlyoutItem).Tag;

            EditTextBox.Text = Results[indexToModify].ResultValue.ToString();
            SetCheckedRadioButton(Results[indexToModify].ResultPunishment);

            var dialogResult = await EditDialog.ShowAsync();

            if (dialogResult == ContentDialogResult.Primary)
            {
                var result = Double.TryParse(EditTextBox.Text, out double value);

                if (result && value > 0)
                {
                    //1. Modify result in current memory
                    //2. Modify result in MainPage memory Done by one line of code
                    MainPage.Results[indexToModify].ResultValue      = value;
                    MainPage.Results[indexToModify].ResultPunishment = GetCheckedPunishment();

                    //3. Recalculate Ao5/Ao12 results
                    App.MainPageInstance.RefreshListOfResult(indexToModify, MainPage.Results);

                    //4. Modify result in disk
                    MainPage.SaveDataAsync(false);
                }
                else
                {
                    ShowAlertDialogAsync("Input Format Error!");
                }

                UpdateTotalStatistics();
            }
        }
Beispiel #4
0
        private async void EditTodoBtn_Click(XamlUICommand sender, ExecuteRequestedEventArgs args)
        {
            string id = args.Parameter as string;

            EditDialog.Tag          = id;
            TxbEditTitle.Text       = TodoList.GetTodo(id).Title;
            TxbEditDescription.Text = TodoList.GetTodo(id).Description;
            await EditDialog.ShowAsync();
        }
        private async void EditButton_Click(object sender, RoutedEventArgs e)
        {
            EditDialog dialog = new EditDialog(MyVocabulary);
            await dialog.ShowAsync();

            Bindings.Update();

            var frame = (Frame)Window.Current.Content;
            var page  = (MainPage)frame.Content;

            page.SaveBtnEnabled = true;
            page.UpdateSelectedVocContent();
        }
        private async void EditButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            // Prepare ViewModel.
            var companyCarViewModel = new CompanyCarViewModel(ViewModel.SelectedCompanyCar);

            companyCarViewModel.PropertyChanged += (obj, ev) => EditDialog.IsPrimaryButtonEnabled = companyCarViewModel.IsValid;
            companyCarViewModel.Validate();
            EditDialog.DataContext = companyCarViewModel;

            // Process Dialog.
            var result = await EditDialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                // Update model.
                companyCarViewModel.Update(ViewModel.SelectedCompanyCar);
            }

            // Cleanup.
            companyCarViewModel.PropertyChanged -= (obj, ev) => EditDialog.IsPrimaryButtonEnabled = companyCarViewModel.IsValid;
        }
        private async void ShowEditContentDialog()
        {
            foreach (CustomCommand command in ListCommands.SelectedItems)// TODO error & empty field handling
            {
                var dialog = new EditDialog("Edit command", new string[] { command.Name, command.Example, command.ListenFor, command.Feedback, command.BatchCommand });
                ContentDialogResult result = await dialog.ShowAsync();

                if (result == ContentDialogResult.Primary)
                {
                    ViewModel.Commands.Remove(command);
                    ViewModel.Commands.Add(new CustomCommand()
                    {
                        Name         = dialog.result[0],
                        Example      = dialog.result[1],
                        ListenFor    = dialog.result[2],
                        Feedback     = dialog.result[3],
                        BatchCommand = dialog.result[4]
                    });
                }
                else
                {
                }
            }
        }
Beispiel #8
0
 private async void AppBarButton_Click_2(object sender, RoutedEventArgs e)
 {
     await EditDialog.ShowAsync();
 }