private static void Show(ManageLayoutsViewModel dataContext, IWindowLayoutSettings settings = null) { Validate.IsNotNull(dataContext, "DataContext"); var manageLayoutsDialog = new ManageLayoutsDialog(); if (settings != null) { var layoutsDialogWidth = settings.ManageLayoutsDialogWidth; if (layoutsDialogWidth != 0) { manageLayoutsDialog.Width = layoutsDialogWidth; } var layoutsDialogHeight = settings.ManageLayoutsDialogHeight; if (layoutsDialogHeight != 0) { manageLayoutsDialog.Height = layoutsDialogHeight; } } manageLayoutsDialog.DataContext = dataContext; dataContext.Layouts.CollectionChanged += manageLayoutsDialog.OnLayoutsCollectionChanged; try { manageLayoutsDialog.ShowModal(); } finally { dataContext.Layouts.CollectionChanged -= manageLayoutsDialog.OnLayoutsCollectionChanged; } if (settings == null) { return; } settings.ManageLayoutsDialogWidth = (int)manageLayoutsDialog.Width; settings.ManageLayoutsDialogHeight = (int)manageLayoutsDialog.Height; }
internal static IEnumerable <KeyValuePair <string, WindowLayout> > Show(IEnumerable <KeyValuePair <string, WindowLayout> > layoutKeyInfoCollection, IWindowLayoutSettings settings = null) { ManageLayoutsViewModel dataContext = new ManageLayoutsViewModel(layoutKeyInfoCollection, new DialogUserInput()); Show(dataContext, settings); return(dataContext.Layouts.Select(layout => new KeyValuePair <string, WindowLayout>(layout.Key, layout.Layout))); }