Пример #1
0
        public WorkflowContentHandler(IWorkflowManager workflowManager) {

            OnPublished<ContentPart>(
                (context, part) =>
                    workflowManager.TriggerEvent("ContentPublished",
                    context.ContentItem,
                    () => new Dictionary<string, object> { { "Content", context.ContentItem } }));

            OnRemoving<ContentPart>(
                (context, part) =>
                    workflowManager.TriggerEvent("ContentRemoved",
                    context.ContentItem,
                    () => new Dictionary<string, object> { { "Content", context.ContentItem } }));

            OnVersioned<ContentPart>(
                (context, part1, part2) =>
                    workflowManager.TriggerEvent("ContentVersioned",
                    context.BuildingContentItem,
                    () => new Dictionary<string, object> { { "Content", context.BuildingContentItem } }));

            OnCreated<ContentPart>(
                (context, part) =>
                    workflowManager.TriggerEvent("ContentCreated", context.ContentItem,
                    () => new Dictionary<string, object> { { "Content", context.ContentItem } }));

            OnUpdated<ContentPart>(
                (context, part) =>
                    workflowManager.TriggerEvent("ContentUpdated", context.ContentItem,
                    () => new Dictionary<string, object> { { "Content", context.ContentItem } }));
        }
Пример #2
0
 public SignalController(
     IWorkflowManager workflowManager, 
     ISignalService genericEventService,
     IContentManager contentManager) {
     _workflowManager = workflowManager;
     _genericEventService = genericEventService;
     _contentManager = contentManager;
 }
Пример #3
0
        public WorkflowProductHandler(IWorkflowManager workflowManager) {
            OnPublished<ContentPart>(
                (ctx, part) => {
                    var settings = ctx.ContentItem.TypeDefinition.Settings;
                    var isProduct = settings.ContainsKey("Stereotype") && settings["Stereotype"] == Constants.ProductName;
                    if (!isProduct)
                        return;

                    workflowManager.TriggerEvent("ProductPublished",
                        ctx.ContentItem,
                        () => new Dictionary<string, object>{{"Content", ctx.ContentItem}});
                });
        }
Пример #4
0
 public WinXinController(IWorkflowManager workflowManager
     , IOrchardServices orchardServices
     , IWinXinService winXinService
     , IContentManager contentManager
     , ISiteService siteService
     , IMembershipService membershipService
     , IShapeFactory shapeFactory
     , IWeiXinResp weiXinResp
     )
 {
     _workflowManager = workflowManager;
     _membershipService = membershipService;
     _contentManager = contentManager;
     _orchardServices = orchardServices;
     _siteService = siteService;
     _winXinService = winXinService;
     Shape = shapeFactory;
     _weiXinResp = weiXinResp;
 }
Пример #5
0
        public WorkflowContentHandler(IWorkflowManager workflowManager) {

            OnPublished<ContentPart>(
                (context, part) =>
                    workflowManager.TriggerEvent("ContentPublished",
                    context.ContentItem,
                    () => new Dictionary<string, object> { { "Content", context.ContentItem } }));

            OnRemoving<ContentPart>(
                (context, part) =>
                    workflowManager.TriggerEvent("ContentRemoved",
                    context.ContentItem,
                    () => new Dictionary<string, object> { { "Content", context.ContentItem } }));

            OnVersioned<ContentPart>(
                (context, part1, part2) =>
                    workflowManager.TriggerEvent("ContentVersioned",
                    context.BuildingContentItem,
                    () => new Dictionary<string, object> { { "Content", context.BuildingContentItem } }));

            OnUpdated<ContentPart>(
                (context, part) => {
                    workflowManager.TriggerEvent("ContentUpdated",
                        context.ContentItem,
                        () => new Dictionary<string, object> { { "Content", context.ContentItem } });

                    // Trigger the ContentCreated event only when its values have been updated
                    if(_contentCreated.Contains(context.ContentItem.Id)) {
                        workflowManager.TriggerEvent("ContentCreated",
                            context.ContentItem,
                            () => new Dictionary<string, object> {{"Content", context.ContentItem}});
                    }
                });

            OnCreated<ContentPart>(
                // Flag the content item as "just created" but actually trigger the event
                // when its content has been updated as it is what users would expect.
                (context, part) => _contentCreated.Add(context.ContentItem.Id)
            );

        }
        public static void OpenPlayerConfigurationDialog()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePush(Consts.WF_STATE_ID_PLAYER_CONFIGURATION_DIALOG);
        }
        protected static void LeaveAudioMenuWorkflow()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePopToStateAsync(Consts.WF_STATE_ID_PLAYER_AUDIO_MENU_DIALOG, true);
        }
