當前位置: 首頁>>代碼示例>>C#>>正文


C# Task.IncPriority方法代碼示例

本文整理匯總了C#中ToDoLib.Task.IncPriority方法的典型用法代碼示例。如果您正苦於以下問題:C# Task.IncPriority方法的具體用法?C# Task.IncPriority怎麽用?C# Task.IncPriority使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ToDoLib.Task的用法示例。


在下文中一共展示了Task.IncPriority方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: lbTasks_PreviewKeyDown

		//this is just for j and k - the nav keys. Using KeyDown allows for holding the key to navigate
		private void lbTasks_PreviewKeyDown(object sender, KeyEventArgs e)
		{
			if (Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && lbTasks.HasItems)
			{
				var selected = lbTasks.SelectedItem as Task;
				var updated = new Task(selected.Raw);

				switch (e.SystemKey)
				{
					case Key.Up:
						updated.IncPriority();
						_taskList.Update(selected, updated);
						Reload();
						FilterAndSort(_currentSort);
						break;

					case Key.Down:
						updated.DecPriority();
						_taskList.Update(selected, updated);
						FilterAndSort(_currentSort);
						Reload();
						break;
					case Key.Left:
					case Key.Right:
						updated.SetPriority(' ');
						_taskList.Update(selected, updated);
						FilterAndSort(_currentSort);
						Reload();
						break;
				}

				return;
			}

			switch (e.Key)
			{
				case Key.J:
					if (lbTasks.SelectedIndex < lbTasks.Items.Count - 1)
					{
						lbTasks.ScrollIntoView(lbTasks.Items[lbTasks.SelectedIndex + 1]);
						lbTasks.SelectedIndex = lbTasks.SelectedIndex + 1;
					}
					break;
				case Key.K:
					if (lbTasks.SelectedIndex > 0)
					{
						lbTasks.ScrollIntoView(lbTasks.Items[lbTasks.SelectedIndex - 1]);
						lbTasks.SelectedIndex = lbTasks.SelectedIndex - 1;
					}
					break;
				default:
					break;
			}
		}
開發者ID:balinjdl,項目名稱:todotxt.net,代碼行數:55,代碼來源:MainWindow.xaml.cs

示例2: IncreaseTaskPriority

 private Task IncreaseTaskPriority(Task task, dynamic newPriority = null)
 {
     Task newTask = new Task(task.Raw);
     newTask.IncPriority();
     return newTask;
 }
開發者ID:aviera,項目名稱:todotxt.net,代碼行數:6,代碼來源:MainWindowViewModel.cs

示例3: TaskListPreviewKeyDown

		public void TaskListPreviewKeyDown(KeyEventArgs e)
		{
			if (Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && _window.lbTasks.HasItems)
			{
				var selected = _window.lbTasks.SelectedItem as Task;
				var updated = new Task(selected.Raw);

				switch (e.SystemKey)
				{
					case Key.Up:
						updated.IncPriority();
						try
						{
							_taskList.Update(selected, updated);
						}
						catch (Exception ex)
						{
							ex.Handle("Error while changing priority");
						}

						Refresh();

						break;

					case Key.Down:
						updated.DecPriority();
						try
						{
							_taskList.Update(selected, updated);
						}
						catch (Exception ex)
						{
							ex.Handle("Error while changing priority");
						}

						Refresh();
						break;
					case Key.Left:
					case Key.Right:
						updated.SetPriority(' ');
						try
						{
							_taskList.Update(selected, updated);
						}
						catch (Exception ex)
						{
							ex.Handle("Error while changing priority");
						}
						Refresh();
						break;
				}

				return;
			}

			switch (e.Key)
			{
				case Key.J:
				case Key.Down:
					if (_window.lbTasks.SelectedIndex < _window.lbTasks.Items.Count - 1)
					{
						_window.lbTasks.SelectedIndex++;
						_window.lbTasks.ScrollIntoView(_window.lbTasks.Items[_window.lbTasks.SelectedIndex]);
					}
					e.Handled = true;
					break;
				case Key.K:
				case Key.Up:
					if (_window.lbTasks.SelectedIndex > 0)
					{
						_window.lbTasks.ScrollIntoView(_window.lbTasks.Items[_window.lbTasks.SelectedIndex - 1]);
						_window.lbTasks.SelectedIndex = _window.lbTasks.SelectedIndex - 1;
					}
					e.Handled = true;
					break;
				default:
					break;
			}
		}
開發者ID:sy-vv,項目名稱:todotxt.net,代碼行數:79,代碼來源:MainWindowViewModel.cs

示例4: IncreasePriority

        public void IncreasePriority()
        {
            Task selectedTask = (Task)_window.lbTasks.SelectedItem;
            if (selectedTask == null) return;

            try
            {
                Task newTask = new Task(selectedTask.Raw);
                newTask.IncPriority();
                _taskList.Update(selectedTask, newTask);
            }
            catch (Exception ex)
            {
                ex.Handle("Error while changing priority.");
            }
            finally
            {
                ReloadFile();
            }
        }
開發者ID:umarinam,項目名稱:todotxt.net,代碼行數:20,代碼來源:MainWindowViewModel.cs


注:本文中的ToDoLib.Task.IncPriority方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。