static void Main() { LoggingService.Info("Starting App..."); Assembly exe = typeof(Program).Assembly; FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location); CoreStartup c = new CoreStartup("Frame.Core"); c.ConfigDirectory = FileUtility.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".michael-zhang", "Frame.Core") + Path.DirectorySeparatorChar; LoggingService.Info("Starting core services..."); c.StartCoreServices(); ResourceService.RegisterNeutralStrings(new ResourceManager("StartUp.Properties.SDRes", exe)); ResourceService.RegisterNeutralImages(new ResourceManager("StartUp.Properties.SDRes", exe)); AddInTree.Doozers.Add("Pad", new Frame.Core.Pad.PadDoozer()); AddInTree.Doozers.Add("DisplayBinding", new Frame.Core.ViewContent.DisplayBindingDoozer()); LoggingService.Debug("Looking for Addins..."); c.AddAddInsFromDirectory(FileUtility.ApplicationRootPath); //c.ConfigureExternalAddIns(...); LoggingService.Debug("Loading AddinTre..."); c.RunInitialization(); LoggingService.Debug("Initializing workbench..."); WorkbenchSingleton.InitializeWorkbench(); LoggingService.Debug("Starting workbench..."); Form f = (Form)WorkbenchSingleton.Workbench; Application.Run(f); PropertyService.Save(); LoggingService.Info("Leaving app"); }
void Run(string[] args) { SharpSnippetCompilerManager.Init(); app = new App(); // Force creation of the debugger before workbench is created. IDebugger debugger = DebuggerService.CurrentDebugger; mainWindow = new MainWindow(); var workbench = new Workbench(mainWindow); WorkbenchSingleton.InitializeWorkbench(workbench, new WorkbenchLayout()); ViewModels.MainViewModel.AddInitialPads(); SnippetCompilerProject.Load(); IProject project = GetCurrentProject(); ProjectService.CurrentProject = project; LoadFiles(project); // ParserService.StartParserThread(); try { app.Run(WorkbenchSingleton.MainWindow); } finally { try { // Save properties //PropertyService.Save(); } catch (Exception ex) { MessageService.ShowException(ex, "Properties could not be saved."); } } }
public void InitializeWorkbench() { app = new App(); System.Windows.Forms.Integration.WindowsFormsHost.EnableWindowsFormsInterop(); ComponentDispatcher.ThreadIdle -= ComponentDispatcher_ThreadIdle; // ensure we don't register twice ComponentDispatcher.ThreadIdle += ComponentDispatcher_ThreadIdle; WorkbenchSingleton.InitializeWorkbench(new WpfWorkbench(), new AvalonDockLayout()); }
void RunWorkbenchInternal(object settings) { WorkbenchSettings wbSettings = (WorkbenchSettings)settings; LoggingService.Info("Initializing workbench..."); WorkbenchSingleton.InitializeWorkbench(); LoggingService.Info("Starting workbench..."); Exception exception = null; // finally start the workbench. try { StartWorkbenchCommand wbc = new StartWorkbenchCommand(); callback.BeforeRunWorkbench(); if (Debugger.IsAttached) { wbc.Run(wbSettings.InitialFileList); } else { try { wbc.Run(wbSettings.InitialFileList); } catch (Exception ex) { exception = ex; } } } finally { LoggingService.Info("Unloading services..."); try { WorkbenchSingleton.OnWorkbenchUnloaded(); PropertyService.Save(); } catch (Exception ex) { LoggingService.Warn("Exception during unloading", ex); if (exception == null) { exception = ex; } } } LoggingService.Info("Finished running workbench."); callback.WorkbenchClosed(); if (exception != null) { const string errorText = "Unhandled exception terminated the workbench"; LoggingService.Fatal(exception); if (useSharpDevelopErrorHandler) { System.Windows.Forms.Application.Run(new ExceptionBox(exception, errorText, true)); } else { throw new RunWorkbenchException(errorText, exception); } } }
public MainWindow() { try { WorkbenchSingleton.InitializeWorkbench(this); InitializeComponent(); editor.Text = Properties.Resources.Test; //ProjectService.LoadSolution(@"C:\Users\admin\Documents\SharpDevelop Projects\test\test.sln"); //var s = ProjectService.OpenSolution; } catch (Exception ex) { } }
void Run(string[] args) { SharpSnippetCompilerManager.Init(); mainForm = new MainForm(); // Force creation of the debugger before workbench is created. IDebugger debugger = DebuggerService.CurrentDebugger; Workbench workbench = new Workbench(mainForm); WorkbenchSingleton.InitializeWorkbench(workbench, new WorkbenchLayout()); PadDescriptor errorList = workbench.GetPad(typeof(ErrorListPad)); errorList.CreatePad(); mainForm.ErrorList = errorList.PadContent.Control; PadDescriptor outputList = workbench.GetPad(typeof(CompilerMessageView)); outputList.CreatePad(); mainForm.OutputList = outputList.PadContent.Control; mainForm.Visible = true; SnippetCompilerProject.Load(); IProject project = GetCurrentProject(); ProjectService.CurrentProject = project; LoadFiles(project); ParserService.StartParserThread(); //WorkbenchSingleton.SafeThreadAsyncCall(new Action<Program>(LoadFile)); try { Application.Run(mainForm); } finally { try { // Save properties //PropertyService.Save(); } catch (Exception ex) { MessageService.ShowError(ex, "Properties could not be saved."); } } }
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"); }
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); //ResourceHelper.GenerateResources(FileUtility.ApplicationRootPath + "\\Resources"); 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("SharpWorkbench"); // 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)); //ResourceService.RegisterNeutralImages(new ResourceManager("app", exe)); AddInTree.Doozers.Add("Pad", new SharpWorkbench.Core.Pad.PadDoozer()); AddInTree.Doozers.Add("DisplayBinding", new SharpWorkbench.Core.ViewContent.DisplayBindingDoozer()); LoggingService.Info("Looking for AddIns..."); // Searches for ".addin" files in the application directory. //coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "AddIns")); coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "")); // 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. WorkbenchSingleton.InitializeWorkbench(); LoggingService.Debug("Starting workbench..."); try { LoggingService.Info("Running application..."); // Workbench.Instance is the instance of the main form, run the message loop. Application.Run((Form)WorkbenchSingleton.Workbench); } finally { try { // Save changed properties PropertyService.Save(); } catch (Exception ex) { MessageService.ShowError(ex, "Error storing properties"); } } LoggingService.Info("Application shutdown"); }
public FormMain() { InitializeComponent(); 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(); Assembly exe = this.GetType().Assembly; ResourceService.RegisterNeutralStrings(new ResourceManager("PAT.Main.Properties.StringResources", exe)); ResourceService.RegisterNeutralImages(new ResourceManager("PAT.Main.Properties.BitmapResources", exe)); WorkbenchSingleton.DockContainer = DockContainer; WorkbenchSingleton.InitializeWorkbench(); CoreStartup startup = new CoreStartup(Common.Ultility.Ultility.APPLICATION_NAME); startup.ConfigDirectory = Common.Ultility.Ultility.APPLICATION_PATH; startup.DataDirectory = Common.Ultility.Ultility.APPLICATION_PATH; startup.StartCoreServices(); startup.RunInitialization(); ((ToolStripProfessionalRenderer)StandardToolBar.Renderer).ColorTable.UseSystemColors = true; Output_Window = new OutputDockingWindow(); Output_Window.Icon = Common.Ultility.Ultility.GetIcon("Output"); Output_Window.Disposed += new EventHandler(output_Window_Disposed); ErrorListWindow = new ErrorListWindow(); ErrorListWindow.Icon = Common.Ultility.Ultility.GetIcon("ErrorList"); ErrorListWindow.Disposed += new EventHandler(ErrorListWindow_Disposed); ErrorListWindow.ListView.DoubleClick += new EventHandler(ErrorListView_DoubleClick); this.toolStripContainer1.TopToolStripPanel.Controls.Clear(); this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.FunctionalToolBar); this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.StandardToolBar); this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.MenuStrip); StandardToolBar.Location = new Point(3, 24); FunctionalToolBar.Location = new Point(3, 49); FunctionalToolBar.Size = new Size(409, 25); MenuStrip.Dock = DockStyle.Top; MenuStrip.Location = new Point(0, 0); CheckForItemState(); CurrentModule = new ModuleFacade(); Language = HighlightingManager.Manager.AddHighlightingStrategy(Path.Combine(Application.StartupPath, "Syntax.xshd")); OpenFilter = Language.Name + " (*" + Language.ExtensionString + ")|*" + Language.ExtensionString; CurrentModule.ShowModel += new ShowModelHandler(ShowModel); CurrentModule.ExampleMenualToolbarInitialize(this.MenuButton_Examples); CurrentModule.ReadConfiguration(); //Common.Ultility.Ultility.ModuleFolderNames.Add(moduleFolderName); Common.Ultility.Ultility.ModuleNames = new List <string>(); Common.Ultility.Ultility.ModuleDictionary = new Dictionary <string, ModuleFacadeBase>(); Common.Ultility.Ultility.ModuleNames.Add(Language.Name); Common.Ultility.Ultility.ModuleDictionary.Add(Language.Name, CurrentModule); Common.Ultility.Ultility.Images.ImageList.Images.Add(Language.Name, CurrentModule.ModuleIcon); this.FunctionalToolBar.SuspendLayout(); CurrentModule.ToolbarInitialize(this.FunctionalToolBar, Toolbar_Button_Click); this.FunctionalToolBar.ResumeLayout(); }
static void RunApplication() { LoggingService.Info("Starting SharpDevelop..."); try { StartupSettings startup = new StartupSettings(); #if DEBUG startup.UseSharpDevelopErrorHandler = !Debugger.IsAttached; #endif Assembly exe = typeof(SharpDevelopMain).Assembly; startup.ApplicationRootPath = Path.Combine(Path.GetDirectoryName(exe.Location), ".."); startup.AllowUserAddIns = true; #if ModifiedForAltaxo startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Altaxo/Altaxo2"); startup.ResourceAssemblyName = "AltaxoStartup"; #else startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode/SharpDevelop2.1"); #endif startup.AddAddInsFromDirectory(Path.Combine(startup.ApplicationRootPath, "AddIns")); SharpDevelopHost host = new SharpDevelopHost(AppDomain.CurrentDomain, startup); #if ModifiedForAltaxo ResourceService.LoadUserStrings("AltaxoString.resources"); ResourceService.LoadUserIcons("AltaxoBitmap.resources"); #endif string[] fileList = SplashScreenForm.GetRequestedFileList(); if (fileList.Length > 0) { if (LoadFilesInPreviousInstance(fileList)) { LoggingService.Info("Aborting startup, arguments will be handled by previous instance"); return; } } host.BeforeRunWorkbench += delegate { if (SplashScreenForm.SplashScreen != null) { SplashScreenForm.SplashScreen.BeginInvoke(new MethodInvoker(SplashScreenForm.SplashScreen.Dispose)); SplashScreenForm.SplashScreen = null; } }; #if ModifiedForAltaxo WorkbenchSingleton.InitializeWorkbench(typeof(Altaxo.Gui.SharpDevelop.AltaxoSDWorkbench)); Altaxo.Current.SetWorkbench((Altaxo.Gui.Common.IWorkbench)WorkbenchSingleton.Workbench); new Altaxo.Main.Commands.AutostartCommand().Run(); #endif WorkbenchSettings workbenchSettings = new WorkbenchSettings(); workbenchSettings.RunOnNewThread = false; workbenchSettings.UseTipOfTheDay = true; for (int i = 0; i < fileList.Length; i++) { workbenchSettings.InitialFileList.Add(fileList[i]); } host.RunWorkbench(workbenchSettings); } finally { LoggingService.Info("Leaving RunApplication()"); } }