/// <summary>
        /// Saves the layout to a <see cref="TextBox"/>.
        /// </summary>
        /// <param name="saveDefaultLayout">Whether to save the default layout.</param>
        private void SaveLayout(bool saveDefaultLayout)
        {
            layoutSerializationBehavior            = (saveToolWindowLayoutOnlyMenuItem.IsChecked ? DockSiteSerializationBehavior.ToolWindowsOnly : DockSiteSerializationBehavior.All);
            layoutSerializer.SerializationBehavior = layoutSerializationBehavior;

            if (saveDefaultLayout)
            {
                defaultLayoutXml = layoutSerializer.SaveToString(dockSite);
            }
            else
            {
                layoutXml             = layoutSerializer.SaveToString(dockSite);
                layoutXmlTextBox.Text = layoutXml;
            }
        }
Esempio n. 2
0
        public void SaveUserSettings(DashboardSettingsRepository settings)
        {
            if (!_settingsSaved)
            {
                if (_presenter.Settings == null)
                {
                    settings.ActivationLinks.Clear();

                    int count = 0;

                    foreach (DocumentWindow document in dashboardWorkspace.DocumentWindows)
                    {
                        document.Name = string.Format("Window{0}", count);
                        count++;

                        ISmartPartInfoProvider provider = document.Content as ISmartPartInfoProvider;

                        if (provider != null)
                        {
                            ISmartPartInfo info = provider.GetSmartPartInfo(typeof(ShellSmartPartInfo));

                            ShellSmartPartInfo shellSmartPartInfo = info as ShellSmartPartInfo;

                            if (shellSmartPartInfo != null && shellSmartPartInfo.Hyperlink != null)
                            {
                                settings.ActivationLinks.Add(shellSmartPartInfo.Hyperlink);
                            }
                        }
                    }

                    DockSiteLayoutSerializer serializer = new DockSiteLayoutSerializer();
                    serializer.SerializationBehavior = DockSiteSerializationBehavior.All;
                    settings.Layout = serializer.SaveToString(dashboardWorkspace);
                }
                _settingsSaved = true;
            }
        }