Esempio n. 1
0
        string getClipboardString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Gui.AboutSharpDevelopTabPage.GetVersionInformationString());

            sb.AppendLine();

            if (message != null)
            {
                sb.AppendLine(message);
            }
            sb.AppendLine("Exception thrown:");
            sb.AppendLine(exceptionThrown.ToString());
            sb.AppendLine();
            sb.AppendLine("---- Recent log messages:");
            try {
                LogMessageRecorder.AppendRecentLogMessages(sb, log4net.LogManager.GetLogger(typeof(log4netLoggingService)));
            } catch (Exception ex) {
                sb.AppendLine("Failed to append recent log messages.");
                sb.AppendLine(ex.ToString());
            }
            sb.AppendLine();
            sb.AppendLine("---- Post-error application state information:");
            try {
                ApplicationStateInfoService.AppendFormatted(sb);
            } catch (Exception ex) {
                sb.AppendLine("Failed to append application state information.");
                sb.AppendLine(ex.ToString());
            }
            return(sb.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Runs workbench cleanup.
        /// Is called by ICSharpCode.SharpDevelop.Sda and should not be called manually!
        /// </summary>
        public static void OnWorkbenchUnloaded()
        {
            Project.ProjectService.CloseSolution();
            NavigationService.Unload();

            ApplicationStateInfoService.UnregisterStateGetter(activeContentState);

            WorkbenchUnloaded(null, EventArgs.Empty);

            FileService.Unload();
        }
 public static void InitializeService()
 {
     if (!initialized)
     {
         initialized = true;
         WorkbenchSingleton.Workbench.ActiveViewContentChanged += ActiveViewContentChanged;
         FileService.FileRenamed += FileServiceFileRenamed;
         FileService.FileRemoved += FileServiceFileRemoved;
         ApplicationStateInfoService.RegisterStateGetter("ProjectService.OpenSolution", delegate { return(OpenSolution); });
         ApplicationStateInfoService.RegisterStateGetter("ProjectService.CurrentProject", delegate { return(CurrentProject); });
     }
 }
Esempio n. 4
0
        public static void InitializeWorkbench(IWorkbench workbench, IWorkbenchLayout layout)
        {
            WorkbenchSingleton.workbench = workbench;

            LanguageService.ValidateLanguage();

            DisplayBindingService.InitializeService();
            LayoutConfiguration.LoadLayoutConfiguration();
            FileService.InitializeService();

            //by hanz
            //DomHostCallback.Register(); // must be called after StatusBarService.Initialize()
            //ParserService.InitializeParserService();
            //TaskService.Initialize();
            //Bookmarks.BookmarkManager.Initialize();
            //Project.CustomToolsService.Initialize();
            //Project.BuildModifiedProjectsOnlyService.Initialize();

            var messageService = ICSharpCode.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();//by hanz
            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);
            };
        }
Esempio n. 5
0
        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 Core.Properties()));

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

            //RemoveXButton(WorkbenchSingleton.MainForm.Handle.ToInt32());
            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);
            };
        }
Esempio n. 6
0
        /// <summary>
        /// Runs workbench cleanup.
        /// Is called by ICSharpCode.SharpDevelop.Sda and should not be called manually!
        /// </summary>
        public static void OnWorkbenchUnloaded()
        {
            //if (!Project.ProjectService.IsClosingCanceled()) {
            if (true)
            {
                //Project.ProjectService.CloseSolution();//by hanz
                //NavigationService.Unload();

                ApplicationStateInfoService.UnregisterStateGetter(activeContentState);

                WorkbenchUnloaded(null, EventArgs.Empty);

                FileService.Unload();
            }
        }