Пример #8
0
        protected NavigationData GetCurrentNavigationData()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            return(MediaNavigationModel.GetNavigationData(workflowManager.CurrentNavigationContext, false));
        }
Пример #9
0
        public void Execute()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePush(Consts.WF_STATE_ID_PLAYLISTS_REMOVE);
        }
Пример #10
0
        public static MediaNavigationModel GetCurrentInstance()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            return((MediaNavigationModel)workflowManager.GetModel(MEDIA_MODEL_ID));
        }
Пример #11
0
        protected void Update()
        {
            ISystemStateService sss = ServiceRegistration.Get <ISystemStateService>();

            if (sss.CurrentState != SystemState.Running)
            {
                return;
            }
            INotificationService notificationService = ServiceRegistration.Get <INotificationService>();
            int numNotifications             = notificationService.Notifications.Count;
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            if (numNotifications == 0 && workflowManager.CurrentNavigationContext.WorkflowState.StateId == Consts.WF_STATE_ID_WATCH_NOTIFICATIONS)
            {
                // Don't pop the watch-notifications state from the navigation stack if we are in a sub state
                workflowManager.NavigatePopToStateAsync(Consts.WF_STATE_ID_WATCH_NOTIFICATIONS, true);
            }
            IsNotificationsHintVisible         = !workflowManager.IsStateContainedInNavigationStack(Consts.WF_STATE_ID_WATCH_NOTIFICATIONS) && numNotifications > 0;
            NumNotificationsTotal              = numNotifications;
            IsNotificationsAvailable           = numNotifications > 0;
            IsMoreThanOneNotificationAvailable = numNotifications > 1;
            if (numNotifications <= 1)
            {
                NMoreNotificationsText = string.Empty;
            }
            else if (numNotifications == 2)
            {
                NMoreNotificationsText = LocalizationHelper.Translate(Consts.RES_ONE_MORE_NOTIFICATION);
            }
            else
            {
                NMoreNotificationsText = LocalizationHelper.Translate(Consts.RES_N_MORE_NOTIFICATIONS, numNotifications - 1);
            }
            INotification notification = notificationService.PeekNotification();

            CurrentNotification = notification;
            if (notification != null)
            {
                if (string.IsNullOrEmpty(notification.CustomIconPath))
                {
                    switch (notification.Type)
                    {
                    case NotificationType.UserInteractionRequired:
                        NotificationSymbolRelFilePath = Consts.REL_PATH_USER_INTERACTION_REQUIRED_ICON;
                        break;

                    case NotificationType.Info:
                        NotificationSymbolRelFilePath = Consts.REL_PATH_INFO_ICON;
                        break;

                    case NotificationType.Warning:
                        NotificationSymbolRelFilePath = Consts.REL_PATH_WARNING_ICON;
                        break;

                    case NotificationType.Error:
                        NotificationSymbolRelFilePath = Consts.REL_PATH_ERROR_ICON;
                        break;
                    }
                }
                else
                {
                    NotificationSymbolRelFilePath = notification.CustomIconPath;
                }
                HasSubWorkflow = notification.HandlerWorkflowState.HasValue;
            }
        }
Пример #12
0
 public TriggerActivity(IWorkflowManager workflowManager) {
     _workflowManager = workflowManager;
     T = NullLocalizer.Instance;
 }
