private void addCustomTaskButton_Click(object sender, RoutedEventArgs e) { string taskName = AddTaskWindow.Prompt("Please name your new task:", "Add Task", "", AddTaskWindow.InputType.Text); if (taskName != null) { Task task = new Task(taskName, true, this); this.TaskList.Add(task); int index = this.TaskStack.Children.Count; TaskStack.Children.Insert(index, task); } }
public static string Prompt(string question, string title, string defaultValue = "", InputType inputType = InputType.Text) { AddTaskWindow inst = new AddTaskWindow(question, title, defaultValue, inputType); inst.ShowDialog(); if (inst.DialogResult == true) { return(inst.ResponseText); } return(null); }