/// <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); }