Пример #13
0
        public void ShowScreenInTransientState(string screen)
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePushTransient(new WorkflowState(Guid.NewGuid(), screen, screen, true, screen, false, true, ModelId, WorkflowType.Workflow), null);
        }
Пример #14
0
 public FidelityBaseServices(IOrchardServices orchardServices, IEncryptionService encryptionService,
                             IAuthenticationService authenticationService, IMembershipService membershipService,
                             ISendService sendService, IRepository <ActionInCampaignRecord> repository, IWorkflowManager workfloManager)
 {
     _orchardServices       = orchardServices;
     _encryptionService     = encryptionService;
     _authenticationService = authenticationService;
     _membershipService     = membershipService;
     _sendService           = sendService;
     _actionInCampaign      = repository;
     settingsPart           = _orchardServices.WorkContext.CurrentSite.As <FidelitySettingsPart>();
     _workflowManager       = workfloManager;
 }
Пример #15
0
 protected override void Initialize(WorkflowExecutionContext context)
 {
     base.Initialize(context);
     var app = CoreApplication.Instance;
     _workflowManager = app.GetSubsystemOrThrow<IWorkflowManager>();
     _scannerManager = app.GetSubsystemOrThrow<IScannerManager>();
     _electionManager = app.GetSubsystemOrThrow<IElectionManager>();
     _votingResultManager = app.GetSubsystemOrThrow<IVotingResultManager>();
     _syncManager = app.GetSubsystemOrThrow<ISynchronizationManager>();
     _soundManager = app.GetSubsystemOrThrow<ISoundManager>();
     _keyboard = app.GetSubsystemOrThrow<UnionKeyboard>();
     _configManager = app.GetSubsystemOrThrow<IConfigurationManager>();
     _fileSystemManager = app.GetSubsystemOrThrow<IFileSystemManager>();
     _printingManager = app.GetSubsystemOrThrow<IPrintingManager>();
     _recognitionManager = app.GetSubsystemOrThrow<IRecognitionManager>();
     _logger = _workflowManager.Logger;
 }
Пример #16
0
 public TriggerActivity(IWorkflowManager workflowManager)
 {
     _workflowManager = workflowManager;
     T = NullLocalizer.Instance;
 }
Пример #17
0
 public void Initialize()
 {
     WorkflowManager = new WorkflowManagerMock().SetupWorkflowManagerMock();
 }
 public UserEventHandler(IWorkflowManager workflowManager, IHttpContextAccessor httpContextAccessor)
 {
     _workflowManager     = workflowManager;
     _httpContextAccessor = httpContextAccessor;
 }
Пример #19
0
        protected static void WorkflowPopToState(Guid workflowStateId)
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePopToState(workflowStateId, false);
        }
		public WorkflowCustomUserEventHandler(IWorkflowManager workflowManager)
		{
			this.workflowManager = workflowManager;
		}