Esempio n. 7
0
        public AddInTreeImpl(ApplicationStateInfoService applicationStateService)
        {
            doozers.TryAdd("Class", new ClassDoozer());
            doozers.TryAdd("Static", new StaticDoozer());
            doozers.TryAdd("FileFilter", new FileFilterDoozer());
            doozers.TryAdd("String", new StringDoozer());
            doozers.TryAdd("Icon", new IconDoozer());
            doozers.TryAdd("MenuItem", new MenuItemDoozer());
            doozers.TryAdd("ToolbarItem", new ToolbarItemDoozer());
            doozers.TryAdd("Include", new IncludeDoozer());
            doozers.TryAdd("Service", new ServiceDoozer());

            conditionEvaluators.TryAdd("Compare", new CompareConditionEvaluator());
            conditionEvaluators.TryAdd("Ownerstate", new OwnerStateConditionEvaluator());

            if (applicationStateService != null)
            {
                applicationStateService.RegisterStateGetter("Installed 3rd party AddIns", GetInstalledThirdPartyAddInsListAsString);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Starts the core services.
        /// This initializes the PropertyService and ResourceService.
        /// </summary>
        public void StartCoreServices(IPropertyService propertyService, Altaxo.Gui.Workbench.StartupSettings startupSettings)
        {
            var container = Altaxo.Current.GetRequiredService <System.ComponentModel.Design.IServiceContainer>();

            container.AddService(typeof(ITextOutputService), new TextOutputServiceTemporary());
            var applicationStateInfoService = new ApplicationStateInfoService();

            _addInTree = new AddInTreeImpl(applicationStateInfoService);
            container.AddService(typeof(Altaxo.Gui.Workbench.StartupSettings), startupSettings);
            CultureSettingsAtStartup.StartupDocumentCultureInfo = startupSettings.OriginalCulture;
            CultureSettingsAtStartup.StartupUICultureInfo       = startupSettings.OriginalUICulture;

            container.AddService(typeof(IPropertyService), propertyService);
            SetCultureSettingsFromProperties(startupSettings); // set the document culture and the UI culture as early as possible (when PropertyService is functional)

            container.AddService(typeof(IResourceService), new ResourceServiceImpl(Path.Combine(propertyService.DataDirectory, "resources"), propertyService));
            container.AddService(typeof(IAddInTree), _addInTree);
            container.AddService(typeof(ApplicationStateInfoService), applicationStateInfoService);
            StringParser.RegisterStringTagProvider(new ApplicationNameProvider {
                appName = _applicationName
            });
        }
Esempio n. 9
0
        public static void InitializeWorkbench(Window window)//, IWorkbenchLayout layout)
        {
            WorkbenchSingleton.workbench = new Workbench(window);

            PropertyService.InitializeService(@"C:\Users\admin\AppData\Roaming\ICSharpCode/SharpDevelop4",
                                              @"F:\Install\Develop\Visual Studio\SharpDevelop\SharpDevelop_4.2.1.8805_Source\bin\..\data",
                                              "CodeEditor");
            PropertyService.Load();
            ResourceService.InitializeService(Path.Combine(PropertyService.DataDirectory, "resources"));
            ResourceService.RegisterNeutralImages(new ResourceManager("Savchin.Resources.BitmapResources", typeof(ITextEditor).Assembly));
            ResourceService.RegisterNeutralStrings(new ResourceManager("Savchin.Resources.StringResources", typeof(ITextEditor).Assembly));
            //ProjectBindingService.SetBindings(new ProjectBindingDescriptor[]
            //                                      {
            //                                          new ProjectBindingDescriptor(new Codon(null,"ProjectBinding",new Properties
            //                                                                                                           {

            //                                                                                                           },
            //                                              )),
            //                                      });
            var path  = Path.GetDirectoryName(typeof(WorkbenchSingleton).Assembly.Location);
            var files = new List <string>(Directory.GetFiles(path, "*.addin", SearchOption.AllDirectories));

            AddInTree.Load(files, new List <string>());
            //TODO: Uncomment
            //LanguageService.ValidateLanguage();

            //DisplayBindingService.InitializeService();
            //LayoutConfiguration.LoadLayoutConfiguration();
            //FileService.InitializeService();
            //DomHostCallback.Register(); // must be called after StatusBarService.Initialize()
            ParserService.InitializeParserService();
            //TaskService.Initialize();
            //Bookmarks.BookmarkManager.Initialize();
            //CustomToolsService.Initialize();
            //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()));
            //TODO: Uncomment
            // workbench.WorkbenchLayout = layout;

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

            OnWorkbenchCreated();

            //TODO: Uncomment
            //// 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);
            };
            //TODO: Uncomment
            //workbench.ActiveWorkbenchWindowChanged += delegate
            //{
            //    Debug.WriteLine("ActiveWorkbenchWindowChanged to " + workbench.ActiveWorkbenchWindow);
            //    LoggingService.Debug("ActiveWorkbenchWindowChanged to " + workbench.ActiveWorkbenchWindow);
            //};


            FakeProject.Create(path, "PresentationFramework", "WindowsBase");
        }