当前位置: 首页>>代码示例>>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;未经允许,请勿转载。