Пример #21
0
        public static VideoBackgroundModel GetCurrentInstance()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            return((VideoBackgroundModel)workflowManager.GetModel(MODEL_ID));
        }
        protected void ShowProgramActions(IProgram program)
        {
            if (program == null)
            {
                return;
            }

            ILocalization loc = ServiceRegistration.Get <ILocalization>();

            _programActions = new ItemsList();
            // if program is over already, there is nothing to do.
            if (program.EndTime < DateTime.Now)
            {
                _programActions.Add(new ListItem(Consts.KEY_NAME, loc.ToString("[SlimTvClient.ProgramOver]")));
            }
            else
            {
                // Check if program is currently running.
                bool isRunning = DateTime.Now >= program.StartTime && DateTime.Now <= program.EndTime;
                if (isRunning)
                {
                    _programActions.Add(new ListItem(Consts.KEY_NAME, loc.ToString("[SlimTvClient.WatchNow]"))
                    {
                        Command = new MethodDelegateCommand(() =>
                        {
                            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);
                                }
                            }
                        })
                    });
                }

                if (_tvHandler.ScheduleControl != null)
                {
                    RecordingStatus recordingStatus;
                    if (_tvHandler.ScheduleControl.GetRecordingStatus(program, out recordingStatus) && recordingStatus != RecordingStatus.None)
                    {
                        if (isRunning)
                        {
                            _programActions.Add(
                                new ListItem(Consts.KEY_NAME, loc.ToString("[SlimTvClient.WatchFromBeginning]"))
                            {
                                Command = new MethodDelegateCommand(() => _tvHandler.WatchRecordingFromBeginning(program))
                            });
                        }

                        _programActions.Add(
                            new ListItem(Consts.KEY_NAME, loc.ToString("[SlimTvClient.DeleteSchedule]"))
                        {
                            Command = new MethodDelegateCommand(() =>
                            {
                                if (_tvHandler.ScheduleControl.RemoveScheduleForProgram(program, ScheduleRecordingType.Once))
                                {
                                    UpdateRecordingStatus(program, RecordingStatus.None);
                                }
                            }
                                                                )
                        });
                    }
                    else
                    {
                        _programActions.Add(
                            new ListItem(Consts.KEY_NAME, loc.ToString(isRunning ? "[SlimTvClient.RecordNow]" : "[SlimTvClient.CreateSchedule]"))
                        {
                            Command = new MethodDelegateCommand(() =>
                            {
                                ISchedule schedule;
                                if (_tvHandler.ScheduleControl.CreateSchedule(program, ScheduleRecordingType.Once, out schedule))
                                {
                                    UpdateRecordingStatus(program, RecordingStatus.Scheduled);
                                }
                            }
                                                                )
                        });
                    }
                }
            }

            // Add list entries for extensions
            foreach (KeyValuePair <Guid, TvExtension> programExtension in _programExtensions)
            {
                TvExtension extension = programExtension.Value;
                // First check if this extension applies for the selected program
                if (!extension.Extension.IsAvailable(program))
                {
                    continue;
                }

                _programActions.Add(
                    new ListItem(Consts.KEY_NAME, loc.ToString(extension.Caption))
                {
                    Command = new MethodDelegateCommand(() => extension.Extension.ProgramAction(program))
                });
            }

            IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>();

            screenManager.ShowDialog(_programActionsDialogName);
        }
 public ButtonToWorflowsScheduledTaskHandler(IWorkflowManager workflowManager)
 {
     Logger           = NullLogger.Instance;
     _workflowManager = workflowManager;
 }
