/// <summary> /// Create a new instance of the ToolPanelExtensionManager. This class is /// private and will be called internally by the InitialSetup method. /// </summary> /// <param name="_parentToolPanel">The view model for the toolpanel being managed</param> /// <param name="_scope">The scope of the data that the tool panel items will have /// access too</param> private ToolPanelExtensionManager(ToolPanelViewModel _parentToolPanel, string _scope) { this.parentToolPanel = _parentToolPanel; this.scope = _scope; }
/// <summary> /// Provides a deterministic way to create the ToolPanelVMStatic property /// </summary> public static void CreateToolPanelVM() { if (toolPanelVM == null) { toolPanelVM = new ToolPanelViewModel(); } }
/// <summary> /// Performs the initial setup of the ToolPanelExtensionManager. This method /// must be called once before the Instance property can be used. /// </summary> /// <param name="_parentToolPanel">The view model for the toolpanel being managed</param> /// <param name="_scope">The scope of the data that the tool panel items will have /// access too</param> public static void InitialSetup(ToolPanelViewModel _parentToolPanel, string _scope) { // Validate parameters if (_parentToolPanel == null) throw new System.ArgumentNullException("_parentToolPanel","An invalid ToolPanelViewModel was provided"); if (string.IsNullOrEmpty(_scope)) throw new System.ArgumentNullException("_scope", "An invalid scope was provided"); lock (syncRoot) { // Ensure that this can only be called once if (instance == null) { instance = new ToolPanelExtensionManager(_parentToolPanel, _scope); ExtensionManager.ComposeParts(instance); } } }
/// <summary> /// Provides a deterministic way to delete the ToolPanelVMStatic property /// </summary> public static void ClearToolPanelVM() { toolPanelVM.Cleanup(); toolPanelVM = null; }