Example #1
0
        public static LayoutConfiguration CreateCustom(string name)
        {
            LayoutConfiguration l = new LayoutConfiguration();

            l.name     = name;
            l.fileName = Path.GetRandomFileName() + ".xml";
            File.Copy(Path.Combine(DataLayoutPath, "Default.xml"),
                      Path.Combine(ConfigLayoutPath, l.fileName));
            l.custom = true;
            Layouts.Add(l);
            return(l);
        }
        public static LayoutConfiguration CreateCustom(string name)
        {
            LayoutConfiguration l = new LayoutConfiguration();

            l.name     = name;
            l.fileName = Path.GetRandomFileName() + ".xml";
            File.Copy(Path.Combine(Path.Combine(PropertyService.DataDirectory, DataLayoutSubPath), "Default.xml"),
                      Path.Combine(Path.Combine(PropertyService.ConfigDirectory, "layouts"), l.fileName));
            l.custom = true;
            Layouts.Add(l);
            return(l);
        }
Example #3
0
        public static void InitializeWorkbench(IWorkbench workbench, IWorkbenchLayout layout)
        {
            WorkbenchSingleton.workbench = workbench;

            LanguageService.ValidateLanguage();

            DisplayBindingService.InitializeService();
            LayoutConfiguration.LoadLayoutConfiguration();
            FileService.InitializeService();
            DomHostCallback.Register();             // must be called after StatusBarService.Initialize()
            ParserService.InitializeParserService();
            TaskService.Initialize();
            Bookmarks.BookmarkManager.Initialize();
            Project.CustomToolsService.Initialize();
            Project.BuildModifiedProjectsOnlyService.Initialize();

            var messageService = Core.Services.ServiceManager.Instance.MessageService as IDialogMessageService;

            if (messageService != null)
            {
                messageService.DialogOwner = workbench.MainWin32Window;
                Debug.Assert(messageService.DialogOwner != null);
                messageService.DialogSynchronizeInvoke = workbench.SynchronizingObject;
            }

            workbench.Initialize();
            workbench.SetMemento(PropertyService.Get(workbenchMemento, new Properties()));
            workbench.WorkbenchLayout = layout;

            ApplicationStateInfoService.RegisterStateGetter(activeContentState, delegate { return(WorkbenchSingleton.Workbench.ActiveContent); });

            OnWorkbenchCreated();

            // initialize workbench-dependent services:
            Project.ProjectService.InitializeService();
            NavigationService.InitializeService();

            workbench.ActiveContentChanged += delegate {
                Debug.WriteLine("ActiveContentChanged to " + workbench.ActiveContent);
                LoggingService.Debug("ActiveContentChanged to " + workbench.ActiveContent);
            };
            workbench.ActiveViewContentChanged += delegate {
                Debug.WriteLine("ActiveViewContentChanged to " + workbench.ActiveViewContent);
                LoggingService.Debug("ActiveViewContentChanged to " + workbench.ActiveViewContent);
            };
            workbench.ActiveWorkbenchWindowChanged += delegate {
                Debug.WriteLine("ActiveWorkbenchWindowChanged to " + workbench.ActiveWorkbenchWindow);
                LoggingService.Debug("ActiveWorkbenchWindowChanged to " + workbench.ActiveWorkbenchWindow);
            };
        }
        public static void InitializeWorkbench(IWorkbench workbench, IWorkbenchLayout layout)
        {
            WorkbenchSingleton.workbench = workbench;

            DisplayBindingService.InitializeService();
            LayoutConfiguration.LoadLayoutConfiguration();
            FileService.InitializeService();
            StatusBarService.Initialize();
            DomHostCallback.Register();             // must be called after StatusBarService.Initialize()
            ParserService.InitializeParserService();
            Bookmarks.BookmarkManager.Initialize();
            Project.CustomToolsService.Initialize();
            Project.BuildModifiedProjectsOnlyService.Initialize();

            workbench.Initialize();
            workbench.SetMemento(PropertyService.Get(workbenchMemento, new Properties()));

            caller = new STAThreadCaller(workbench.MainForm);
            WinFormsMessageService.DialogOwner             = workbench.MainForm;
            WinFormsMessageService.DialogSynchronizeInvoke = workbench.MainForm;

            PropertyService.PropertyChanged += new PropertyChangedEventHandler(TrackPropertyChanges);
            ResourceService.LanguageChanged += delegate { workbench.RedrawAllComponents(); };

            ApplicationStateInfoService.RegisterStateGetter(activeContentState, delegate { return(WorkbenchSingleton.Workbench.ActiveContent); });

            // attach workbench layout -> load pads
            workbench.WorkbenchLayout = layout;

            OnWorkbenchCreated();

            // initialize workbench-dependent services:
            Project.ProjectService.InitializeService();
            NavigationService.InitializeService();

            workbench.ActiveContentChanged += delegate {
                LoggingService.Debug("ActiveContentChanged to " + workbench.ActiveContent);
            };
            workbench.ActiveViewContentChanged += delegate {
                LoggingService.Debug("ActiveViewContentChanged to " + workbench.ActiveViewContent);
            };
            workbench.ActiveWorkbenchWindowChanged += delegate {
                LoggingService.Debug("ActiveWorkbenchWindowChanged to " + workbench.ActiveWorkbenchWindow);
            };
        }
 public void StoreConfiguration()
 {
     try {
         if (dockPanel != null)
         {
             LayoutConfiguration current = LayoutConfiguration.CurrentLayout;
             if (current != null && !current.ReadOnly)
             {
                 string configPath = Path.Combine(PropertyService.ConfigDirectory, "layouts");
                 if (!Directory.Exists(configPath))
                 {
                     Directory.CreateDirectory(configPath);
                 }
                 dockPanel.SaveAsXml(Path.Combine(configPath, current.FileName), System.Text.Encoding.UTF8);
             }
         }
     } catch (Exception e) {
         MessageService.ShowError(e);
     }
 }
Example #6
0
 public void StoreConfiguration()
 {
     try {
         LayoutConfiguration current = LayoutConfiguration.CurrentLayout;
         if (current != null && !current.ReadOnly)
         {
             string configPath = LayoutConfiguration.ConfigLayoutPath;
             Directory.CreateDirectory(configPath);
             string fileName = Path.Combine(configPath, current.FileName);
             LoggingService.Info("Saving layout file: " + fileName);
             try {
                 dockingManager.SaveLayout(fileName);
             } catch (IOException ex) {
                 // ignore IO errors (maybe switching layout in two SharpDevelop instances at once?)
                 LoggingService.Warn(ex);
             }
         }
     } catch (Exception e) {
         MessageService.ShowException(e);
     }
 }
		public static LayoutConfiguration CreateCustom(string name)
		{
			LayoutConfiguration l = new LayoutConfiguration();
			l.name = name;
			l.fileName = Path.GetRandomFileName() + ".xml";
			File.Copy(Path.Combine(Path.Combine(PropertyService.DataDirectory, DataLayoutSubPath), "Default.xml"),
			          Path.Combine(Path.Combine(PropertyService.ConfigDirectory, "layouts"), l.fileName));
			l.custom = true;
			Layouts.Add(l);
			return l;
		}
		public static LayoutConfiguration CreateCustom(string name)
		{
			LayoutConfiguration l = new LayoutConfiguration();
			l.name = name;
			l.fileName = Path.GetRandomFileName() + ".xml";
			File.Copy(Path.Combine(DataLayoutPath, "Default.xml"),
			          Path.Combine(ConfigLayoutPath, l.fileName));
			l.custom = true;
			Layouts.Add(l);
			return l;
		}