Пример #24
0
 public static Task TriggerEventAsync(this IWorkflowManager workflowManager, string name, object input = null, string correlationId = null)
 {
     return(workflowManager.TriggerEventAsync(name, new RouteValueDictionary(input), correlationId));
 }
 public static Task TriggerEventAsync(this IWorkflowManager workflowManager, string typeName,
                                      object input         = null,
                                      string correlationId = null)
 {
     return(workflowManager.TriggerEventAsync(typeName, input?.AsDictionary(), correlationId));
 }
        /// <summary>
        /// Checks if our "currently playing" and "fullscreen content" states still fit to the
        /// appropriate players, i.e. if we are in a "currently playing" state and the current player context was
        /// changed, the workflow state will be adapted to match the new current player context's "currently playing" state.
        /// The same check will happen for the primary player context and the "fullscreen content" state.
        /// </summary>
        /// <remarks>
        /// This method must not be called when the player manager's lock is held.
        /// </remarks>
        protected void CheckMediaWorkflowStates_NoLock()
        {
            ISystemStateService sss = ServiceRegistration.Get <ISystemStateService>();

            if (sss.CurrentState != SystemState.Running)
            {
                // Only automatically change workflow states in running state
                return;
            }
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.StartBatchUpdateAsync();
            ILogger        log           = ServiceRegistration.Get <ILogger>();
            IPlayerManager playerManager = ServiceRegistration.Get <IPlayerManager>();

            try
            {
                for (int i = 0; i < _playerWfStateInstances.Count; i++)
                {
                    // Find the first workflow state of our cached player workflow states which doesn't fit any more
                    // and update to the new player workflow state of the same player workflow state type, if necessary.
                    PlayerWFStateInstance wfStateInstance = _playerWfStateInstances[i];
                    Guid?  newStateId;
                    string stateName;
                    switch (wfStateInstance.WFStateType)
                    {
                    case PlayerWFStateType.CurrentlyPlaying:
                        newStateId = GetPotentialCPStateId();
                        stateName  = "Currently Playing";
                        break;

                    case PlayerWFStateType.FullscreenContent:
                        newStateId = GetPotentialFSCStateId();
                        stateName  = "Fullscreen Content";
                        break;

                    default:
                        throw new NotImplementedException(string.Format("No handler for player workflow state type '{0}'",
                                                                        wfStateInstance.WFStateType));
                    }
                    if (newStateId != wfStateInstance.WFStateId)
                    {
                        // Found the first player workflow state which doesn't fit any more
                        log.Debug("PlayerContextManager: {0} Workflow State '{1}' doesn't fit any more to the current situation. Leaving workflow state.",
                                  stateName, wfStateInstance.WFStateId);
                        lock (playerManager.SyncObj)
                            // Remove all workflow states until the player workflow state which doesn't fit any more
                            _playerWfStateInstances.RemoveRange(i, _playerWfStateInstances.Count - i);
                        workflowManager.NavigatePopToStateAsync(wfStateInstance.WFStateId, true);
                        if (newStateId.HasValue)
                        {
                            log.Debug("PlayerContextManager: Auto-switching to new {0} Workflow State '{1}'",
                                      stateName, newStateId.Value);
                            workflowManager.NavigatePushAsync(newStateId.Value);
                        }
                        break;
                    }
                }
            }
            finally
            {
                workflowManager.EndBatchUpdateAsync();
            }
        }
Пример #27
0
        /// <summary>
        /// The main entry point for the MP2 client application.
        /// </summary>
        private static void Main(params string[] args)
        {
            Thread.CurrentThread.Name = "Main";

            // Parse command line options
            var mpOptions = new CommandLineOptions();
            var parser    = new CommandLine.Parser(with => with.HelpWriter = Console.Out);

            parser.ParseArgumentsStrict(args, mpOptions, () => Environment.Exit(1));

            // Check if another instance is already running
            if (SingleInstanceHelper.IsAlreadyRunning(MUTEX_ID, out _mutex))
            {
                _mutex = null;
                // Set focus on previously running app
                SingleInstanceHelper.SwitchToCurrentInstance(SingleInstanceHelper.SHOW_MP2_CLIENT_MESSAGE);
                // Stop current instance
                Console.Out.WriteLine("Application already running.");
                Environment.Exit(2);
            }

#if !DEBUG
            string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"Team MediaPortal\MP2-Client\Log");
