Example #1
0
        private DateTime?ShowSetDueDateDialog(DateTime defaultDate)
        {
            var dialog = new SetDueDateDialog(defaultDate);

            dialog.Owner = _window;

            if (dialog.ShowDialog().Value)
            {
                return(dialog.DueDatePicker.SelectedDate);
            }
            return(null);
        }
        private DateTime? ShowSetDueDateDialog()
        {
            if (!AreTasksSelected())
            {
                return null;
            }

            // Get the default due date to show in the Set Due Date dialog.
            Task lastSelectedTask = (Task)_window.lbTasks.SelectedItem;
            string oldTaskRawText = lastSelectedTask.ToString();
            Regex rgx = new Regex(@"(?<=\sdue:)(?<date>(\d{4})-(\d{2})-(\d{2}))");
            string oldDueDateText = rgx.Match(oldTaskRawText).Groups["date"].Value.Trim();
            DateTime defaultDate = (String.IsNullOrEmpty(oldDueDateText)) ? DateTime.Today : DateTime.Parse(oldDueDateText);

            // Get the new due date from the Set Due Date dialog.
            var dialog = new SetDueDateDialog(defaultDate);
            dialog.Owner = _window;
            if (dialog.ShowDialog().Value)
            {
                return dialog.DueDatePicker.SelectedDate;
            }
            return null;
        }
        private DateTime? ShowSetDueDateDialog(DateTime defaultDate)
        {
            var dialog = new SetDueDateDialog(defaultDate);
            dialog.Owner = _window;

            if (dialog.ShowDialog().Value)
            {
                return dialog.DueDatePicker.SelectedDate;
            }
            return null;
        }