/// <summary> /// Strictly adds a layout</summary> /// <param name="windowLayoutService">Window layout service</param> /// <param name="newLayoutName">New layout name</param> /// <param name="dockState">Dock state</param> /// <remarks> /// Used to add default layouts. /// Requires the implementor of IWindowLayoutService to implement: /// void AddLayout(string newLayoutName, object dockState)</remarks> public static void AddLayout(this IWindowLayoutService windowLayoutService, string newLayoutName, object dockState) { MethodInfo method = windowLayoutService.GetType().GetMethod("AddLayout"); var args = new object[] { newLayoutName, dockState }; method.Invoke(windowLayoutService, args); }
/// <summary> /// Programatically add a new layout or update an existing layout. The current layout /// becomes this given layout.</summary> /// <param name="windowLayoutService">Window layout service</param> /// <param name="dockStateProvider">Dock state provider</param> /// <param name="layoutName">Layout name</param> /// <param name="dockState">Dock state</param> public static void SetOrAddLayout(this IWindowLayoutService windowLayoutService, IDockStateProvider dockStateProvider, string layoutName, object dockState) { // Update current window arrangement and everything dockStateProvider.DockState = dockState; // Save or update window arrangement as the layout name windowLayoutService.CurrentLayout = layoutName; }
/// <summary> /// Check if the layout name is the current layout</summary> /// <param name="windowLayoutService">Window layout service</param> /// <param name="layoutName">Layout name to check</param> /// <returns>True iff layout name to check is current</returns> public static bool IsCurrent(this IWindowLayoutService windowLayoutService, string layoutName) { if (windowLayoutService == null) { return(false); } if (string.IsNullOrEmpty(layoutName)) { return(false); } return(string.Compare(windowLayoutService.CurrentLayout, layoutName) == 0); }
public WindowLayoutServiceCommands(IWindowLayoutService windowLayoutService) : base(windowLayoutService) { }
/// <summary> /// Constructor</summary> /// <param name="windowLayoutService">Window layout service to use</param> protected WindowLayoutServiceCommandsBase(IWindowLayoutService windowLayoutService) { WindowLayoutService = windowLayoutService; WindowLayoutService.LayoutsChanging += WindowLayoutServiceLayoutsChanging; WindowLayoutService.LayoutsChanged += WindowLayoutServiceLayoutsChanged; }