#endif

            Application.ThreadException += LauncherExceptionHandling.Application_ThreadException;
            AppDomain.CurrentDomain.UnhandledException += LauncherExceptionHandling.CurrentDomain_UnhandledException;

            SystemStateService systemStateService = new SystemStateService();
            ServiceRegistration.Set <ISystemStateService>(systemStateService);
            systemStateService.SwitchSystemState(SystemState.Initializing, false);

            try
            {
#if !DEBUG
                SplashScreen splashScreen = null;
#endif
                ILogger logger = null;
                try
                {
                    // Check if user wants to override the default Application Data location.
                    ApplicationCore.RegisterVitalCoreServices(mpOptions.DataDirectory);

#if !DEBUG
                    splashScreen = CreateSplashScreen(ServiceRegistration.Get <ISettingsManager>().Load <UI.Settings.StartupSettings>().StartupScreenNum);
                    splashScreen.ShowSplashScreen();
#endif

                    ApplicationCore.RegisterCoreServices();

                    logger = ServiceRegistration.Get <ILogger>();

#if !DEBUG
                    IPathManager pathManager = ServiceRegistration.Get <IPathManager>();
                    logPath = pathManager.GetPath("<LOG>");
#endif

                    UiExtension.RegisterUiServices();
                }
                catch (Exception e)
                {
                    if (logger != null)
                    {
                        logger.Critical("Error starting application", e);
                    }
                    systemStateService.SwitchSystemState(SystemState.ShuttingDown, true);
                    ServiceRegistration.IsShuttingDown = true;

                    UiExtension.DisposeUiServices();
                    ApplicationCore.DisposeCoreServices();

                    throw;
                }

                // Start the core
                logger.Debug("ApplicationLauncher: Starting application");

                try
                {
                    IPluginManager pluginManager = ServiceRegistration.Get <IPluginManager>();
                    pluginManager.Initialize();
                    pluginManager.Startup(false);
                    ApplicationCore.StartCoreServices();

                    ISkinEngine            skinEngine            = ServiceRegistration.Get <ISkinEngine>();
                    IWorkflowManager       workflowManager       = ServiceRegistration.Get <IWorkflowManager>();
                    IMediaAccessor         mediaAccessor         = ServiceRegistration.Get <IMediaAccessor>();
                    ILocalSharesManagement localSharesManagement = ServiceRegistration.Get <ILocalSharesManagement>();

                    // We have to handle some dependencies here in the start order:
                    // 1) After all plugins are loaded, the SkinEngine can initialize (=load all skin resources)
                    // 2) After the skin resources are loaded, the workflow manager can initialize (=load its states and actions)
                    // 3) Before the main window is shown, the splash screen should be hidden
                    // 4) After the workflow states and actions are loaded, the main window can be shown
                    // 5) After the skinengine triggers the first workflow state/startup screen, the default shortcuts can be registered
                    mediaAccessor.Initialize();         // Independent from other services
                    localSharesManagement.Initialize(); // After media accessor was initialized
                    skinEngine.Initialize();            // 1)
                    workflowManager.Initialize();       // 2)

#if !DEBUG
                    splashScreen.CloseSplashScreen(); // 3)
#endif

                    skinEngine.Startup();                                  // 4)
                    UiExtension.Startup();                                 // 5)

                    ApplicationCore.RegisterDefaultMediaItemAspectTypes(); // To be done after UI services are running

                    systemStateService.SwitchSystemState(SystemState.Running, true);

                    Application.Run();

                    systemStateService.SwitchSystemState(SystemState.ShuttingDown, true);
                    ServiceRegistration.IsShuttingDown = true; // Block ServiceRegistration from trying to load new services in shutdown phase

                    // 1) Stop UI extensions (Releases all active players, must be done before shutting down SE)
                    // 2) Shutdown SkinEngine (Closes all screens, uninstalls background manager, stops render thread)
                    // 3) Shutdown WorkflowManager (Disposes all models)
                    // 4) Shutdown ImporterWorker
                    // 5) Shutdown PluginManager (Shuts down all plugins)
                    // 6) Remove all services
                    UiExtension.StopUiServices();
                    skinEngine.Shutdown();
                    workflowManager.Shutdown();
                    ServiceRegistration.Get <IImporterWorker>().Shutdown();
                    pluginManager.Shutdown();
                    mediaAccessor.Shutdown();
                    localSharesManagement.Shutdown();
                    ApplicationCore.StopCoreServices();
                }
                catch (Exception e)
                {
                    logger.Critical("Error executing application", e);
                    systemStateService.SwitchSystemState(SystemState.ShuttingDown, true);
                    ServiceRegistration.IsShuttingDown = true;
                }
                finally
                {
                    UiExtension.DisposeUiServices();
                    ApplicationCore.DisposeCoreServices();

                    systemStateService.SwitchSystemState(SystemState.Ending, false);
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                ConsoleLogger log = new ConsoleLogger(LogLevel.All, false);
                log.Error(ex);
#else
                UiCrashLogger crash = new UiCrashLogger(logPath);
                crash.CreateLog(ex);
#endif
                systemStateService.SwitchSystemState(SystemState.Ending, false);

                // Release mutex for single instance
                if (_mutex != null)
                {
                    _mutex.ReleaseMutex();
                }

                Application.Exit();
            }
        }
 public WorkflowUserEventHandler(IWorkflowManager workflowManager) {
     _workflowManager = workflowManager;
 }
