本文整理汇总了C#中IMessenger.StatusUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# IMessenger.StatusUpdate方法的具体用法?C# IMessenger.StatusUpdate怎么用?C# IMessenger.StatusUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMessenger
的用法示例。
在下文中一共展示了IMessenger.StatusUpdate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessUndoStack
private void ProcessUndoStack(IMessenger messenger)
{
try
{
Int32 commandsExe = 1;
Int32 totalNumber = _undoStack.Count;
while (_undoStack.Count > 0)
{
ICommand command = _undoStack.Pop();
messenger.StatusUpdate(String.Format("Undoing: {0}", command.UserFeedback), PercentageComplete(commandsExe, totalNumber));
command.Undo();
commandsExe++;
}
}
catch (Exception ex)
{
_workReportCreator.ProcessException(ex, WorkAction.Undo);
messenger.StatusUpdate("An Error occured when rolling back changes", 0);
}
}
示例2: RunCommandQueue
private void RunCommandQueue(IMessenger messenger)
{
try
{
Int32 commandsExe = 1;
Int32 totalNumber = _commandQueue.Count;
foreach (ICommand command in _commandQueue.ProcessQueue())
{
if (_cancelRequested)
{
AttemptRollBack(messenger, "User requested cancel");
break;
}
messenger.StatusUpdate(command.UserFeedback, PercentageComplete(commandsExe, totalNumber));
command.AskUser += messenger.RequestUserFeedback;
command.Execute();
_undoStack.Push(command);
command.AskUser -= messenger.RequestUserFeedback;
commandsExe++;
}
}
catch (Exception ex)
{
_workReportCreator.ProcessException(ex, WorkAction.Execute);
AttemptRollBack(messenger, String.Format("An error occured: {0}", ex.Message));
}
}
示例3: AttemptRollBack
private void AttemptRollBack(IMessenger messenger, String reason)
{
var res = messenger.RequestUserFeedback( String.Format("{0}. Do you want to undo any changes made?", reason), MessageBoxButtons.YesNo);
if (res == DialogResult.Yes)
{
messenger.StatusUpdate("An Error occured, attemping to rollback changes", 0);
ProcessUndoStack(messenger);
}
}