Beispiel #1
0
        /// <summary>Releases resources held by the object.</summary>
        public override void Dispose(bool disposing)
        {
            if (!kernel.IsDisposed)
            {
                IMainManagerManager mainManager = kernel.Get <IMainManagerManager>();
                mainManager.Stop();

                kernel.Dispose();
            }

            base.Dispose(disposing);
        }
Beispiel #2
0
        public void Activate()
        {
            IMainManagerManager mainManager = kernel.Get <IMainManagerManager>();

            IManager manager = kernel.Get <IServerManager>();

            mainManager.Register(manager);

            ServerConfiguration serverConfiguration = kernel.TryGet <ServerConfiguration>();
            ClientConfiguration clientConfiguration = kernel.TryGet <ClientConfiguration>();

            TaskManagerConfiguration taskManagerConfiguration = new TaskManagerConfiguration();

            if (serverConfiguration != null)
            {
                taskManagerConfiguration.MaxTaskPerQueue = serverConfiguration.MaxTaskPerQueue;
                taskManagerConfiguration.State           = TaskManagerState.ServerOnly;
            }

            if (clientConfiguration != null)
            {
                taskManagerConfiguration.MaxRerunAttempts    = clientConfiguration.MaxRerunAttempts;
                taskManagerConfiguration.TimeShiftAfterCrash = clientConfiguration.TimeShiftAfterCrash;
                taskManagerConfiguration.State = TaskManagerState.ClientOnly;
            }

            if (serverConfiguration != null && clientConfiguration != null)
            {
                taskManagerConfiguration.State = TaskManagerState.Both;
            }

            BindToItself(taskManagerConfiguration);

            manager = kernel.Get <ITaskManager>();
            mainManager.Register(manager);

            mainManager.Start();
        }