Пример #29
0
 public WorkflowActtributesValidation(
     IWorkflowManager workflowManager)
 {
     _workflowManager = workflowManager;
 }
        /// <summary>
        /// Updates the menu items for the dialogs "DialogPlayerConfiguration" and "DialogChooseAudioStream"
        /// and closes the dialogs when their entries are not valid any more.
        /// </summary>
        protected void CheckUpdatePlayerConfigurationData()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            lock (_syncObj)
            {
                if (_inPlayerConfigurationDialog)
                {
                    UpdatePlayerConfigurationMenu();
                    if (_playerConfigurationMenu.Count == 0)
                    {
                        // Automatically close player configuration dialog if no menu items are available any more
                        workflowManager.NavigatePopToStateAsync(Consts.WF_STATE_ID_PLAYER_CONFIGURATION_DIALOG, true);
                    }
                }
                if (_inChooseAudioStreamDialog)
                {
                    UpdateAudioStreamsMenu();
                    if (_audioStreamsMenu.Count <= 1)
                    {
                        // Automatically close audio stream choice dialog if less than two audio streams are available
                        workflowManager.NavigatePopToStateAsync(Consts.WF_STATE_ID_CHOOSE_AUDIO_STREAM_DIALOG, true);
                    }
                }
                if (_inPlayerSlotAudioMenuDialog)
                {
                    UpdatePlayerSlotAudioMenu();
                    if (_playerSlotAudioMenu.Count <= 1)
                    {
                        // Automatically close audio stream choice dialog if less than two audio streams are available
                        workflowManager.NavigatePopToStateAsync(Consts.WF_STATE_ID_PLAYER_AUDIO_MENU_DIALOG, true);
                    }
                }
                if (_inPlayerChooseGeometryMenuDialog)
                {
                    // Automatically close geometry choice dialog if current player is no video player
                    if (_playerGeometryMenuPlayerContext == null || !_playerGeometryMenuPlayerContext.IsActive ||
                        !(_playerGeometryMenuPlayerContext.CurrentPlayer is IVideoPlayer))
                    {
                        // Automatically close geometry stream choice dialog
                        workflowManager.NavigatePopToStateAsync(Consts.WF_STATE_ID_PLAYER_CHOOSE_GEOMETRY_MENU_DIALOG, true);
                    }
                    else
                    {
                        UpdatePlayerChooseGeometryMenu();
                    }
                }
                if (_inPlayerChooseEffectMenuDialog)
                {
                    // Automatically close Effect choice dialog if current player is no video player
                    if (_playerEffectMenuPlayerContext == null || !_playerEffectMenuPlayerContext.IsActive ||
                        !(_playerEffectMenuPlayerContext.CurrentPlayer is IVideoPlayer))
                    {
                        // Automatically close effect stream choice dialog
                        while (_inPlayerChooseEffectMenuDialog)
                        {
                            workflowManager.NavigatePop(1);
                        }
                    }
                    else
                    {
                        UpdatePlayerChooseEffectMenu();
                    }
                }
            }
        }
        public DynamicButtonToWorkflowsPartHandler(INotifier notifier, IScheduledTaskManager scheduledTaskManager, IWorkflowManager workflowManager)
        {
            _notifier             = notifier;
            _scheduledTaskManager = scheduledTaskManager;
            _workflowManager      = workflowManager;
            T = NullLocalizer.Instance;

            OnUpdated <DynamicButtonToWorkflowsPart>((context, part) => {
                try {
                    if (!string.IsNullOrWhiteSpace(part.ButtonName))
                    {
                        var content = context.ContentItem;

                        if (part.ActionAsync)
                        {
                            _scheduledTaskManager.CreateTask("Laser.Orchard.DynamicButtonToWorkflows.Task", DateTime.UtcNow.AddMinutes(1), part.ContentItem);

                            if (!string.IsNullOrEmpty(part.MessageToWrite))
                            {
                                _notifier.Add(NotifyType.Information, T(part.MessageToWrite));
                            }
                        }
                        else
                        {
                            _workflowManager.TriggerEvent("DynamicButtonEvent", content, () => new Dictionary <string, object> {
                                { "ButtonName", part.ButtonName }, { "Content", content }
                            });

                            if (!string.IsNullOrEmpty(part.MessageToWrite))
                            {
                                _notifier.Add(NotifyType.Information, T(part.MessageToWrite));
                            }

                            part.ButtonName     = "";
                            part.MessageToWrite = "";
                            part.ActionAsync    = false;
                        }
                    }
                }
                catch (Exception ex) {
                    Logger.Error(ex, "Error in DynamicButtonToWorkflowsPartHandler. ContentItem: {0}", context.ContentItem);

                    part.ButtonName     = "";
                    part.MessageToWrite = "";
                    part.ActionAsync    = false;
                }
            });
        }
        protected static void LeaveChooseEffectWorkflow()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePopToStateAsync(Consts.WF_STATE_ID_PLAYER_CHOOSE_EFFECT_MENU_DIALOG, true);
        }
