/// <summary> /// Initializes the ION instance. /// </summary> public async Task Init() { settings = new AppSettings(); defaultUnits = new IosUnits(settings); try { Log.D(this, "Starting ION init"); foreach (var im in managers) { Log.D(this, "Initializing " + im.GetType().Name); await im.InitAsync(); } var internalDir = fileManager.GetApplicationInternalDirectory(); if (internalDir.ContainsFile(FILE_WORKBENCH)) { var workbenchFile = internalDir.GetFile(FILE_WORKBENCH); currentWorkbench = await LoadWorkbenchAsync(workbenchFile); } else { currentWorkbench = new Workbench(this); } Log.D(this, "Ending ION init"); } catch (Exception e) { Log.E(this, "Failed to init ION", e); } currentAnalyzer = new Analyzer(AppState.context); }
private void cREATEAGAMEToolStripMenuItem_Click(object sender, EventArgs e) { var createAGame = new Workbench(); createAGame.MdiParent = this; createAGame.Show(); }
public void OnDestroy() { if (Bench == this) { Bench = null; } }
internal void DoInsert() { FeatureQueryOptions query = null; switch (_view.SelectedQueryMode) { case QueryMode.Aggregate: { query = (_view.QueryView as IFdoAggregateQueryView).QueryObject; } break; case QueryMode.Standard: { query = (_view.QueryView as IFdoStandardQueryView).QueryObject; } break; } if (query != null) { Workbench wb = Workbench.Instance; FdoInsertScaffold ctl = new FdoInsertScaffold(_connection, query.ClassName); wb.ShowContent(ctl, ViewRegion.Dialog); } }
private static bool CheckForAction(Workbench workbench, Farmer who, bool justCheckingForActivity) { if (justCheckingForActivity) { return(true); } if (workbench.mutex.IsLocked()) { return(true); } List <Chest> nearbyChests = new List <Chest>(); GetChests(workbench.TileLocation, who, nearbyChests); NetMutex[] mutexes = nearbyChests.Select(chest => chest.mutex).ToArray(); object multipleMutexRequest = null; void ReleaseLocks() => releaseLocksMethod.Invoke(multipleMutexRequest, new object[] { }); multipleMutexRequest = Activator.CreateInstance(multipleMutexRequestType, mutexes, (Action)(() => workbench.mutex.RequestLock((Action)(() => { Vector2 centeringOnScreen = Utility.getTopLeftPositionForCenteringOnScreen(800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2, 0, 0); Game1.activeClickableMenu = (IClickableMenu) new CraftingPage((int)centeringOnScreen.X, (int)centeringOnScreen.Y, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2, false, true, nearbyChests); Game1.activeClickableMenu.exitFunction = (IClickableMenu.onExit)(() => { workbench.mutex.ReleaseLock(); ReleaseLocks(); }); }), ReleaseLocks)), (Action)(() => Game1.showRedMessage(Game1.content.LoadString("Strings\\UI:Workbench_Chest_Warning")))); return(true); }
private void ShowMainForm(IBundleContext context) { Workbench.PostMessage(() => { try { // 引发OnMainFormShowing事件。 var args = new CancelEventArgs(); OnMainFormShowing(context, args); if (!args.Cancel) { // Show main form Workbench.ShowMainForm(); } } catch (Exception ex) { _log.Error("UI 线程出现异常,主窗口已退出,错误原因:" + ex.Message, ex); } finally { FrameworkFactory.CurrentFramework.Stop(); } }); }
private void SpawnWorkbench() { _workbench = GameManager.server.CreateEntity("assets/prefabs/deployable/tier 3 workbench/workbench3.deployed.prefab", new Vector3(0, -50, 0)) as Workbench; _workbench.enableSaving = false; _workbench.Spawn(); _workbench.GetComponent <DestroyOnGroundMissing>().enabled = false; _workbench.GetComponent <GroundWatch>().enabled = false; _workbenchTrigger = _workbench.GetComponentInChildren <TriggerWorkbench>(); foreach (var player in BasePlayer.activePlayerList) { OnPlayerInit(player); } _workbenchTrigger.name = "workbench"; timer.In(1, () => { if (_workbench == null || _workbench.IsDestroyed) { SpawnWorkbench(); } }); }
public void ExperimentComplete() { Item experimentResourceItem = this.GetExperimentResourceItem(); int scrapForExperiment = this.GetScrapForExperiment(); if (this.pendingBlueprint == null) { Debug.LogWarning("Pending blueprint was null!"); } if (experimentResourceItem != null && experimentResourceItem.amount >= scrapForExperiment && this.pendingBlueprint != null) { experimentResourceItem.UseItem(scrapForExperiment); Item item = ItemManager.Create(Workbench.GetBlueprintTemplate(), 1, (ulong)0); item.blueprintTarget = this.pendingBlueprint.itemid; this.creatingBlueprint = true; if (!item.MoveToContainer(this.inventory, 0, true)) { item.Drop(this.GetDropPosition(), this.GetDropVelocity(), new Quaternion()); } this.creatingBlueprint = false; if (this.experimentSuccessEffect.isValid) { Effect.server.Run(this.experimentSuccessEffect.resourcePath, this, 0, Vector3.zero, Vector3.zero, null, false); } } base.SetFlag(BaseEntity.Flags.On, false, false, true); this.pendingBlueprint = null; this.inventory.SetLocked(false); base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); }
void Run(string[] args) { SharpSnippetCompilerManager.Init(); app = new App(); SD.Services.AddService(typeof(IMessageLoop), new DispatcherMessageLoop(app.Dispatcher, SynchronizationContext.Current)); mainWindow = new MainWindow(); var workbench = new Workbench(mainWindow); InitializeWorkbench(workbench, new WorkbenchLayout()); ViewModels.MainViewModel.AddInitialPads(); SnippetCompilerProject.Load(); IProject project = GetCurrentProject(); ProjectService.CurrentProject = project; LoadFiles(project); try { app.Run(SD.Workbench.MainWindow); } finally { try { // Save properties //PropertyService.Save(); } catch (Exception ex) { MessageService.ShowException(ex, "Properties could not be saved."); } } }
public override void ServerInit() { base.ServerInit(); Workbench workbench = this; this.inventory.canAcceptItem = new Func <Item, int, bool>(workbench.ItemFilter); }
public override void Run() { Workbench wb = Workbench.Instance; CreateShpCtl ctl = new CreateShpCtl(); wb.ShowContent(ctl, ViewRegion.Dialog); }
void UpdateActiveView(IViewContent view) { Workbench workbench = SD.Workbench as Workbench; workbench.ActiveViewContent = view; workbench.ActiveContent = view; }
public void ExperimentComplete() { Item experimentResourceItem = this.GetExperimentResourceItem(); int scrapForExperiment = this.GetScrapForExperiment(); if (Object.op_Equality((Object)this.pendingBlueprint, (Object)null)) { Debug.LogWarning((object)"Pending blueprint was null!"); } if (experimentResourceItem != null && experimentResourceItem.amount >= scrapForExperiment && Object.op_Inequality((Object)this.pendingBlueprint, (Object)null)) { experimentResourceItem.UseItem(scrapForExperiment); Item obj = ItemManager.Create(Workbench.GetBlueprintTemplate(), 1, 0UL); obj.blueprintTarget = this.pendingBlueprint.itemid; this.creatingBlueprint = true; if (!obj.MoveToContainer(this.inventory, 0, true)) { obj.Drop(this.GetDropPosition(), this.GetDropVelocity(), (Quaternion)null); } this.creatingBlueprint = false; if (this.experimentSuccessEffect.isValid) { Effect.server.Run(this.experimentSuccessEffect.resourcePath, (BaseEntity)this, 0U, Vector3.get_zero(), Vector3.get_zero(), (Connection)null, false); } } this.SetFlag(BaseEntity.Flags.On, false, false, true); this.pendingBlueprint = (ItemDefinition)null; this.inventory.SetLocked(false); this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); }
private static void ToggleBeamAnimation(Workbench workbench, bool active) { workbench.GetData().animatingBeams = active; try { workbench.workingLight.SetActive(active); workbench.animator.SetBool(AnimatorHashID.working, active); var sparks = (GameObject[])sparksField.GetValue(workbench); var beams = workbench.fxLaserBeam; for (var i = 0; i < beams.Length; i++) { beams[i].SetActive(active); var ps = sparks[i].GetComponent <ParticleSystem>(); if (active) { ps.Play(); } else { ps.Stop(); } } } catch (Exception e) { AGLogger.ExceptionOnce(e); } }
public static Document OpenDocument(this Workbench workbench, Widget widget, string contentId, bool bringToFront) { string id = string.IsNullOrWhiteSpace(contentId) ? widget.GetType().Name : contentId; Document document; if (workbench.TryFindDocumentByContentId(id, out document)) { document.Window.SelectWindow(); } else { document = workbench.OpenDocument(new ViewOnlyViewContent(widget, id), bringToFront); } return(document); // foreach (var document in IdeApp.Workbench.Documents) // { // var vc = document.Window.ViewContent; // if (vc is ViewOnlyViewContent && ((ViewOnlyViewContent)vc).ContentId == id) // { // document.Window.SelectWindow(); // return document; // } // } // return IdeApp.Workbench.OpenDocument(new ViewOnlyViewContent(widget, id), bringToFront); }
public override void Run() { Workbench wb = Workbench.Instance; if (wb != null) { TreeNode node = wb.ObjectExplorer.GetSelectedNode(); TreeNode connNode = wb.ObjectExplorer.GetSelectedNode(); while (connNode.Level > 1) { connNode = connNode.Parent; } FdoConnectionManager mgr = ServiceManager.Instance.GetService <FdoConnectionManager>(); FdoConnection conn = mgr.GetConnection(connNode.Name); FdoDataPreviewCtl ctl = null; if (node.Level > 1) //Class node { ctl = new FdoDataPreviewCtl(conn, node.Parent.Name, node.Name); } else { ctl = new FdoDataPreviewCtl(conn); } wb.ShowContent(ctl, ViewRegion.Document); } }
public ManifoldViewHolder(SwipeRecyclerView parent, BitmapCache cache, Workbench workbench) : base(parent, Resource.Layout.list_item_viewer, Resource.Layout.view_delete) { this.cache = cache; name = foreground.FindViewById <TextView>(Resource.Id.name); status = foreground.FindViewById <TextView>(Resource.Id.status); measurement = foreground.FindViewById <TextView>(Resource.Id.measurement); measurement.Tag = new Java.Lang.String("Measurement"); unit = foreground.FindViewById <TextView>(Resource.Id.unit); alarm = foreground.FindViewById(Resource.Id.alarm); icon = foreground.FindViewById <ImageView>(Resource.Id.icon); battery = foreground.FindViewById <ImageView>(Resource.Id.battery); connection = foreground.FindViewById <ImageView>(Resource.Id.connection); progress = foreground.FindViewById <ProgressBar>(Resource.Id.progress); lastBattery = -1; var button = background as Button; button.SetText(Resource.String.remove); button.SetOnClickListener(new ViewClickAction((view) => { workbench.Remove(record.manifold); })); }
private static bool TryCreateModParticleParams(Workbench workbench) { if (modParticlesParams != null) { return(true); } try { var sparks = ((GameObject[])sparksField.GetValue(workbench))[0].GetComponent <ParticleSystem>(); originParticlesParams = new ParticleSystemParameters() { startColor = sparks.main.startColor }; modParticlesParams = new ParticleSystemParameters() { startColor = Config.BeamAlphaColor }; return(true); } catch (Exception e) { Logger.Log(Logger.Level.Error, null, e); return(false); } }
void UpdateActiveView(IViewContent view) { Workbench workbench = WorkbenchSingleton.Workbench as Workbench; workbench.ActiveViewContent = view; workbench.ActiveContent = view; }
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."); } } }
protected override void ExecuteImpl() { GroupInfo gi = GroupInfoManager.FindGroup(m_groupKey); UserInfo user = UserInfoManager.FindUser(m_remoteIP); Workbench.GroupAddUser(gi, user); }
public EmitterSettingsController(ImGuiManager imGuiManager, SettingsCommandHandler commandHandler, ApplicationState applicationState, AppOperationQueue appOperationQueue, ITextureFileLoader textureFileLoader, MonoGameImGuiRenderer monoGameImGuiRenderer) { _commandHandler = commandHandler; _applicationState = applicationState; _appOperationQueue = appOperationQueue; _textureFileLoader = textureFileLoader; _monoGameImGuiRenderer = monoGameImGuiRenderer; _workbench = new Workbench(commandHandler) { IsVisible = false }; imGuiManager.AddElement(_workbench); _activeEditorWindow = new ActiveEditorWindow() { IsVisible = false }; imGuiManager.AddElement(_activeEditorWindow); _workbench.PropertyChanged += WorkbenchOnPropertyChanged; _workbench.ModifierRemovalRequested += WorkbenchOnModifierRemovalRequested; }
protected override void Run(Workbench workbench, ILogger logger) { int width = FindUnnamedParameter(0).Values[0].ToInt32(); int color = FindNamedParameter("--color").Values[0].ToInt32(); if (width < 1) { logger?.Log("Invalid palette width.", LogLevel.Error); return; } if (workbench.PaletteSet.Count == 0) { logger?.Log("No palettes to pad. Creating 1 palette based on current bitmap format.", LogLevel.Information); Palette pal = new Palette(workbench.BitmapFormat, -1); workbench.PaletteSet.Add(pal); } int addedColors = 0; foreach (PaletteEntry pe in workbench.PaletteSet) { while (pe.Palette.Count < width) { pe.Palette.Add(color); addedColors++; } } logger?.Log("Padded palettes to width " + width + " (added " + addedColors + " colors).", LogLevel.Information); }
private static bool Prefix(Workbench __instance) { var workbench = __instance; baseLateUpdate(workbench); var data = workbench.GetData(); data.beamTimer += Time.deltaTime; var animationDelay = (float)spawnAnimationDelayField.GetValue(workbench); if (workbench.logic) { var targetState = workbench.logic.inProgress && (data.beamTimer > animationDelay); if (targetState != data.animatingBeams) { ToggleBeamAnimation(workbench, targetState); } } if (data.animatingBeams) { UpdateAnimation(workbench); } return(false); }
protected override void Run(Workbench workbench, ILogger logger) { int width = workbench.PaletteSet.Max(pe => pe.Palette.Count); workbench.Stream.SetLength(0); int colors = 0; foreach (PaletteEntry pe in workbench.PaletteSet) { Palette pal = pe.Palette; int bpc = (pal.Format.Bits + 7) / 8; for (int i = 0; i < width; i++) { int c = i < pal.Count ? pal[i] : 0; for (int j = 0; j < bpc; j++) { workbench.Stream.WriteByte((byte)(c & 0xFF)); c >>= 8; } colors++; } } logger?.Log("Serialized " + width + "x" + workbench.PaletteSet.Count + " palette set (" + colors + " colors).", LogLevel.Information); }
[NoLeak("MonoDevelop.TextEditor.CocoaTextViewContent")] // MD part of the chain. public void Run() { if (firstRun) { Workbench.OpenWorkspace(SolutionFileName); firstRun = false; } RunTypingTest(); // Rebuild. WorkbenchExtensions.RebuildSolution(); // Debug. WorkbenchExtensions.Debug(); // Force focus of text editor. Otherwise the text editor is not // properly focused after the debug session finishes - the caret // does not blink and TextEditorCommands no longer work. // AutoTestClientSession.EnterText works without needing to // focus the workbench. WorkbenchExtensions.GrabDesktopFocus(); // Close all documents. WorkbenchExtensions.CloseAllOpenFiles(); UserInterfaceTests.Ide.WaitForIdeIdle(); }
public override void Run() { ConnectSqlServerCtl ctl = new ConnectSqlServerCtl(); Workbench wb = Workbench.Instance; wb.ShowContent(ctl, ViewRegion.Dialog); }
private void DoDelete(Workbench wb, OSGeo.MapGuide.MaestroAPI.Services.IResourceService resSvc, RepositoryItem[] items) { var pdlg = new ProgressDialog(); pdlg.CancelAbortsThread = true; string[] args = new string[items.Length]; for (int i = 0; i < items.Length; i++) { args[i] = items[i].ResourceId; } var work = new Maestro.Shared.UI.ProgressDialog.DoBackgroundWork((worker, e, target) => { int deleted = 0; if (target == null || target.Length == 0) { return(deleted); } int step = 100 / target.Length; int current = 0; foreach (RepositoryItem item in target) { if (worker.CancellationPending || e.Cancel) { return(deleted); } current += step; if (item.IsRoot) //Wait a minute...! { continue; } else { resSvc.DeleteResource(item.ResourceId); deleted++; worker.ReportProgress(current, item.ResourceId); } } //collect affected parents and update the model foreach (RepositoryItem item in target) { var parent = item.Parent; if (parent != null) { parent.RemoveChild(item); } } return(deleted); }); pdlg.RunOperationAsync(wb, work, items); }
public static bool checkForAction_Prefix(Workbench __instance, Farmer who, bool justCheckingForActivity, ref bool __result) { try { ModEntry mod = ModEntry.Instance; if (mod.Config.ReplaceCrafting && !(mod.Config.SuppressBC?.IsDown() ?? false)) { if (justCheckingForActivity) { __result = true; return(false); } Game1.activeClickableMenu = Menus.BetterCraftingPage.Open( mod, who.currentLocation, __instance.TileLocation, standalone_menu: true, material_containers: (IList <object>?)null ); return(false); } } catch (Exception ex) { Monitor?.Log("An error occurred while attempting to interact with a Workbench.", LogLevel.Warn); Monitor?.Log($"Details:\n{ex}", LogLevel.Warn); } return(true); }
//this method is MIT/X11, 2009, Michael Hutchinson / (c) Novell public static async void OpenFiles(IEnumerable <FileOpenInformation> files) { if (!files.Any()) { return; } if (!IsInitialized) { EventHandler onInit = null; onInit = delegate { Initialized -= onInit; OpenFiles(files); }; Initialized += onInit; return; } var filteredFiles = new List <FileOpenInformation> (); bool closeCurrent = true; foreach (var file in files) { if (Services.ProjectService.IsWorkspaceItemFile(file.FileName) || Services.ProjectService.IsSolutionItemFile(file.FileName)) { try { // Close the current solution, but only for the first solution we open. // If more than one solution is specified in the list we want to open all them together. await Workspace.OpenWorkspaceItem(file.FileName, closeCurrent); closeCurrent = false; } catch (Exception ex) { MessageService.ShowError(GettextCatalog.GetString("Could not load solution: {0}", file.FileName), ex); } } else { filteredFiles.Add(file); } } // Wait for active load operations to be finished (there might be a solution already being loaded // when OpenFiles was called). This will ensure that files opened as part of the solution status // restoration won't steal the focus from the files we are explicitly loading here. await Workspace.CurrentWorkspaceLoadTask; foreach (var file in filteredFiles) { Workbench.OpenDocument(file.FileName, null, file.Line, file.Column, file.Options).ContinueWith(t => { if (t.IsFaulted) { MessageService.ShowError(GettextCatalog.GetString("Could not open file: {0}", file.FileName), t.Exception); } }, TaskScheduler.FromCurrentSynchronizationContext()).Ignore(); } Workbench.Present(); }
private static void DoRepointResource(Workbench wb, IServerConnection conn, ResourceIdentifier resId) { var diag = new RepointerDialog(resId, conn.ResourceService); if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string srcId = diag.Source; string dstId = diag.Target; var deps = diag.Dependents; ProgressDialog.DoBackgroundWork worker = (wk, e, args) => { int updated = 0; int total = deps.Count; wk.ReportProgress(0, Strings.ProgressUpdatingReferences); foreach (var dep in deps) { using (var stream = conn.ResourceService.GetResourceXmlData(dep)) { XmlDocument doc = new XmlDocument(); doc.Load(stream); bool changed = Utility.ReplaceResourceIds(doc, srcId, dstId); if (changed) { using (var ms = new MemoryStream()) { doc.Save(ms); ms.Position = 0L; //Rewind conn.ResourceService.SetResourceXmlData(dep, ms); } updated++; wk.ReportProgress((updated / total) * 100); } } } return updated; }; var prd = new ProgressDialog(); int result = (int)prd.RunOperationAsync(wb, worker); MessageService.ShowMessage(string.Format(Strings.ResourcesRepointed, result, dstId)); } }
public static void Initialize (IProgressMonitor monitor) { Counters.Initialization.Trace ("Creating Workbench"); workbench = new Workbench (); Counters.Initialization.Trace ("Creating Root Workspace"); workspace = new RootWorkspace (); Counters.Initialization.Trace ("Creating Services"); projectOperations = new ProjectOperations (); helpOperations = new HelpOperations (); commandService = new CommandManager (); ideServices = new IdeServices (); CustomToolService.Init (); AutoTestService.Start (commandService, Preferences.EnableAutomatedTesting); commandService.CommandTargetScanStarted += CommandServiceCommandTargetScanStarted; commandService.CommandTargetScanFinished += CommandServiceCommandTargetScanFinished; KeyBindingService.LoadBindingsFromExtensionPath ("/MonoDevelop/Ide/KeyBindingSchemes"); KeyBindingService.LoadCurrentBindings ("MD2"); commandService.CommandError += delegate (object sender, CommandErrorArgs args) { MessageService.ShowException (args.Exception, args.ErrorMessage); }; FileService.ErrorHandler = FileServiceErrorHandler; monitor.BeginTask (GettextCatalog.GetString("Loading Workbench"), 5); Counters.Initialization.Trace ("Loading Commands"); commandService.LoadCommands ("/MonoDevelop/Ide/Commands"); monitor.Step (1); Counters.Initialization.Trace ("Initializing Workbench"); workbench.Initialize (monitor); monitor.Step (1); InternalLog.EnableErrorNotification (); monitor.Step (1); Counters.Initialization.Trace ("Restoring Workbench State"); workbench.Show ("SharpDevelop.Workbench.WorkbenchMemento"); monitor.Step (1); Counters.Initialization.Trace ("Flushing GUI events"); DispatchService.RunPendingEvents (); Counters.Initialization.Trace ("Flushed GUI events"); MessageService.RootWindow = workbench.RootWindow; commandService.EnableIdleUpdate = true; // Default file format MonoDevelop.Projects.Services.ProjectServiceLoaded += delegate(object sender, EventArgs e) { ((ProjectService)sender).DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat; }; IdeApp.Preferences.DefaultProjectFileFormatChanged += delegate { IdeApp.Services.ProjectService.DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat; }; // Perser service initialization MonoDevelop.Projects.Dom.Parser.ProjectDomService.TrackFileChanges = true; MonoDevelop.Projects.Dom.Parser.ProjectDomService.ParseProgressMonitorFactory = new ParseProgressMonitorFactory (); // Startup commands Counters.Initialization.Trace ("Running Startup Commands"); AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/StartupHandlers", OnExtensionChanged); monitor.EndTask (); // Set initial run flags Counters.Initialization.Trace ("Upgrading Settings"); if (PropertyService.Get("MonoDevelop.Core.FirstRun", false)) { isInitialRun = true; PropertyService.Set ("MonoDevelop.Core.FirstRun", false); PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildVariables.PackageVersion); PropertyService.Set ("MonoDevelop.Core.LastRunVersion", CurrentRevision); PropertyService.SaveProperties (); } string lastVersion = PropertyService.Get ("MonoDevelop.Core.LastRunVersion", "1.9.1"); int lastRevision = PropertyService.Get ("MonoDevelop.Core.LastRunRevision", 0); if (lastRevision != CurrentRevision && !isInitialRun) { isInitialRunAfterUpgrade = true; if (lastRevision == 0) { switch (lastVersion) { case "1.0": lastRevision = 1; break; case "2.0": lastRevision = 2; break; case "2.2": lastRevision = 3; break; case "2.2.1": lastRevision = 4; break; } } upgradedFromRevision = lastRevision; PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildVariables.PackageVersion); PropertyService.Set ("MonoDevelop.Core.LastRunRevision", CurrentRevision); PropertyService.SaveProperties (); } // The ide is now initialized isInitialized = true; if (isInitialRun) { try { OnInitialRun (); } catch (Exception e) { LoggingService.LogError ("Error found while initializing the IDE", e); } } if (isInitialRunAfterUpgrade) { try { OnUpgraded (upgradedFromRevision); } catch (Exception e) { LoggingService.LogError ("Error found while initializing the IDE", e); } } if (initializedEvent != null) initializedEvent (null, EventArgs.Empty); // load previous combine if ((bool)PropertyService.Get("SharpDevelop.LoadPrevProjectOnStartup", false)) { RecentOpen recentOpen = Workbench.RecentOpen; if (recentOpen.RecentProjectsCount > 0) { IdeApp.Workspace.OpenWorkspaceItem(recentOpen.RecentProjects.First ().ToString()).WaitForCompleted (); } } commandService.CommandSelected += OnCommandSelected; commandService.CommandDeselected += OnCommandDeselected; //FIXME: we should really make this on-demand. consumers can display a "loading help cache" message like VS MonoDevelop.Projects.HelpService.AsyncInitialize (); UpdateInstrumentationIcon (); IdeApp.Preferences.EnableInstrumentationChanged += delegate { UpdateInstrumentationIcon (); }; AutoTestService.NotifyEvent ("MonoDevelop.Ide.IdeStart"); }
public static void InitializeWorkbench() { instance = new Workbench(); }
private void DoDelete(Workbench wb, OSGeo.MapGuide.MaestroAPI.Services.IResourceService resSvc, RepositoryItem[] items) { var pdlg = new ProgressDialog(); pdlg.CancelAbortsThread = true; string[] args = new string[items.Length]; for (int i = 0; i < items.Length; i++) { args[i] = items[i].ResourceId; } var work = new Maestro.Shared.UI.ProgressDialog.DoBackgroundWork((worker, e, target) => { int deleted = 0; if (target == null || target.Length == 0) return deleted; int step = 100 / target.Length; int current = 0; foreach (RepositoryItem item in target) { if (worker.CancellationPending || e.Cancel) return deleted; current += step; if (item.IsRoot) //Wait a minute...! { continue; } else { resSvc.DeleteResource(item.ResourceId); deleted++; worker.ReportProgress(current, item.ResourceId); } } //collect affected parents and update the model foreach (RepositoryItem item in target) { var parent = item.Parent; if (parent != null) { parent.RemoveChild(item); } } return deleted; }); pdlg.RunOperationAsync(wb, work, items); }
public static void Initialize (ProgressMonitor monitor) { // Already done in IdeSetup, but called again since unit tests don't use IdeSetup. DispatchService.Initialize (); Counters.Initialization.Trace ("Creating Workbench"); workbench = new Workbench (); Counters.Initialization.Trace ("Creating Root Workspace"); workspace = new RootWorkspace (); Counters.Initialization.Trace ("Creating Services"); projectOperations = new ProjectOperations (); helpOperations = new HelpOperations (); commandService = new CommandManager (); ideServices = new IdeServices (); CustomToolService.Init (); commandService.CommandTargetScanStarted += CommandServiceCommandTargetScanStarted; commandService.CommandTargetScanFinished += CommandServiceCommandTargetScanFinished; commandService.KeyBindingFailed += KeyBindingFailed; KeyBindingService.LoadBindingsFromExtensionPath ("/MonoDevelop/Ide/KeyBindingSchemes"); KeyBindingService.LoadCurrentBindings ("MD2"); commandService.CommandError += delegate (object sender, CommandErrorArgs args) { LoggingService.LogInternalError (args.ErrorMessage, args.Exception); }; FileService.ErrorHandler = FileServiceErrorHandler; monitor.BeginTask (GettextCatalog.GetString("Loading Workbench"), 5); Counters.Initialization.Trace ("Loading Commands"); commandService.LoadCommands ("/MonoDevelop/Ide/Commands"); monitor.Step (1); Counters.Initialization.Trace ("Initializing Workbench"); workbench.Initialize (monitor); monitor.Step (1); MonoDevelop.Ide.WelcomePage.WelcomePageService.Initialize (); MonoDevelop.Ide.WelcomePage.WelcomePageService.ShowWelcomePage (); monitor.Step (1); Counters.Initialization.Trace ("Restoring Workbench State"); workbench.Show ("SharpDevelop.Workbench.WorkbenchMemento"); monitor.Step (1); Counters.Initialization.Trace ("Flushing GUI events"); DispatchService.RunPendingEvents (); Counters.Initialization.Trace ("Flushed GUI events"); MessageService.RootWindow = workbench.RootWindow; commandService.EnableIdleUpdate = true; // Perser service initialization TypeSystemService.TrackFileChanges = true; if (Customizer != null) Customizer.OnIdeInitialized (); // Startup commands Counters.Initialization.Trace ("Running Startup Commands"); AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/StartupHandlers", OnExtensionChanged); monitor.Step (1); monitor.EndTask (); // Set initial run flags Counters.Initialization.Trace ("Upgrading Settings"); if (PropertyService.Get("MonoDevelop.Core.FirstRun", false)) { isInitialRun = true; PropertyService.Set ("MonoDevelop.Core.FirstRun", false); PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildInfo.Version); PropertyService.Set ("MonoDevelop.Core.LastRunRevision", CurrentRevision); PropertyService.SaveProperties (); } string lastVersion = PropertyService.Get ("MonoDevelop.Core.LastRunVersion", "1.9.1"); int lastRevision = PropertyService.Get ("MonoDevelop.Core.LastRunRevision", 0); if (lastRevision != CurrentRevision && !isInitialRun) { isInitialRunAfterUpgrade = true; if (lastRevision == 0) { switch (lastVersion) { case "1.0": lastRevision = 1; break; case "2.0": lastRevision = 2; break; case "2.2": lastRevision = 3; break; case "2.2.1": lastRevision = 4; break; } } upgradedFromRevision = lastRevision; PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildInfo.Version); PropertyService.Set ("MonoDevelop.Core.LastRunRevision", CurrentRevision); PropertyService.SaveProperties (); } // The ide is now initialized isInitialized = true; if (isInitialRun) { try { OnInitialRun (); } catch (Exception e) { LoggingService.LogError ("Error found while initializing the IDE", e); } } if (isInitialRunAfterUpgrade) { try { OnUpgraded (upgradedFromRevision); } catch (Exception e) { LoggingService.LogError ("Error found while initializing the IDE", e); } } if (initializedEvent != null) { initializedEvent (null, EventArgs.Empty); initializedEvent = null; } //FIXME: we should really make this on-demand. consumers can display a "loading help cache" message like VS MonoDevelop.Projects.HelpService.AsyncInitialize (); UpdateInstrumentationIcon (); IdeApp.Preferences.EnableInstrumentation.Changed += delegate { UpdateInstrumentationIcon (); }; AutoTestService.Start (commandService, Preferences.EnableAutomatedTesting); AutoTestService.NotifyEvent ("MonoDevelop.Ide.IdeStart"); Gtk.LinkButton.SetUriHook ((button, uri) => Xwt.Desktop.OpenUrl (uri)); }