StartCoreServices() public méthode

public StartCoreServices ( ) : void
Résultat void
		public static void Init()
		{
			SharpSnippetCompilerManager manager = new SharpSnippetCompilerManager();
			Assembly exe = manager.GetType().Assembly;
			
			string rootPath = Path.GetDirectoryName(exe.Location);
			string configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SharpSnippetCompiler");
			string dataDirectory = Path.Combine(rootPath, "data");

			CoreStartup startup = new CoreStartup("SharpSnippetCompiler");
			startup.ConfigDirectory = configDirectory;
			startup.DataDirectory = dataDirectory;
			startup.PropertiesName = "SharpSnippetCompiler";

			startup.StartCoreServices();
						
			ResourceService.RegisterNeutralStrings(new ResourceManager("Resources.StringResources", exe));
			ResourceService.RegisterNeutralImages(new ResourceManager("Resources.BitmapResources", exe));

			StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());
			
			string addInFolder = Path.Combine(rootPath, "AddIns");
			startup.AddAddInsFromDirectory(addInFolder);
			startup.RunInitialization();
		}
		public void InitSharpDevelopCore(SharpDevelopHost.CallbackHelper callback, StartupSettings properties)
		{
			LoggingService.Info("InitSharpDevelop...");
			this.callback = callback;
			CoreStartup startup = new CoreStartup(properties.ApplicationName);
			if (properties.UseSharpDevelopErrorHandler) {
				this.useSharpDevelopErrorHandler = true;
				ExceptionBox.RegisterExceptionBoxForUnhandledExceptions();
			}
			startup.ConfigDirectory = properties.ConfigDirectory;
			startup.DataDirectory = properties.DataDirectory;
			if (properties.PropertiesName != null) {
				startup.PropertiesName = properties.PropertiesName;
			}
			
			// disable RTL: translations for the RTL languages are inactive
			RightToLeftConverter.RightToLeftLanguages = new string[0];
			
			if (properties.ApplicationRootPath != null) {
				FileUtility.ApplicationRootPath = properties.ApplicationRootPath;
			}
			
			startup.StartCoreServices();
			Assembly exe = Assembly.Load(properties.ResourceAssemblyName);
			ResourceService.RegisterNeutralStrings(new ResourceManager("Resources.StringResources", exe));
			ResourceService.RegisterNeutralImages(new ResourceManager("Resources.BitmapResources", exe));
			
			MenuCommand.LinkCommandCreator = delegate(string link) { return new LinkCommand(link); };
			StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());
			
			LoggingService.Info("Looking for AddIns...");
			foreach (string file in properties.addInFiles) {
				startup.AddAddInFile(file);
			}
			foreach (string dir in properties.addInDirectories) {
				startup.AddAddInsFromDirectory(dir);
			}
			
			if (properties.AllowAddInConfigurationAndExternalAddIns) {
				startup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));
			}
			if (properties.AllowUserAddIns) {
				startup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
				                            Path.Combine(PropertyService.ConfigDirectory, "AddIns"));
			}
			
			LoggingService.Info("Loading AddInTree...");
			startup.RunInitialization();
			
			// Register events to marshal back
			Project.ProjectService.StartBuild += delegate { this.callback.StartBuild(); };
			Project.ProjectService.EndBuild   += delegate { this.callback.EndBuild(); };
			Project.ProjectService.SolutionLoaded += delegate { this.callback.SolutionLoaded(); };
			Project.ProjectService.SolutionClosed += delegate { this.callback.SolutionClosed(); };
			Project.ProjectService.SolutionConfigurationChanged += delegate { this.callback.SolutionConfigurationChanged(); };
			FileUtility.FileLoaded += delegate(object sender, FileNameEventArgs e) { this.callback.FileLoaded(e.FileName); };
			FileUtility.FileSaved  += delegate(object sender, FileNameEventArgs e) { this.callback.FileSaved(e.FileName); };
			
			LoggingService.Info("InitSharpDevelop finished");
		}
