Beispiel #1
0
        private async void ShowAddTaskDialog()
        {
            TextBox contentTextBox = new TextBox()
            {
                Width = 320, Height = 60, MaxLength = 50, PlaceholderText = "Discription of task"
            };

            contentTextBox.Header          = "0 / 50";
            contentTextBox.TextChanged    += new TextChangedEventHandler(TextBox_TextChanged);
            contentTextBox.BorderThickness = new Thickness(1);

            newTaskDialog = new ContentDialog
            {
                Title             = "Add Pomorodoro",
                Content           = contentTextBox,
                CloseButtonText   = "Cancel",
                PrimaryButtonText = "Create",
                DefaultButton     = ContentDialogButton.Primary
            };

            ContentDialogResult result = await newTaskDialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                string selectedBreakValue = ((ComboBoxItem)BreakTime.SelectedValue).Content as string;
                string selectedTaskValue  = ((ComboBoxItem)TaskTime.SelectedValue).Content as string;

                PomTimeBlock ptb = new PomTimeBlock()
                {
                    Discription = contentTextBox.Text
                };
                ptb.SetTaskTime(Int32.Parse(selectedTaskValue) * 60);
                ptb.SetBreakTime(Int32.Parse(selectedBreakValue) * 60);
                ptb.parentReference = this;

                AddToPomItemsList(ptb);
            }
        }
Beispiel #2
0
 private void AddToPomItemsList(PomTimeBlock item)
 {
     pomTimeBlockList.Add(item);
     PomodoroItems.ItemsSource = pomTimeBlockList;
 }