Ejemplo n.º 1
0
        public static void SaveUISettings(this SettingsStorage storage, DockSite dockSite, PairSet <Tuple <string, Type>, IContentWindow> contents)
        {
            storage.SetValue("Content", contents.Select(p =>
            {
                var ctrlStorage = new SettingsStorage();

                ctrlStorage.SetValue("Id", p.Key.Item1);
                ctrlStorage.SetValue("Type", p.Value.Control.GetType().GetTypeName(false));
                ctrlStorage.SetValue("IsToolWindow", p.Value is ContentToolWindow);
                ctrlStorage.SetValue("DockingWindowName", ((DockingWindow)p.Value).Name);
                ctrlStorage.SetValue("Settings", p.Value.Control.Save());
                ctrlStorage.SetValue("TagType", p.Value.Tag == null ? null : p.Value.Tag.GetType().GetTypeName(false));

                return(ctrlStorage);
            }).ToArray());

            storage.SetValue("Layout", dockSite.SaveLayout());

            var window = dockSite.ActiveWindow;

            if (window != null)
            {
                storage.SetValue("ActiveWindow", window.UniqueId.To <string>());
            }
        }