Exemple #3
0
        static void Main()
        {
            LoggingService.Info("Starting App...");
            Assembly exe = typeof(Program).Assembly;
            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

            CoreStartup c = new CoreStartup("MapToolkit");
            c.ConfigDirectory = FileUtility.Combine(FileUtility.ApplicationRootPath, "UserConfig") + Path.DirectorySeparatorChar;
            LoggingService.Info("Starting core services...");
            c.StartCoreServices();
            ResourceService.RegisterNeutralStrings(new ResourceManager("MapToolkit.Properties.SatRes", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("MapToolkit.Properties.SatRes", exe));

            AddInTree.Doozers.Add("Pad", new SharpAppCore.Pad.PadDoozer());
            AddInTree.Doozers.Add("DisplayBinding", new SharpAppCore.ViewContent.DisplayBindingDoozer());

            //初始化卫星和区域
            //SatGui.Services.SatService.SatInit();
            //SatGui.Services.AreaService.AreaInit();

            LoggingService.Debug("Looking for Addins...");
            c.AddAddInsFromDirectory(FileUtility.ApplicationRootPath);
            //c.ConfigureExternalAddIns(...);
            LoggingService.Debug("Loading AddinTre...");
            c.RunInitialization();

            LoggingService.Debug("Initializing workbench...");
            WorkbenchSingleton.InitializeWorkbench();

            //载入地图
            //SatGui.Services.MapService.MapInit();
            LoggingService.Debug("Starting workbench...");
            Form f = (Form)WorkbenchSingleton.Workbench;
            Application.Run(f);

            PropertyService.Save();
            //SatGui.Services.SatService.SaveStatus();
            //SatGui.Services.AreaService.SaveStatus();
            LoggingService.Info("Leaving app");
        }
Exemple #4
0
		public void InitSharpDevelopCore(SharpDevelopHost.CallbackHelper callback, StartupSettings properties)
		{
			// Initialize the most important services:
			var container = new SharpDevelopServiceContainer(ServiceSingleton.FallbackServiceProvider);
			container.AddService(typeof(IMessageService), new SDMessageService());
			container.AddService(typeof(ILoggingService), new log4netLoggingService());
			ServiceSingleton.ServiceProvider = container;
			
			LoggingService.Info("InitSharpDevelop...");
			this.callback = callback;
			CoreStartup startup = new CoreStartup(properties.ApplicationName);
			if (properties.UseSharpDevelopErrorHandler) {
				this.useSharpDevelopErrorHandler = true;
				ExceptionBox.RegisterExceptionBoxForUnhandledExceptions();
			}
			string configDirectory = properties.ConfigDirectory;
			string dataDirectory = properties.DataDirectory;
			string propertiesName;
			if (properties.PropertiesName != null) {
				propertiesName = properties.PropertiesName;
			} else {
				propertiesName = properties.ApplicationName + "Properties";
			}
			
			if (properties.ApplicationRootPath != null) {
				FileUtility.ApplicationRootPath = properties.ApplicationRootPath;
			}
			
			if (configDirectory == null)
				configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
				                               properties.ApplicationName);
			var propertyService = new PropertyService(
				DirectoryName.Create(configDirectory),
				DirectoryName.Create(dataDirectory ?? Path.Combine(FileUtility.ApplicationRootPath, "data")),
				propertiesName);
			
			startup.StartCoreServices(propertyService);
			Assembly exe = Assembly.Load(properties.ResourceAssemblyName);
			SD.ResourceService.RegisterNeutralStrings(new ResourceManager("ICSharpCode.SharpDevelop.Resources.StringResources", exe));
			SD.ResourceService.RegisterNeutralImages(new ResourceManager("ICSharpCode.SharpDevelop.Resources.BitmapResources", exe));
			
			CommandWrapper.LinkCommandCreator = (link => new LinkCommand(link));
			CommandWrapper.WellKnownCommandCreator = Core.Presentation.MenuService.GetKnownCommand;
			CommandWrapper.RegisterConditionRequerySuggestedHandler = (eh => CommandManager.RequerySuggested += eh);
			CommandWrapper.UnregisterConditionRequerySuggestedHandler = (eh => CommandManager.RequerySuggested -= eh);
			StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());
			
			LoggingService.Info("Looking for AddIns...");
			foreach (string file in properties.addInFiles) {
				startup.AddAddInFile(file);
			}
			foreach (string dir in properties.addInDirectories) {
				startup.AddAddInsFromDirectory(dir);
			}
			
			if (properties.AllowAddInConfigurationAndExternalAddIns) {
				startup.ConfigureExternalAddIns(Path.Combine(configDirectory, "AddIns.xml"));
			}
			if (properties.AllowUserAddIns) {
				startup.ConfigureUserAddIns(Path.Combine(configDirectory, "AddInInstallTemp"),
					Path.Combine(configDirectory, "AddIns"));
			}
			
			LoggingService.Info("Loading AddInTree...");
			startup.RunInitialization();
			
			((AssemblyParserService)SD.AssemblyParserService).DomPersistencePath = properties.DomPersistencePath;
			
			// Register events to marshal back
			Project.ProjectService.BuildStarted   += delegate { this.callback.StartBuild(); };
			Project.ProjectService.BuildFinished  += delegate { this.callback.EndBuild(); };
			Project.ProjectService.SolutionLoaded += delegate { this.callback.SolutionLoaded(); };
			Project.ProjectService.SolutionClosed += delegate { this.callback.SolutionClosed(); };
			FileUtility.FileLoaded += delegate(object sender, FileNameEventArgs e) { this.callback.FileLoaded(e.FileName); };
			FileUtility.FileSaved  += delegate(object sender, FileNameEventArgs e) { this.callback.FileSaved(e.FileName); };
			
			LoggingService.Info("InitSharpDevelop finished");
		}
