// Currently not used; the shares edit workflow is started from the shares info screen calling EditCurrentShare. public void EditSelectedShare() { try { Share share = GetSelectedLocalShares().FirstOrDefault(); if (share != null) { ShareProxy = new LocalShares(share); } else { share = GetSelectedServerShares().FirstOrDefault(); if (share == null) { // Should never happen return; } ShareProxy = new ServerShares(share); } IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_SHARE_EDIT_CHOOSE_RESOURCE_PROVIDER); } catch (NotConnectedException) { DisconnectedError(); } catch (Exception e) { ErrorEditShare(e); } }
public void ShowCurrentlyPlaying(bool asynchronously) { Guid currentlyPlayingStateId; lock (SyncObj) { if (IsCurrentlyPlayingWorkflowStateActive) { return; } IPlayerContext pc = GetPlayerContext(_currentPlayerIndex); if (pc == null) { return; } currentlyPlayingStateId = pc.CurrentlyPlayingWorkflowStateId; } IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); if (asynchronously) { workflowManager.NavigatePushAsync(currentlyPlayingStateId); } else { workflowManager.NavigatePush(currentlyPlayingStateId); } // TODO: Would be good if we could wait for the CP screen to be shown. But to achieve that, we need the ScreenManager to send // a message when a screen change has completed. }
public static void ShowSchedules() { Guid WF_STATE_ID_SCHEDULE_LIST = new Guid("88842E97-2EF9-4658-AD35-8D74E3C689A4"); IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(WF_STATE_ID_SCHEDULE_LIST); }
private void ShowSingleChannelGuide(IChannel channel) { if (channel == null || CurrentChannelGroup == null) { return; } int channelId = channel.ChannelId; int groupId = CurrentChannelGroup.ChannelGroupId; IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); NavigationContextConfig navigationContextConfig = new NavigationContextConfig(); navigationContextConfig.AdditionalContextVariables = new Dictionary <string, object>(); navigationContextConfig.AdditionalContextVariables[SlimTvClientModel.KEY_CHANNEL_ID] = channelId; navigationContextConfig.AdditionalContextVariables[SlimTvClientModel.KEY_GROUP_ID] = groupId; Guid stateId = new Guid("A40F05BB-022E-4247-8BEE-16EB3E0B39C5"); if (workflowManager.IsAnyStateContainedInNavigationStack(new Guid[] { stateId })) { workflowManager.NavigatePopToState(stateId, false); } else { workflowManager.NavigatePush(stateId, navigationContextConfig); } }
public override void Execute() { bool isBrowseMode; string screenName; Guid currentWorkflowState; if (!GetRootState(out screenName, out isBrowseMode, out currentWorkflowState)) { return; } string oldScreen = null; if (isBrowseMode) { NavigationData.LoadScreenHierarchy(screenName + "_OLD", out oldScreen); } NavigationData.SaveScreenHierarchy(screenName, isBrowseMode ? oldScreen : Consts.USE_BROWSE_MODE, !isBrowseMode /* backup when switching to browse mode */); IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.StartBatchUpdate(); workflowManager.NavigatePopToState(currentWorkflowState, true); workflowManager.NavigatePush(currentWorkflowState); workflowManager.EndBatchUpdate(); }
public void ShowFullscreenContent(bool asynchronously) { Guid fullscreenContentStateId; lock (SyncObj) { if (IsFullscreenContentWorkflowStateActive) { return; } IPlayerContext pc = PrimaryPlayerContext; if (pc == null) { return; } fullscreenContentStateId = pc.FullscreenContentWorkflowStateId; } IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); if (asynchronously) { workflowManager.NavigatePushAsync(fullscreenContentStateId); } else { workflowManager.NavigatePush(fullscreenContentStateId); } // TODO: Would be good if we could wait for the FSC screen to be shown. But to achieve that, we need the ScreenManager to send // a message when a screen change has completed. }
public void Execute() { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); IServerConnectionManager scm = ServiceRegistration.Get <IServerConnectionManager>(); workflowManager.NavigatePush(string.IsNullOrEmpty(scm.HomeServerSystemId) ? Consts.WF_STATE_ID_ATTACH_TO_SERVER : Consts.WF_STATE_ID_DETACH_FROM_SERVER); }
public override void Execute() { if (!_targetWorkflowStateId.HasValue) { return; } IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(_targetWorkflowStateId.Value); }
void ConfigureSite() { ServiceRegistration.Get <IScreenManager>().CloseTopmostDialog(); // go to settings screen IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Guids.WorkflowStateSiteSettings, new NavigationContextConfig() { NavigationContextDisplayLabel = string.Format("{0} {1}", Name, LocalizationHelper.Translate("[Configuration.Name]")) }); }
/// <summary> /// Tries to show actions for the given <paramref name="mediaItem"/>. This method can also be called from other models. /// </summary> /// <param name="mediaItem">MediaItem</param> public void ShowMediaItemActions(MediaItem mediaItem) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_CHECK_MEDIA_ITEM_ACTION, new NavigationContextConfig { AdditionalContextVariables = new Dictionary <string, object> { { KEY_MEDIA_ITEM, mediaItem } } }); }
/// <summary> /// First shows a menu to choose which media type should be played (Video, Audio, Image), then /// filters the items returned from the given <paramref name="getMediaItemsFunction"/>, checks if we need to show a /// menu for playing those items and shows that menu or adds all items to the playlist at once, starting playing, /// if no player is active and thus no menu needs to be shown. /// </summary> /// <param name="getMediaItemsFunction">Function which returns the media items to be added to the playlist. This function /// might take some time to return the items; in that case, a progress dialog will be shown.</param> public static void CheckQueryPlayAction(GetMediaItemsDlgt getMediaItemsFunction) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_QUERY_AV_TYPE_CHECK_QUERY_PLAYACTION_MULTIPLE_ITEMS, new NavigationContextConfig { AdditionalContextVariables = new Dictionary <string, object> { { KEY_GET_MEDIA_ITEMS_FUNCTION, getMediaItemsFunction }, } }); }
protected static void SaveFailed(string errorMessage) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_PLAYLIST_SAVE_FAILED, new NavigationContextConfig { AdditionalContextVariables = new Dictionary <string, object> { { Consts.KEY_MESSAGE, errorMessage } } }); }
public static void OpenChooseEffectDialog(IPlayerContext playerContext) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_PLAYER_CHOOSE_EFFECT_MENU_DIALOG, new NavigationContextConfig { AdditionalContextVariables = new Dictionary <string, object> { { Consts.KEY_PLAYER_CONTEXT, playerContext }, } }); }
public static void ShowPlaylistInfo(PlaylistBase playlistData) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_PLAYLIST_INFO, new NavigationContextConfig { AdditionalContextVariables = new Dictionary <string, object> { { Consts.KEY_PLAYLIST_DATA, playlistData } } }); }
/// <summary> /// Shows a dialog with all items of the current playlist. /// </summary> /// <param name="disableEditMode">If this parameter is set to <c>true</c>, the button to enter the edit /// playlist mode won't be available.</param> public static void ShowPlaylist(bool disableEditMode) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_SHOW_PLAYLIST, new NavigationContextConfig { AdditionalContextVariables = new Dictionary <string, object> { { Consts.KEY_DISABLE_EDIT_MODE, disableEditMode } } }); }
/// <summary> /// </summary> /// <param name="item">The item which should be played.</param> public static void CheckEdition(MediaItem item) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_CHECK_EDITION, new NavigationContextConfig { AdditionalContextVariables = new Dictionary <string, object> { { KEY_MEDIA_ITEM, item }, } }); }
public void Execute() { IPlayerContextManager playerContextManager = ServiceRegistration.Get <IPlayerContextManager>(); IPlayerContext pc = playerContextManager.CurrentPlayerContext; if (pc == null) { return; } IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(pc.CurrentlyPlayingWorkflowStateId); }
public void HandleNotificationSubWorkflow() { INotification notification = CurrentNotification; if (notification == null || !notification.HandlerWorkflowState.HasValue) { return; } DequeueNotification(); IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(notification.HandlerWorkflowState.Value); }
public static async Task TuneChannel(IChannel channel) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); SlimTvClientModel model = workflowManager.GetModel(SlimTvClientModel.MODEL_ID) as SlimTvClientModel; if (model != null) { await model.Tune(channel); // Always switch to fullscreen workflowManager.NavigatePush(Consts.WF_STATE_ID_FULLSCREEN_VIDEO); } }
public static void OpenAudioMenuDialog(IPlayerContext playerContext, bool showMute) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_PLAYER_AUDIO_MENU_DIALOG, new NavigationContextConfig { AdditionalContextVariables = new Dictionary <string, object> { { Consts.KEY_PLAYER_CONTEXT, playerContext }, { Consts.KEY_SHOW_MUTE, showMute } } }); }
public void SelectResourceProviderAndContinue() { try { ResourceProviderMetadata rpm = _shareProxy.GetSelectedBaseResourceProvider(); if (rpm == null) { // Error case: Should not happen return; } ResourceProviderMetadata oldResourceProvider = _shareProxy.BaseResourceProvider; if (oldResourceProvider == null || oldResourceProvider.ResourceProviderId != rpm.ResourceProviderId) { _shareProxy.ClearAllConfiguredProperties(); } _shareProxy.BaseResourceProvider = rpm; // Check if the choosen MP implements a known path navigation interface and go to that screen, // if supported IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); if (_shareProxy.ResourceProviderSupportsResourceTreeNavigation) { workflowManager.NavigatePush(Consts.WF_STATE_ID_SHARE_EDIT_CHOOSE_PATH); } else // If needed, add other path navigation screens here // Fallback: Simple TextBox path editor screen { workflowManager.NavigatePush(Consts.WF_STATE_ID_SHARE_EDIT_EDIT_PATH); } } catch (NotConnectedException) { DisconnectedError(); } catch (Exception e) { ErrorEditShare(e); } }
public void Execute() { IPlayerContextManager playerContextManager = ServiceRegistration.Get <IPlayerContextManager>(); IPlayerContext pc = playerContextManager.PrimaryPlayerContext; if (pc == null) { return; } IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(pc.FullscreenContentWorkflowStateId); }
private static void Show(NavigationContextConfig context) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); Guid stateId = new Guid("3C6081CB-88DC-44A7-9E17-8D7BFE006EE5"); if (workflowManager.IsAnyStateContainedInNavigationStack(new Guid[] { stateId })) { workflowManager.NavigatePopToState(stateId, false); } else { workflowManager.NavigatePush(stateId, context); } }
public static void Show(IProgram program) { NavigationContextConfig context = null; if (program != null) { context = new NavigationContextConfig(); context.AdditionalContextVariables = new Dictionary <string, object>(); context.AdditionalContextVariables[SlimTvClientModel.KEY_PROGRAM] = program; } IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(STATE_MANUAL_SCHEDULE, context); }
public override void ExecuteConfiguration() { ConfigSettingMetadata metadata = (ConfigSettingMetadata)_setting.Metadata; if (metadata.AdditionalData.ContainsKey("WorkflowState")) { // Custom configuration workflow IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(new Guid(metadata.AdditionalData["WorkflowState"])); // New configuration workflow has to take over the configuration "life cycle" for the // current config setting object (which can be accessed in this model via CurrentConfigSetting): // - Configure data (providing workflow states and screens for doing that, change the data, ...) // - Calling Save and Apply, or discard the setting by not saving it // The the sub workflow should step out again to give the control back to this model again. } }
protected void TuneChannelByProgram(IProgram program) { IChannel channel; if (_tvHandler.ProgramInfo.GetChannel(program, out channel)) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); SlimTvClientModel model = workflowManager.GetModel(SlimTvClientModel.MODEL_ID) as SlimTvClientModel; if (model != null) { model.Tune(channel); // Always switch to fullscreen workflowManager.NavigatePush(Consts.WF_STATE_ID_FULLSCREEN_VIDEO); } } }
/// <summary> /// Depending on parameter <paramref name="play"/>, plays or enqueues the media items of type <paramref name="avType"/> /// returned by the given <paramref name="getMediaItemsFunction"/>. /// This method can also be called from other models. /// </summary> /// <param name="getMediaItemsFunction">Function returning the media items to be played.</param> /// <param name="avType">AV type of media items to be played.</param> /// <param name="play">If <c>true</c>, plays the specified items, else enqueues it.</param> /// <param name="concurrencyMode">Determines if the media item will be played or enqueued in concurrency mode.</param> public static void PlayOrEnqueueItems(GetMediaItemsDlgt getMediaItemsFunction, AVType avType, bool play, PlayerContextConcurrencyMode concurrencyMode) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_PLAY_OR_ENQUEUE_ITEMS, new NavigationContextConfig { AdditionalContextVariables = new Dictionary <string, object> { { KEY_GET_MEDIA_ITEMS_FUNCTION, getMediaItemsFunction }, { KEY_AV_TYPE, avType }, { KEY_DO_PLAY, play }, { KEY_CONCURRENCY_MODE, concurrencyMode }, } }); }
protected static void Navigate(Guid rootWorkflowState, ResourcePath path) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.StartBatchUpdate(); try { workflowManager.NavigatePopStates(new Guid[] { Consts.WF_STATE_ID_LOCAL_MEDIA_NAVIGATION_ROOT, Consts.WF_STATE_ID_BROWSE_MEDIA_NAVIGATION_ROOT }); workflowManager.NavigatePush(rootWorkflowState); Share localShare = FindLocalShareContainingPath(path); if (localShare == null) { ServiceRegistration.Get <ILogger>().Warn("AbstractBrowseMediaNavigationScreenData: Cannot navigate to local browse view - no local share countaining path '{0}' found", path); return; } NavigationData nd = MediaNavigationModel.GetNavigationData(workflowManager.CurrentNavigationContext, false); if (nd == null) { return; } AbstractMediaRootProxyViewSpecification rootVS = FindParentViewSpecification <AbstractMediaRootProxyViewSpecification>(nd); if (rootVS == null) { return; } rootVS.Navigate(localShare, path, navigateVS => { NavigationData currentNd = MediaNavigationModel.GetNavigationData(workflowManager.CurrentNavigationContext, false); if (currentNd == null) { ServiceRegistration.Get <ILogger>().Warn("AbstractBrowseMediaNavigationScreenData: Cannot navigate to local browse view - no navigation data found"); return; } AbstractItemsScreenData sd = (AbstractItemsScreenData)currentNd.CurrentScreenData; sd.NavigateToView(navigateVS); }); } finally { workflowManager.EndBatchUpdate(); } }
protected async Task TuneChannelByProgram(IProgram program) { var result = await _tvHandler.ProgramInfo.GetChannelAsync(program); if (result.Success) { IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); SlimTvClientModel model = workflowManager.GetModel(SlimTvClientModel.MODEL_ID) as SlimTvClientModel; if (model != null) { await model.Tune(result.Result); // Always switch to fullscreen workflowManager.NavigatePush(result.Result.MediaType == MediaType.Radio ? Consts.WF_STATE_ID_FULLSCREEN_AUDIO : Consts.WF_STATE_ID_FULLSCREEN_VIDEO); } } }
public void EditCurrentShare() { try { _shareProxy.EditMode = SharesProxy.ShareEditMode.EditShare; IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_SHARE_EDIT_CHOOSE_RESOURCE_PROVIDER); } catch (NotConnectedException) { DisconnectedError(); } catch (Exception e) { ErrorEditShare(e); } }