Пример #1
0
 /// <summary>
 /// This method must be called by the application when it has started.
 /// </summary>
 public void OnAppStarted()
 {
     if (AppStatus != KwsAppStatus.Starting) return;
     AppStatus = KwsAppStatus.Started;
     Kws.OnKwsSmNotif += OnKwsSmNotif;
     Kws.Sm.OnAppStarted();
 }
Пример #2
0
 /// <summary>
 /// Initialization code common to both the deserialized and
 /// non-deserialized cases. This method must be called explicitly
 /// when the workspace is deserialized.
 /// </summary>
 public virtual void Initialize(IAppHelper appHelper)
 {
     Helper = appHelper;
     Helper.OnKwsStatusChanged += OnKwsStatusChangedInternal;
     AppStatus = KwsAppStatus.Stopped;
     DirtyFlag = false;
 }
Пример #3
0
 /// <summary>
 /// This method must be called by the application when it has started.
 /// </summary>
 public void OnAppStarted()
 {
     if (AppStatus != KwsAppStatus.Starting)
     {
         return;
     }
     AppStatus         = KwsAppStatus.Started;
     Kws.OnKwsSmNotif += OnKwsSmNotif;
     Kws.Sm.OnAppStarted();
 }
Пример #4
0
 /// <summary>
 /// This method must be called by the application when it has stopped.
 /// </summary>
 public void OnAppStopped()
 {
     if (AppStatus != KwsAppStatus.Stopping)
     {
         return;
     }
     AppStatus         = KwsAppStatus.Stopped;
     Kws.OnKwsSmNotif -= OnKwsSmNotif;
     Kws.Sm.OnAppStopped();
 }
Пример #5
0
 /// <summary>
 /// Initialization code common to both the deserialized and
 /// non-deserialized cases. This method must be called explicitly
 /// when the workspace is deserialized.
 /// </summary>
 public virtual void Initialize(IAppHelper appHelper)
 {
     Helper = appHelper;
     Helper.OnKwsStatusChanged += OnKwsStatusChangedInternal;
     AppStatus = KwsAppStatus.Stopped;
     DirtyFlag = false;
 }
Пример #6
0
        /// <summary>
        /// Stop the applications if they are starting / started.
        /// </summary>
        public void StopApp()
        {
            if (AppStatus == KwsAppStatus.Stopped || AppStatus == KwsAppStatus.Stopping) return;

            try
            {
                AppStatus = KwsAppStatus.Stopping;
                foreach (KwsApp app in AppTree.Values)
                {
                    if (app.AppStatus == KwsAppStatus.Started || app.AppStatus == KwsAppStatus.Starting)
                        app.AppStatus = KwsAppStatus.Stopping;
                    app.RequestStop();
                }
                Sm.OnAppStopped();
            }

            // We cannot handle applications that won't stop.
            catch (Exception ex)
            {
                Base.HandleException(ex, true);
            }
        }
Пример #7
0
        /// <summary>
        /// Start the applications if they are stopped.
        /// </summary>
        public void StartApp()
        {
            if (AppStatus != KwsAppStatus.Stopped) return;

            AppStatus = KwsAppStatus.Starting;

            // Applications have an implicit reference to the workspace when
            // they aren't stopped.
            AddRef();

            // Try to start the applications, until all applications are started
            // or a request to stop the applications is received.
            foreach (KwsApp app in AppTree.Values)
            {
                try
                {
                    if (AppStatus != KwsAppStatus.Starting) break;
                    Debug.Assert(app.AppStatus == KwsAppStatus.Stopped);
                    app.AppStatus = KwsAppStatus.Starting;
                    app.RequestStart();
                }

                catch (Exception ex)
                {
                    Sm.HandleAppFailure(app, ex);
                    return;
                }

                // Required if there are no applications.
                Sm.OnAppStarted();
            }
        }
Пример #8
0
 /// <summary>
 /// This method must be called by the application when it has stopped.
 /// </summary>
 public void OnAppStopped()
 {
     if (AppStatus != KwsAppStatus.Stopping) return;
     AppStatus = KwsAppStatus.Stopped;
     Kws.OnKwsSmNotif -= OnKwsSmNotif;
     Kws.Sm.OnAppStopped();
 }
Пример #9
0
 public KwsSmNotifApp(Workspace kws, KwsAppStatus status)
     : base(kws)
 {
     Status = status;
 }
Пример #10
0
 public KwsSmNotifApp(Workspace kws, KwsAppStatus status)
     : base(kws)
 {
     Status = status;
 }