Exemple #5
0
        static void DoStartup(string[] args)
        {
            LoggingService.Info("Application start");
            Assembly exe = typeof(Startup).Assembly;
            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

            LoggingService.Info("Starting core services...");
            CoreStartup coreStartup = new CoreStartup("Paint");
            coreStartup.PropertiesName = "AppProperties";
            coreStartup.StartCoreServices();

            ResourceService.RegisterNeutralStrings(
                new ResourceManager("Startup.StringResources", exe));
            ResourceService.RegisterNeutralImages(
                new ResourceManager("Startup.ImageResources", exe));

            LoggingService.Info("Looking for AddIns...");
            // Searches for ".addin" files in the
            // application directory.
            coreStartup.AddAddInsFromDirectory(
                Path.Combine(FileUtility.ApplicationRootPath, "AddIns"));

            coreStartup.ConfigureExternalAddIns(
                Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));

            coreStartup.ConfigureUserAddIns(
                Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
                Path.Combine(PropertyService.ConfigDirectory, "AddIns"));

            LoggingService.Info("Loading AddInTree...");
            // Now finally initialize the application.
            // This parses the ".addin" files and
            // creates the AddIn tree. It also
            // automatically runs the commands in
            // "/Workspace/Autostart"
            coreStartup.RunInitialization();

            LoggingService.Info("Initializing Workbench...");
            // Workbench is our class from the base
            // project, this method creates an instance
            // of the main form.
            Workbench.InitializeWorkbench();

            try
            {
                LoggingService.Info("Running application...");
                Application.Run(Workbench.Instance);
            }
            finally
            {
                try
                {
                    PropertyService.Save();
                }
                catch (Exception ex)
                {
                    MessageService.ShowError(ex, "Error storing properties");
                }
            }
            LoggingService.Info("Application shutdown");

            SingleInstanceController controller = new SingleInstanceController();
            controller.Run(args);
        }