Пример #33
0
        protected void LeavePartyMode()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePopToStateAsync(Consts.WF_STATE_ID_PARTY_MUSIC_PLAYER, true);
        }
        public void OpenChooseAudioStreamDialog()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePush(Consts.WF_STATE_ID_CHOOSE_AUDIO_STREAM_DIALOG);
        }
Пример #35
0
        public static void OpenChooseEffectDialog()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePush(WF_STATE_ID_CHOOSE_EFFECT_MENU_DIALOG, new NavigationContextConfig());
        }
 public FormSubmissionCoordinator(INotifier notifier, IWorkflowManager workflowManager, ITokenizer tokenizer) {
     _notifier = notifier;
     _workflowManager = workflowManager;
     _tokenizer = tokenizer;
 }
Пример #37
0
 public WorkflowController(IWorkflowManager manager)
 {
     WorkflowManager = manager ?? new WorkflowManager();
 }
 public WorkflowValidatorCoordinator(IWorkflowManager workflowManager) {
     _workflowManager = workflowManager;
 }
 public NotificationsAdminController(IContentManager contentManager, IWorkflowManager workflowManager) {
     _contentManager = contentManager;
     _workflowManager = workflowManager;
 }
Пример #40
0
        public static void ShowPlaylistsOverview()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePush(Consts.WF_STATE_ID_PLAYLISTS_OVERVIEW);
        }
Пример #41
0
 public WorkflowController()
 {
     _workflowManager = WorkflowManager.Instance;
     _workflowEngine  = WorkflowEngine.Instance;
     _userController  = UserController.Instance;
 }
 public NotificationsScheduledTaskHandler(IWorkflowManager workflowManager) {
     _workflowManager = workflowManager;
 }
 public WorkflowUserEventHandler(IWorkflowManager workflowManager)
 {
     _workflowManager = workflowManager;
 }
Пример #44
0
 public TimerBackgroundTask(
     IContentManager contentManager,
     IWorkflowManager workflowManager,
     IRepository<AwaitingActivityRecord> awaitingActivityRepository) {
     _contentManager = contentManager;
     _workflowManager = workflowManager;
     _awaitingActivityRepository = awaitingActivityRepository;
 }
Пример #45
0
        public void GoToNotification()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePush(Consts.WF_STATE_ID_WATCH_NOTIFICATIONS);
        }