Exemple #1
0
        /// <summary>
        /// Validate our internal state invariants.
        /// </summary>
        private void CheckInvariants()
        {
            Debug.Assert(m_cd.UserTask == KwsTask.Stop ||
                         m_cd.UserTask == KwsTask.WorkOffline ||
                         m_cd.UserTask == KwsTask.WorkOnline);

            // Conditional xor check for the deletion tree.
            Debug.Assert((m_cd.CurrentTask != KwsTask.DeleteLocally) ^ (m_kws.InKwsRemoveTree()));

            // The applications shouldn't be running if we don't want them to run.
            Debug.Assert(WantAppRunning() ||
                         m_cd.AppStatus == KwsAppStatus.Stopping ||
                         m_cd.AppStatus == KwsAppStatus.Stopped);

            // We shouldn't be in the KCD connect tree if we don't want to be connected.
            Debug.Assert(WantKcdConnected() || !m_kws.InKcdConnectTree());

            // A logout request should have been sent if we don't want to be logged in.
            Debug.Assert(WantLogin() ||
                         m_ks.LoginStatus == KwsLoginStatus.LoggingOut ||
                         m_ks.LoginStatus == KwsLoginStatus.LoggedOut);

            // We should be logged out if we are not connected.
            Debug.Assert(m_kws.Kcd.ConnStatus == KcdConnStatus.Connected ||
                         m_ks.LoginStatus == KwsLoginStatus.LoggedOut);
        }
Exemple #2
0
        /// <summary>
        /// Handle a workspace that want to be disconnected.
        /// </summary>
        public static void HandleKwsToDisconnect(Workspace kws)
        {
            if (!kws.InKcdConnectTree())
            {
                return;
            }

            // Remove the workspace from the KCD connection tree.
            kws.RemoveFromKcdConnectTree();

            // Disconnect the KCD if no workspace want to be connected.
            if (kws.Kcd.KwsConnectTree.Count == 0)
            {
                DisconnectKcd(kws.Kcd, null);
            }
        }
Exemple #3
0
        /// <summary>
        /// Handle a workspace that want to be connected.
        /// </summary>
        public static void HandleKwsToConnect(Workspace kws)
        {
            if (kws.InKcdConnectTree())
            {
                return;
            }

            // Add the workspace to the KCD connect tree.
            kws.AddToKcdConnectTree();

            // Run our state machine if this is the first connection request.
            if (kws.Kcd.KwsConnectTree.Count == 1)
            {
                RequestRun("KCD connection request");
            }
        }
Exemple #4
0
        /// <summary>
        /// Handle a workspace that want to be disconnected.
        /// </summary>
        public static void HandleKwsToDisconnect(Workspace kws)
        {
            if (!kws.InKcdConnectTree()) return;

            // Remove the workspace from the KCD connection tree.
            kws.RemoveFromKcdConnectTree();

            // Disconnect the KCD if no workspace want to be connected.
            if (kws.Kcd.KwsConnectTree.Count == 0) DisconnectKcd(kws.Kcd, null);
        }
Exemple #5
0
        /// <summary>
        /// Handle a workspace that want to be connected.
        /// </summary>
        public static void HandleKwsToConnect(Workspace kws)
        {
            if (kws.InKcdConnectTree()) return;

            // Add the workspace to the KCD connect tree.
            kws.AddToKcdConnectTree();

            // Run our state machine if this is the first connection request.
            if (kws.Kcd.KwsConnectTree.Count == 1) RequestRun("KCD connection request");
        }