Exemple #6
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoggingService.Info("Application start");
            var exe = typeof (Program).Assembly;
            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

            LoggingService.Info("Starting core services...");

            var coreStartup = new CoreStartup("NasuTek Grabbie") {
                PropertiesName = "AppProperties"
            };

            if (Directory.Exists(Path.Combine(FileUtility.ApplicationRootPath, "Config")))
                coreStartup.ConfigDirectory = Path.Combine(FileUtility.ApplicationRootPath, "Config");

            coreStartup.StartCoreServices();

            LoggingService.Info("Looking for AddIns...");

            coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "Plugins"));
            coreStartup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));
            coreStartup.ConfigureUserAddIns(
                Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
                Path.Combine(PropertyService.ConfigDirectory, "AddIns"));

            LoggingService.Info("Loading AddInTree...");
            coreStartup.RunInitialization();

            LoggingService.Info("Initializing Grabbie Engine...");
            Engine = new GrabbieEngine {
                UploadNotificationSystem = new StatusForm()
            };

            Engine.AlertTypes.Add("None", new NeNone());
            Engine.AlertTypes.Add("System Default", new NeBalloon());

            if (AddInTree.ExistsTreeNode("/Grabbie/CaptureServices")) {
                foreach (
                    var obj in
                        AddInTree.GetTreeNode("/Grabbie/CaptureServices").Codons.Select(
                            codon => codon.AddIn.CreateObject(codon.Properties["class"])).OfType<ICaptureType>()) {
                    obj.Hotkey.Shortcut =
                        PropertyService.Get("Grabbie.Hotkey." + obj.Hotkey.ShortcutName.Replace(" ", ""),
                            obj.Hotkey.Shortcut);
                    Engine.CaptureTypes.Add(obj);
                }
            }

            if (AddInTree.ExistsTreeNode("/Grabbie/FileNameServices")) {
                foreach (var codon in AddInTree.GetTreeNode("/Grabbie/FileNameServices").Codons) {
                    var obj = codon.AddIn.CreateObject(codon.Properties["class"]) as IFileNameType;
                    if (obj != null)
                        Engine.FileNameTypes.Add(codon.Properties["name"], obj);
                }
            }

            if (AddInTree.ExistsTreeNode("/Grabbie/UrlShornerServices")) {
                foreach (var codon in AddInTree.GetTreeNode("/Grabbie/UrlShornerServices").Codons) {
                    var obj = codon.AddIn.CreateObject(codon.Properties["class"]) as IUrlShortnerType;
                    if (obj != null)
                        Engine.UrlShortnerTypes.Add(codon.Properties["name"], obj);
                }
            }

            if (AddInTree.ExistsTreeNode("/Grabbie/Uploaders")) {
                foreach (var codon in AddInTree.GetTreeNode("/Grabbie/Uploaders").Codons) {
                    var obj = codon.AddIn.CreateObject(codon.Properties["class"]) as IUploadType;
                    if (obj != null)
                        Engine.UploadTypes.Add(codon.Properties["name"], obj);
                }
            }

            if (AddInTree.ExistsTreeNode("/Grabbie/Alerters")) {
                foreach (var codon in AddInTree.GetTreeNode("/Grabbie/Alerters").Codons) {
                    var obj = codon.AddIn.CreateObject(codon.Properties["class"]) as IAlertType;
                    if (obj != null)
                        Engine.AlertTypes.Add(codon.Properties["name"], obj);
                }
            }

            if (AddInTree.ExistsTreeNode("/Grabbie/SettingsPages")) {
                foreach (
                    var obj in
                        AddInTree.GetTreeNode("/Grabbie/SettingsPages").Codons.Select(
                            codon => codon.AddIn.CreateObject(codon.Properties["class"])).OfType<SettingsPage>())
                    Engine.SettingsPages.Add(obj);
            }

            LoggingService.Info("Initializing Grabbie Core...");
            Core = new Grabbie();

            LoggingService.Info("Running Grabbie...");

            try {
                Application.Run();
            } finally {
                try {
                    PropertyService.Save();
                } catch (Exception ex) {
                    MessageService.ShowException(ex, "Error storing properties");
                }
            }

            LoggingService.Info("Application shutdown");
        }
