本文整理汇总了C#中MediaPortal.UI.Presentation.Workflow.NavigationContext类的典型用法代码示例。如果您正苦于以下问题:C# NavigationContext类的具体用法?C# NavigationContext怎么用?C# NavigationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NavigationContext类属于MediaPortal.UI.Presentation.Workflow命名空间,在下文中一共展示了NavigationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanEnterState
public bool CanEnterState(NavigationContext oldContext, NavigationContext newContext)
{
lock (syncObject)
{
return currentBackgroundTask == null;
}
}
示例2: UpdateNavigationItems
protected static ItemsList UpdateNavigationItems(NavigationContext context)
{
try
{
ItemsList navigationItems = GetOrCreateNavigationItems(context);
Stack<NavigationContext> contextStack = ServiceRegistration.Get<IWorkflowManager>().NavigationContextStack;
List<NavigationContext> contexts = new List<NavigationContext>(contextStack);
contexts.Reverse();
navigationItems.Clear();
bool first = true;
foreach (NavigationContext ctx in contexts)
{
ListItem item = new ListItem(KEY_NAME, ctx.DisplayLabel);
item.AdditionalProperties[KEY_ISFIRST] = first;
NavigationContext contextCopy = ctx;
item.Command = new MethodDelegateCommand(() => WorkflowPopToState(contextCopy.WorkflowState.StateId));
first = false;
navigationItems.Add(item);
}
navigationItems.FireChange();
return navigationItems;
}
catch (Exception e)
{
ServiceRegistration.Get<ILogger>().Warn("WorkflowNavigationBar: Error updating properties", e);
return null;
}
}
示例3: closeDialog
void closeDialog(NavigationContext context)
{
currentBackgroundTask = null;
var screenMgr = ServiceRegistration.Get<IScreenManager>();
if (screenMgr.TopmostDialogInstanceId == context.DialogInstanceId)
screenMgr.CloseTopmostDialog();
}
示例4: EnterModelContext
public void EnterModelContext(NavigationContext oldContext, NavigationContext newContext)
{
// reset the properties
UpdateInfo = string.Empty;
UpdateProgress = 0;
// start the update in a background thread
RunUpdate(newContext);
}
示例5: getParameters
bool getParameters(NavigationContext context)
{
game = null;
object gameObject;
if (!context.ContextVariables.TryGetValue(KEY_GAME, out gameObject))
return false;
game = gameObject as Game;
return game != null;
}
示例6: GetOrCreateNavigationItems
protected static ItemsList GetOrCreateNavigationItems(NavigationContext context)
{
lock (context.SyncRoot)
{
ItemsList result = GetNavigationItems(context);
if (result == null)
context.ContextVariables[NAVIGATION_ITEMS_KEY] = result = new ItemsList();
return result;
}
}
示例7: DoTask
protected override void DoTask(NavigationContext context)
{
if (!getParameters(context))
return;
SetProgress("Launching " + game.Title, 0);
launcher = new GameLauncher(game);
launcher.ExtractionProgress += (s, e) => SetProgress(string.Format("Extracting {0}%", e.Percent), e.Percent);
launcher.Starting += (s, e) => SetProgress("Launching...", 50);
launcher.Exited += launcher_Exited;
launcher.Launch();
}
示例8: NavigationContext
/// <summary>
/// This constructor has to be called from the component managing the navigation context stack.
/// </summary>
public NavigationContext(WorkflowState workflowState, string displayLabel, NavigationContext predecessor,
IWorkflowModel workflowModel)
{
_workflowState = workflowState;
_displayLabel = displayLabel;
_predecessor = predecessor;
if (workflowModel != null)
{
_workflowModelId = workflowModel.ModelId;
_models.Add(workflowModel.ModelId, workflowModel);
}
}
示例9: ExitModelContext
public void ExitModelContext(NavigationContext oldContext, NavigationContext newContext)
{
// set a flag to stop the update if the thread is still running
lock (syncObject)
{
if (currentBackgroundTask != null) currentBackgroundTask.State = WorkState.CANCELED;
}
// wait until the update background thread has ended
while (currentBackgroundTask != null)
{
System.Threading.Thread.Sleep(20);
}
}
示例10: IsActionEnabled
public bool IsActionEnabled(NavigationContext context)
{
if (context.WorkflowModelId == Guids.WorkFlowModelOV)
{
if (!BackgroundTask.Instance.IsExecuting)
{
if (context.WorkflowState.Name == Guids.WorkflowStateCategoriesName || context.WorkflowState.StateId == Guids.WorkflowStateVideos)
{
return ((OnlineVideosWorkflowModel)context.Models[context.WorkflowModelId.Value]).SelectedSite.Site.CanSearch;
}
}
}
return false;
}
示例11: DoTask
protected override void DoTask(NavigationContext context)
{
if (!getParameters(context))
return;
SetProgress(string.Format("Looking up {0}", platformStr), 0);
var platform = importer.GetPlatformByName(platformStr);
if (platform != null)
{
SetProgress(string.Format("Retrieving info for {0}", platform.Name), 33);
var platformInfo = importer.GetPlatformInfo(platform.Id);
if (platformInfo != null)
{
System.Threading.Thread.Sleep(2000);
SetProgress(string.Format("Updating {0}", emulator.Title), 67);
emulator.Title = platformInfo.Title;
emulator.Developer = platformInfo.Developer;
emulator.Description = platformInfo.GetDescription();
using (ThumbGroup thumbGroup = new ThumbGroup(emulator))
{
using (SafeImage image = ImageHandler.SafeImageFromWeb(platformInfo.LogoUrl))
{
if (image != null)
{
thumbGroup.Logo.SetSafeImage(image.Image);
thumbGroup.SaveThumb(ThumbType.Logo);
}
}
using (SafeImage image = ImageHandler.SafeImageFromWeb(platformInfo.FanartUrl))
{
if (image != null)
{
thumbGroup.Fanart.SetSafeImage(image.Image);
thumbGroup.SaveThumb(ThumbType.Fanart);
}
}
}
emulator.Commit();
}
}
}
示例12: OnStateSlotChanged
private static void OnStateSlotChanged(DependencyObject targetObject, NavigationContext context, string contextVariable)
{
if (string.IsNullOrEmpty(contextVariable))
{
WorkflowSaveRestoreStateAction action = GetSaveRestoreAction(targetObject);
if (action != null)
{
action.DetachFromObject();
RemoveSaveRestoreAction(targetObject);
}
}
else
{
if (GetSaveRestoreAction(targetObject) != null)
// Action already attached to object
return;
UIElement uiElement = targetObject as UIElement;
WorkflowSaveRestoreStateAction action = new WorkflowSaveRestoreStateAction(context, contextVariable);
SetSaveRestoreAction(targetObject, action);
action.AttachToObject(uiElement);
}
}
示例13: WorkflowSaveRestoreStateAction
public WorkflowSaveRestoreStateAction(NavigationContext context, string contextVariable)
{
_context = context;
_contextVariable = contextVariable;
}
示例14: SendStatePushedMessage
public const string CONTEXT = "Context"; // Type: NavigationContext
/// <summary>
/// Sends a <see cref="MessageType.StatePushed"/> message.
/// </summary>
/// <param name="context">Navigation context of the workflow state which was pushed onto the navigation context stack.</param>
public static void SendStatePushedMessage(NavigationContext context)
{
SystemMessage msg = new SystemMessage(MessageType.StatePushed);
msg.MessageData[CONTEXT] = context;
ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg);
}
示例15: UpdateMenuActions
public void UpdateMenuActions(NavigationContext context, IDictionary<Guid, WorkflowAction> actions)
{
}