/// <summary> /// Remove the workspace object from the workspace manager. Used by the /// WM state machine. /// </summary> public static void RemoveWorkspace(Workspace kws) { try { WmKcd kcd = kws.Kcd; // Make sure the state is valid. Debug.Assert(KwsTree.ContainsKey(kws.InternalID)); if (kcd != null) { Debug.Assert(kcd.KwsTree.ContainsKey(kws.InternalID)); Debug.Assert(!kcd.KwsConnectTree.ContainsKey(kws.InternalID)); } // Unregister the workspace from the workspace manager. KwsTree.Remove(kws.InternalID); if (KwsRemoveTree.ContainsKey(kws.InternalID)) { KwsRemoveTree.Remove(kws.InternalID); } if (kcd != null) { kcd.CancelKwsKcdQuery(kws); kcd.KwsTree.Remove(kws.InternalID); RemoveKcdIfNoRef(kcd); } AdjustPublicKwsID(); // Delete the workspace data. kws.PrepareToRemove(); foreach (KwsApp app in kws.AppTree.Values) { app.PrepareToRemove(); } // The WM state has changed. Wm.OnStateChange(WmStateChange.Permanent); } catch (Exception ex) { KBase.HandleException(ex, true); } }
/// <summary> /// Remove the workspace object from the workspace manager. Used by the /// WM state machine. /// </summary> public static void RemoveWorkspace(Workspace kws) { try { WmKcd kcd = kws.Kcd; // Make sure the state is valid. Debug.Assert(KwsTree.ContainsKey(kws.InternalID)); if (kcd != null) { Debug.Assert(kcd.KwsTree.ContainsKey(kws.InternalID)); Debug.Assert(!kcd.KwsConnectTree.ContainsKey(kws.InternalID)); } // Unregister the workspace from the workspace manager. KwsTree.Remove(kws.InternalID); if (KwsRemoveTree.ContainsKey(kws.InternalID)) KwsRemoveTree.Remove(kws.InternalID); if (kcd != null) { kcd.CancelKwsKcdQuery(kws); kcd.KwsTree.Remove(kws.InternalID); RemoveKcdIfNoRef(kcd); } AdjustPublicKwsID(); // Delete the workspace data. kws.PrepareToRemove(); foreach (KwsApp app in kws.AppTree.Values) app.PrepareToRemove(); // The WM state has changed. Wm.OnStateChange(WmStateChange.Permanent); } catch (Exception ex) { KBase.HandleException(ex, true); } }