Exemple #7
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            string lang = PreferredSiteList.InitCulture();

            //var btw = BroadcastTextWriter.Instance;

            // Logging service by default uses System.Diagnostics.Debug. Re-route this
            // to our writer
            //var wfmsg = WinFormsMessageService.Instance;
            //ServiceManager.LoggingService = new TextWriterLoggingService(btw);
            //ServiceManager.MessageService = wfmsg;

            ServiceManager.Instance = new MaestroServiceManager();
            LoggingService.Info("Application start"); //NOXLATE

            // Setup Platform.ini if required
            if (!Platform.IsRunningOnMono)
            {
                if (!File.Exists("Platform.ini") && File.Exists("LocalConfigure.exe")) //NOXLATE
                {
                    var proc = new ProcessStartInfo("LocalConfigure.exe");
                    if (Environment.OSVersion.Version.Major >= 6)
                        proc.Verb = "runas"; //NOXLATE

                    var p = Process.Start(proc);
                    p.WaitForExit();
                }
            }

            if (Platform.IsRunningOnMono)
            {
                LoggingService.Info(Strings.Warn_Mono);
            }

            //Init our default set of resource validators
            ResourceValidatorLoader.LoadStockValidators();

            AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            // Get a reference to the entry assembly (Startup.exe)
            Assembly exe = typeof(Program).Assembly;

            // Set the root path of our application. ICSharpCode.Core looks for some other
            // paths relative to the application root:
            // "data/resources" for language resources, "data/options" for default options
            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

            LoggingService.Info("Starting core services..."); //NOXLATE

            // CoreStartup is a helper class making starting the Core easier.
            // The parameter is used as the application name, e.g. for the default title of
            // MessageService.ShowMessage() calls.
            CoreStartup coreStartup = new CoreStartup("MapGuide Maestro"); //NOXLATE
            // It is also used as default storage location for the application settings:
            // "%Application Data%\%Application Name%", but you can override that by setting c.ConfigDirectory

            // #1955: Each version of Maestro from here on in will store their user data under
            // %APPDATA%\Maestro-x.y
            coreStartup.ConfigDirectory = MaestroPaths.BasePath;

            // Specify the name of the application settings file (.xml is automatically appended)
            coreStartup.PropertiesName = "AppProperties"; //NOXLATE

            // Initializes the Core services (ResourceService, PropertyService, etc.)
            coreStartup.StartCoreServices();

            LoggingService.Info("Looking for AddIns..."); //NOXLATE
            // Searches for ".addin" files in the application directory.
            coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "AddIns")); //NOXLATE

            // Searches for a "AddIns.xml" in the user profile that specifies the names of the
            // add-ins that were deactivated by the user, and adds "external" AddIns.
            coreStartup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml")); //NOXLATE

            // Searches for add-ins installed by the user into his profile directory. This also
            // performs the job of installing, uninstalling or upgrading add-ins if the user
            // requested it the last time this application was running.
            coreStartup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"), //NOXLATE
                                            Path.Combine(PropertyService.ConfigDirectory, "AddIns")); //NOXLATE

            ResourceService.Language = lang;
            LoggingService.Info("Loading AddInTree..."); //NOXLATE
            // Now finally initialize the application. This parses the ".addin" files and
            // creates the AddIn tree. It also automatically runs the commands in
            // "/Workspace/Autostart"
            coreStartup.RunInitialization();

            LoggingService.Info("Initializing Workbench..."); //NOXLATE
            // Workbench is our class from the base project, this method creates an instance
            // of the main form.
            ServiceRegistry.Initialize(() => {
                //DIRTY DIRTY HACK: I'm getting tired of Mono workarounds. But background resource
                //preview preparation has a chance of clogging up if the main window is initially maximized
                Workbench.InitializeWorkbench(new WorkbenchInitializer(!Platform.IsRunningOnMono));
                try
                {
                    LoggingService.Info("Running application..."); //NOXLATE
                    // Workbench.Instance is the instance of the main form, run the message loop.
                    Application.Run(Workbench.Instance);
                }
                finally
                {
                    try
                    {
                        // Save changed properties
                        PropertyService.Save();
                    }
                    catch (Exception ex)
                    {
                        ErrorDialog.Show(Strings.Error_StoreProperties, ex.ToString());
                    }
                }
                LoggingService.Info("Application shutdown"); //NOXLATE
            });
        }
