本文整理汇总了C#中ToDoLib.Task.SetPriority方法的典型用法代码示例。如果您正苦于以下问题:C# Task.SetPriority方法的具体用法?C# Task.SetPriority怎么用?C# Task.SetPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToDoLib.Task
的用法示例。
在下文中一共展示了Task.SetPriority方法的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;
}
}
示例2: RemoveTaskPriority
private Task RemoveTaskPriority(Task task, dynamic newPriority = null)
{
Task newTask = new Task(task.Raw);
newTask.SetPriority(' ');
return newTask;
}
示例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;
}
}
示例4: RemovePriority
public void RemovePriority()
{
if (!IsTaskSelected()) return;
try
{
Task selectedTask = (Task)_window.lbTasks.SelectedItem;
Task newTask = new Task(selectedTask.Raw);
newTask.SetPriority(' ');
_taskList.Update(selectedTask, newTask);
}
catch (Exception ex)
{
ex.Handle("Error while changing priority.");
}
finally
{
ReloadFile();
}
}