public void AddTool(float toolID) { if (!ToolIsAvailable(toolID)) { AvailableTools.Add(toolID); } }
public void RemoveTool(float toolID) { if (AvailableTools.Contains(toolID)) { AvailableTools.Remove(toolID); } }
public string GetToolPath(string toolName) { string retVal = ""; var foundTool = AvailableTools.FirstOrDefault((item) => item.Name == toolName); if (foundTool != null) { retVal = foundTool.Path; } return(retVal); }
public Tool GetTool(string toolName) { Tool retVal = null; var foundTool = AvailableTools.FirstOrDefault((item) => item.Name == toolName); if (foundTool != null) { retVal = foundTool; } return(retVal); }
public bool ToolIsAvailable(float toolID) { return(AvailableTools.Contains(toolID)); }
public void ProcessRuntimeInfo() { //AutoDetectToolPath(); if (Envs != null) { foreach (var item in Envs) { string currentValue = Environment.GetEnvironmentVariable(item.Name); if (!string.IsNullOrWhiteSpace(currentValue)) { switch (item.Action) { case EnvironmentAction.Overwrite: { string newValue = ResolveValue.Inst.ResolveEnvironmentValue(item.Type, item.Value); Environment.SetEnvironmentVariable(item.Name, newValue, EnvironmentVariableTarget.Process); } break; case EnvironmentAction.Prefix: { string newValue = ResolveValue.Inst.ResolveEnvironmentValue(item.Type, item.Value) + ";" + currentValue; Environment.SetEnvironmentVariable(item.Name, newValue, EnvironmentVariableTarget.Process); } break; case EnvironmentAction.Append: { string newValue = currentValue + ";" + ResolveValue.Inst.ResolveEnvironmentValue(item.Type, item.Value); Environment.SetEnvironmentVariable(item.Name, newValue, EnvironmentVariableTarget.Process); } break; } } else { string newValue = ResolveValue.Inst.ResolveEnvironmentValue(item.Type, item.Value); Environment.SetEnvironmentVariable(item.Name, newValue, EnvironmentVariableTarget.Process); } } } if (AvailableTools == null) { AvailableTools = new List <Tool>(); } foreach (var item in Tools) { string newValue = ResolveValue.Inst.ResolveFullPath(item.Path); item.Path = newValue; newValue = ResolveValue.Inst.ResolveFullPath(item.ToolPath); item.ToolPath = newValue; Tool addTool = null; if (item.Type == ToolType.RegularApp) { if (File.Exists(item.Path)) { addTool = item; } } else { addTool = item; } if (addTool != null) { //if editor is not explicitly defined then assume tool name and editor name is same if (string.IsNullOrWhiteSpace(addTool.Editor)) { addTool.Editor = addTool.Name; } AvailableTools.Add(addTool); } } }
public bool IsToolAvailable(string toolName) { var foundTool = AvailableTools.FirstOrDefault((item) => string.Compare(item.Name, toolName, true) == 0); return(foundTool != null); }
protected override void OnViewLoaded(object view) { foreach (var module in _modules) { foreach (var globalResourceDictionary in module.GlobalResourceDictionaries) { Application.Current.Resources.MergedDictionaries.Add(globalResourceDictionary); } } foreach (var module in _modules) { module.PreInitialize(); } foreach (var module in _modules) { module.Initialize(); } // Populate our view menu with Tools var viewMenu = MainMenu.FirstOrDefault(x => (x as MainMenu.Models.TextMenuItem).Text == "_View"); if (viewMenu == null && AvailableTools.Any()) { var def = new TextMenuItemDefinition(null, 2, "_View"); viewMenu = new TextMenuItem(def); MainMenu.Insert(2, viewMenu); } foreach (var exportedTool in AvailableTools.OrderBy(t => t.Metadata.SortOrder)) { var localExport = exportedTool; viewMenu.Add(new ActionMenuItem(localExport.Metadata.DisplayName, argument => { // by using Lazy we can avoid instantiating the tool until when it is actually displayed! Caliburn.Micro.IoC.Get <IShell>().ShowTool(localExport.Value); })); } // If after initialization no theme was loaded, load the default one if (_themeManager.CurrentTheme == null) { _themeManager.SetCurrentTheme(Properties.Settings.Default.ThemeName); } _shellView = (IShellView)view; if (!HasPersistedState) { foreach (var defaultDocument in _modules.SelectMany(x => x.DefaultDocuments)) { OpenDocument(defaultDocument); } foreach (var defaultTool in _modules.SelectMany(x => x.DefaultTools)) { ShowTool((ITool)IoC.GetInstance(defaultTool, null)); } } else { _layoutItemStatePersister.LoadState(this, _shellView, StateFile); } foreach (var module in _modules) { module.PostInitialize(); } base.OnViewLoaded(view); }