Exemple #8
0
        public FormMain()
        {
            InitializeComponent();

            // Setup Devlog
            DevLog.setup("logs.txt");

            DockContainer = new DockContainer();
            DockContainer.MainForm = this;
            DockContainer.Dock = DockStyle.Fill;

            this.toolStripContainer1.ContentPanel.Controls.Add(this.DockContainer);

            DockContainer.ShowDocumentIcon = true;

            DockContainer.DocumentStyle = DocumentStyles.DockingWindow;

            DockContainer.ActiveDocumentChanged += new EventHandler(_DockContainer_ActiveDocumentChanged);

            DockContainer.ActiveContentChanged += new EventHandler(_DockContainer_ActiveContentChanged);

            DockContainer.ContextMenu = new ContextMenu();

            ///=========================Integration with SharpDevelop Start==================================

            Assembly exe = this.GetType().Assembly;

            ResourceService.RegisterNeutralStrings(new ResourceManager("PAT.GUI.Properties.StringResources", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("PAT.GUI.Properties.BitmapResources", exe));

            WorkbenchSingleton.DockContainer = DockContainer;
            WorkbenchSingleton.InitializeWorkbench();

            CoreStartup startup = new CoreStartup(Common.Utility.Utilities.APPLICATION_NAME);
            startup.ConfigDirectory = Common.Utility.Utilities.APPLICATION_PATH;// Application.StartupPath;
            startup.DataDirectory = Common.Utility.Utilities.APPLICATION_PATH;// Application.StartupPath;

            startup.StartCoreServices();

            startup.RunInitialization();
            ///=========================Integration with SharpDevelop End==================================

            // Change the message of the splash screen for loading modules
            SplashScreen.SplashScreen.UpdateStatusText("Loading modules..");

            // Load modules
            LoadModules();

            // After load the modules, close the splash screen
            SplashScreen.SplashScreen.UpdateStatusText("Modules Loaded");

            ToolStripMenuItem[] tools = GetNewFileItems();

            ToolbarButton_New.DropDownItems.AddRange(tools);
            ToolStripItem wizardItem = ToolbarButton_New.DropDownItems[0];
            ToolbarButton_New.DropDownItems.RemoveAt(0);
            ToolbarButton_New.DropDownItems.Add(new ToolStripSeparator());
            ToolbarButton_New.DropDownItems.Add(wizardItem);

            tools = GetNewFileItems();

            MenuButton_New.DropDownItems.AddRange(tools);
            wizardItem = MenuButton_New.DropDownItems[0];
            MenuButton_New.DropDownItems.RemoveAt(0);
            MenuButton_New.DropDownItems.Add(new ToolStripSeparator());
            MenuButton_New.DropDownItems.Add(wizardItem);

            this.LoadRecents();

            this.FormClosing += new FormClosingEventHandler(FormMain_FormClosing);

            ((ToolStripProfessionalRenderer)StandardToolBar.Renderer).ColorTable.UseSystemColors = true; ((ToolStripProfessionalRenderer)StandardToolBar.Renderer).ColorTable.UseSystemColors = true;
            ((ToolStripProfessionalRenderer)convertToolbar.Renderer).ColorTable.UseSystemColors = true;

            Output_Window = new OutputDockingWindow();
            Output_Window.Icon = Common.Utility.Utilities.GetIcon("Output");
            Output_Window.Disposed += new EventHandler(output_Window_Disposed);

            ErrorListWindow = new ErrorListWindow();
            ErrorListWindow.Icon = Common.Utility.Utilities.GetIcon("ErrorList");
            ErrorListWindow.Disposed += new EventHandler(ErrorListWindow_Disposed);
            ErrorListWindow.ListView.DoubleClick += new EventHandler(ErrorListView_DoubleClick);

            ModelExplorerWindow = new ModelExplorerWindow();
            ModelExplorerWindow.Icon = Common.Utility.Utilities.GetIcon("ModelExplorer");
            ModelExplorerWindow.Disposed += new EventHandler(ModelExplorerWindowWindow_Disposed);
            ModelExplorerWindow.TreeView_Model.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(TreeView_Model_NodeMouseDoubleClick);
            ModelExplorerWindow.Button_Refresh.Click += new EventHandler(Button_SpecParse_Click);

            FindUsagesWindow = new FindUsagesWindow();
            FindUsagesWindow.Icon = Common.Utility.Utilities.GetIcon("Find Usages");
            FindUsagesWindow.Disposed += new EventHandler(FindUsagesWindow_Disposed);
            FindUsagesWindow.ListView.DoubleClick += new EventHandler(FindUsagesWindow_DoubleClick);
            FindUsagesWindow.Button_Refresh.Click += new EventHandler(Button_Refresh_Click);

            //check the correct language menu
            foreach (ToolStripMenuItem item in this.MenuButton_Languages.DropDownItems)
            {
                if (item.Tag.ToString() == GUIUtility.GUI_LANGUAGE)
                {
                    item.Checked = true;
                    break;
                }
            }

            SetFormMainCaption();

            this.toolStripContainer1.TopToolStripPanel.Controls.Clear();
            this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.convertToolbar);
            this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.StandardToolBar);
            this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.MenuStrip);

            convertToolbar.Location = new Point(3, 48);
            StandardToolBar.Location = new Point(3, 24);
            MenuStrip.Dock = DockStyle.Top;
            MenuStrip.Location = new Point(0, 0);
            MenuButton_Japanese.Visible = false;

            CheckForItemState();
        }
