示例#1
0
        private string ShowPriorityDialog(string defaultPriority)
        {
            var dialog = new SetPriorityDialog(defaultPriority);

            dialog.Owner = _window;

            if (dialog.ShowDialog().Value)
            {
                return(dialog.PriorityText);
            }
            return(null);
        }
示例#2
0
        private string ShowPriorityDialog()
        {
            if (!AreTasksSelected())
            {
                return null;
            }

            // Get the default priority from the selected task to load into the Set Priority dialog
            Task selectedTask = (Task)_window.lbTasks.SelectedItem;
            string selectedTaskRawText = selectedTask.ToString();
            Regex rgx = new Regex(@"^\((?<priority>[A-Z])\)\s"); // matches priority strings such as "(A) " (including trailing space)
            string selectedPriorityRaw = rgx.Match(selectedTaskRawText).ToString(); // Priority letter plus parentheses and trailing space
            string selectedPriority = rgx.Match(selectedTaskRawText).Groups["priority"].Value.Trim(); // Priority letter 
            string defaultPriority = (String.IsNullOrEmpty(selectedPriority)) ? "A" : selectedPriority; // default for the priority dialog
            
            // Get priority from the Set Priority dialog,
            var dialog = new SetPriorityDialog(defaultPriority);
            dialog.Owner = _window;
            if (dialog.ShowDialog().Value)
            {
                return dialog.PriorityText;
            }
            return null;
        }
        private string ShowPriorityDialog(string defaultPriority)
        {
            var dialog = new SetPriorityDialog(defaultPriority);
            dialog.Owner = _window;

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