本文整理汇总了C#中MediaPortal.UI.Presentation.Workflow.NavigationContext.SetMenuActions方法的典型用法代码示例。如果您正苦于以下问题:C# NavigationContext.SetMenuActions方法的具体用法?C# NavigationContext.SetMenuActions怎么用?C# NavigationContext.SetMenuActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaPortal.UI.Presentation.Workflow.NavigationContext
的用法示例。
在下文中一共展示了NavigationContext.SetMenuActions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoPushNavigationContext
//.........这里部分代码省略.........
}
// Store model exceptions
IList<Exception> delayedExceptions = new List<Exception>();
// Push new context
logger.Debug("WorkflowManager: Entering workflow state '{0}'", state.Name);
_navigationContextStack.Push(newContext);
Guid? predecessorModelId = predecessor == null ? null : predecessor.WorkflowModelId;
// Communicate context change to models
bool modelChange = workflowModelId != predecessorModelId;
// - Handle predecessor workflow model
IWorkflowModel predecessorWorkflowModel = predecessorModelId.HasValue ?
GetOrLoadModel(predecessorModelId.Value) as IWorkflowModel : null;
if (predecessorWorkflowModel != null)
if (modelChange)
{
logger.Debug("WorkflowManager: Deactivating predecessor workflow model '{0}'", predecessorModelId.Value);
try
{
predecessorWorkflowModel.Deactivate(predecessor, newContext);
}
catch (Exception e)
{
logger.Error("WorkflowManager: Error deactivating workflow model '{0}'", e, predecessorWorkflowModel.ModelId);
delayedExceptions.Add(e);
}
}
// else: same model is currently active - model context change will be handled in the next block
// - Handle new workflow model
if (workflowModel != null)
if (modelChange)
{
if (predecessor == null)
logger.Debug("WorkflowManager: Starting first model context with workflow state '{0}' in workflow model '{1}'",
newContext.WorkflowState.StateId, workflowModelId.Value);
else
logger.Debug("WorkflowManager: Entering model context with workflow state '{0}' (old state was '{1}') in new workflow model '{2}'",
newContext.WorkflowState.StateId, predecessor.WorkflowState.StateId, workflowModelId.Value);
try
{
workflowModel.EnterModelContext(predecessor, newContext);
}
catch (Exception e)
{
logger.Error("WorkflowManager: Error entering model context of workflow model '{0}' for workflow state '{1}'", e,
workflowModel.ModelId, newContext.WorkflowState.StateId);
delayedExceptions.Add(e);
}
}
else
{
logger.Debug("WorkflowManager: Changing model context to workflow state '{0}' (old state was '{1}') in workflow model '{2}'",
newContext.WorkflowState.StateId, predecessor == null ? null : predecessor.WorkflowState.StateId.ToString(), workflowModelId.Value);
try
{
workflowModel.ChangeModelContext(predecessor, newContext, true);
}
catch (Exception e)
{
logger.Error("WorkflowManager: Error changing model context of workflow model '{0}' from workflow state '{1}' to workflow state '{2}'",
e, workflowModel.ModelId, predecessor.WorkflowState.StateId, newContext.WorkflowState.StateId);
delayedExceptions.Add(e);
}
}
if (state.WorkflowType == WorkflowType.Workflow)
{
// Compile menu actions
logger.Debug("WorkflowManager: Compiling menu actions for workflow state '{0}'", state.Name);
IDictionary<Guid, WorkflowAction> menuActions = new Dictionary<Guid, WorkflowAction>();
foreach (WorkflowAction action in FilterActionsBySourceState(state.StateId, _menuActions.Values))
menuActions.Add(action.ActionId, action);
if (workflowModel != null)
try
{
workflowModel.UpdateMenuActions(newContext, menuActions);
}
catch (Exception e)
{
logger.Error("WorkflowManager: Error updating menu actions in workflow model '{0}' for workflow state '{1}'", e,
workflowModel.ModelId, newContext.WorkflowState.StateId);
delayedExceptions.Add(e);
}
newContext.SetMenuActions(menuActions.Values);
}
if (delayedExceptions.Count > 0)
throw delayedExceptions.First();
WorkflowManagerMessaging.SendStatePushedMessage(newContext);
return true;
}
finally
{
ExitWriteLock();
IterateCache_NoLock();
}
}