Exemple #9
0
		public static void Main(string[] args)
		{
			// The LoggingService is a small wrapper around log4net.
			// Our application contains a .config file telling log4net to write
			// to System.Diagnostics.Trace.
			LoggingService.Info("Application start");
			
			// Get a reference to the entry assembly (Startup.exe)
			Assembly exe = typeof(Start).Assembly;
			
			// Set the root path of our application. ICSharpCode.Core looks for some other
			// paths relative to the application root:
			// "data/resources" for language resources, "data/options" for default options
			FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);
			
			LoggingService.Info("Starting core services...");
			
			// CoreStartup is a helper class making starting the Core easier.
			// The parameter is used as the application name, e.g. for the default title of
			// MessageService.ShowMessage() calls.
			CoreStartup coreStartup = new CoreStartup("Test application");
			// It is also used as default storage location for the application settings:
			// "%Application Data%\%Application Name%", but you can override that by setting c.ConfigDirectory
			
			// Specify the name of the application settings file (.xml is automatically appended)
			coreStartup.PropertiesName = "AppProperties";
			
			// Initializes the Core services (ResourceService, PropertyService, etc.)
			coreStartup.StartCoreServices();
			
			// Registeres the default (English) strings and images. They are compiled as
			// "EmbeddedResource" into Startup.exe.
			// Localized strings are automatically picked up when they are put into the
			// "data/resources" directory.
			ResourceService.RegisterNeutralStrings(new ResourceManager("Startup.StringResources", exe));
			ResourceService.RegisterNeutralImages(new ResourceManager("Startup.ImageResources", exe));
			
			LoggingService.Info("Looking for AddIns...");
			// Searches for ".addin" files in the application directory.
			coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "AddIns"));
			
			// Searches for a "AddIns.xml" in the user profile that specifies the names of the
			// add-ins that were deactivated by the user, and adds "external" AddIns.
			coreStartup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));
			
			// Searches for add-ins installed by the user into his profile directory. This also
			// performs the job of installing, uninstalling or upgrading add-ins if the user
			// requested it the last time this application was running.
			coreStartup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
			                                Path.Combine(PropertyService.ConfigDirectory, "AddIns"));
			
			LoggingService.Info("Loading AddInTree...");
			// Now finally initialize the application. This parses the ".addin" files and
			// creates the AddIn tree. It also automatically runs the commands in
			// "/Workspace/Autostart"
			coreStartup.RunInitialization();
			
			LoggingService.Info("Initializing Workbench...");
			// Workbench is our class from the base project, this method creates an instance
			// of the main form.
			Workbench.InitializeWorkbench();
			
			try {
				LoggingService.Info("Running application...");
				// Workbench.Instance is the instance of the main form, run the message loop.
				Application.Run(Workbench.Instance);
			} finally {
				try {
					// Save changed properties
					PropertyService.Save();
				} catch (Exception ex) {
					MessageService.ShowError(ex, "Error storing properties");
				}
			}
			
			LoggingService.Info("Application shutdown");
		}
        private void setupCore()
        {
            Assembly exe = typeof(NotificationIcon).Assembly;
            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);
            CoreStartup coreStartup = new CoreStartup("USBToolMonitor");

            coreStartup.PropertiesName = "USBToolMonitor";
            coreStartup.StartCoreServices();
            coreStartup.RunInitialization();
        }