コード例 #1
0
        private int ShowPostponeDialog()
        {
            var dialog = new PostponeDialog();

            dialog.Owner = _window;

            int iDays = 0;

            if (dialog.ShowDialog().Value)
            {
                string sPostpone = dialog.PostponeText.Trim();

                if (sPostpone.Length > 0)
                {
                    try
                    {
                        iDays = Convert.ToInt32(sPostpone);
                    }
                    catch
                    {
                        // No action needed.  iDays will be 0, which will leave the item unaltered.
                    }
                }
            }

            return(iDays);
        }
コード例 #2
0
        private int Postpone(object sender, RoutedEventArgs e)
        {
            var p = new PostponeDialog();

            p.Left = this.Left + 10;
            p.Top  = this.Top + 10;
            int iDays = 0;

            if (p.ShowDialog().Value)
            {
                string sPostpone = p.PostponeText.Trim();

                if (sPostpone.Length > 0)
                {
                    try
                    {
                        iDays = Convert.ToInt32(sPostpone);
                    }
                    catch
                    {
                        // No action needed.  iDays will be 0, which will leave the item unaltered.
                    }
                }
            }

            return(iDays);
        }
コード例 #3
0
        private int ShowPostponeDialog()
        {
            if (!AreTasksSelected())
            {
                return 0;
            }
            
            var dialog = new PostponeDialog();
            dialog.Owner = _window;

            int iDays = 0;

            if (dialog.ShowDialog().Value)
            {
                string sPostpone = dialog.PostponeText.Trim();

                // Lower case for the comparison
                sPostpone = sPostpone.ToLower();
                            

                // Postpone to a day, not a number of days from now
                if (sPostpone == "monday" | sPostpone == "tuesday" | sPostpone == "wednesday" |
                        sPostpone == "thursday" | sPostpone == "friday" | sPostpone == "saturday" |
                        sPostpone == "sunday")
                {
                    DateTime due = DateTime.Now;
                    var count = 0;
                    bool isValid = false;

                    // Set the current due date as today, otherwise if the task is overdue or in the future, the following count won't work correctly
                    ModifySelectedTasks(SetTaskDueDate, DateTime.Today);
                                        
                    //if day of week, add days to today until weekday matches input
                    //if today is the specified weekday, due date will be in one week
                    do
                    {
                        count++;
                        due = due.AddDays(1);
                        isValid = string.Equals(due.ToString("dddd", new CultureInfo("en-US")),
                                                sPostpone,
                                                StringComparison.CurrentCultureIgnoreCase);
                    } while (!isValid && (count < 7));
                    // The count check is to prevent an endless loop in case of other culture.

                    return count;
                }

                if (sPostpone.Length > 0)
                {
                    try
                    {
                        iDays = Convert.ToInt32(sPostpone);
                    }
                    catch
                    {
                        // No action needed.  iDays will be 0, which will leave the item unaltered.
                    }
                }
            }

            return iDays;

        }
コード例 #4
0
		private int ShowPostponeDialog()
		{
			var dialog = new PostponeDialog();
			dialog.Owner = _window;

			int iDays = 0;

			if (dialog.ShowDialog().Value)
			{
				string sPostpone = dialog.PostponeText.Trim();

				if (sPostpone.Length > 0)
				{
					try
					{
						iDays = Convert.ToInt32(sPostpone);
					}
					catch
					{
						// No action needed.  iDays will be 0, which will leave the item unaltered.
					}
				}
			}

			return iDays;

		}
コード例 #5
0
        private int Postpone(object sender, RoutedEventArgs e)
        {
            var p = new PostponeDialog();
            p.Left = this.Left + 10;
            p.Top = this.Top + 10;
            int iDays = 0;

            if (p.ShowDialog().Value)
            {
                string sPostpone = p.PostponeText.Trim();

                if (sPostpone.Length > 0)
                {
                    try
                    {
                        iDays = Convert.ToInt32(sPostpone);
                    }
                    catch
                    {
                        // No action needed.  iDays will be 0, which will leave the item unaltered.
                    }
                }
            }

            return iDays;

        }