static void Init() { ModuleWindow window = EditorWindow.GetWindow <ModuleWindow>("MaRker"); window.position = new Rect(60, 60, 280, 180); window.Show(); }
/// <summary> /// Function creating ModuleWindow object. /// Sets main control by setModule function. /// Shows window. /// </summary> /// <param name="uc">User control which will be set as main widget in ModuleWindow.</param> private void showModuleWindow(UserControl uc) { ModuleWindow mw = new ModuleWindow(); mw.setModule(uc); mw.Show(); mw.Focus(); }
public override void Stop() { log.Info("Stopping module"); if (_mainWindow != null) { log.Info("Closing module window"); _mainWindow.Close(); _mainWindow = null; } base.Stop(); }
private void ShowMainWindow() { log.Info("Initializing"); if (_mw == null) { log.Info("Instantiating module window"); _mw = _mainWindow = new ModuleWindow(Name); _mainWindow.Closed += ModuleStopping; } _mw.Show(); }
/// <summary> /// Determines whether this instance is valid. /// </summary> /// <returns> /// <c>true</c> if this instance is valid; otherwise, <c>false</c>. /// </returns> public Boolean IsValid() { var retVal = false; if (ModuleId.HasValue && ItemId.HasValue && VersionId.HasValue) { if (!ModuleName.IsNullOrEmpty() && !ModuleWindow.IsNullOrEmpty() && !ItemName.IsNullOrEmpty()) //Currently VersionName is not supported. { retVal = true; } } return(retVal); }
/// <summary> /// Fired when the user selects to create a new module /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void ModuleCallback(object sender, EventArgs e) { //var ssol = dte.Solution; //var solProjects = ssol.Projects; ////if we need to use codegen or can use our extended theme generator //bool extended = CheckFramework(solProjects); var vm = new ModuleViewModel(); var window = new ModuleWindow(vm); var success = window.ShowDialog(); if (success.GetValueOrDefault() == false) { return; } if (String.IsNullOrEmpty(vm.Name)) { FireError("You need to give your module a name!"); return; } var name = Regex.Replace(vm.Name, @"\s+", ""); IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); var templates = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "OrchardTemplates"); var solution = GetGlobalService(typeof(SVsSolution)) as IVsSolution; var envsol = dte.Solution; var path = envsol.FullName; string solpath; string solfile; string soloptions; solution.GetSolutionInfo(out solpath, out solfile, out soloptions); var projects = dte.Solution.Projects; // get the modules folder project Project modulesFolderProject = (from Project p in projects where p.Name == "Modules" select p).FirstOrDefault(); // pointless error handling if (modulesFolderProject == null) { FireError("There appears to be no Modules folder"); return; } // cast to solutionfolder object SolutionFolder modulesFolder = modulesFolderProject.Object as SolutionFolder; if (modulesFolder == null) { FireError("There appears to be no Modules folder"); return; } var newDir = Path.Combine(solpath, "Orchard.Web", "Modules", name); var newproj = modulesFolder.AddFromTemplate(Path.Combine(templates, "__BlankModule", "BlankModule.csproj"), newDir, name); // it does not edit the assembly name so we will do that ourselves EditCsProj(Path.Combine(newDir, name + ".csproj"), name); newproj.Properties.Item("AssemblyName").Value = name; // edit module.txt Insert(newDir + "\\Module.txt", new[] { new KeyValuePair <string, string>("$name$", name), }); // save our shiny new module newproj.Save(); }
/// <summary> /// Fired when the user selects to create a new module /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void ModuleCallback(object sender, EventArgs e) { //var ssol = dte.Solution; //var solProjects = ssol.Projects; ////if we need to use codegen or can use our extended theme generator //bool extended = CheckFramework(solProjects); var vm = new ModuleViewModel(); var window = new ModuleWindow(vm); var success = window.ShowDialog(); if (success.GetValueOrDefault() == false) { return; } if (String.IsNullOrEmpty(vm.Name)) { FireError("You need to give your module a name!"); return; } var name = Regex.Replace(vm.Name, @"\s+", ""); string version = vm.Version ?? vm.Versions[0]; IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); var templates = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "OrchardTemplates"); var solution = GetGlobalService(typeof(SVsSolution)) as IVsSolution; var envsol = dte.Solution; var path = envsol.FullName; string solpath; string solfile; string soloptions; solution.GetSolutionInfo(out solpath, out solfile, out soloptions); var projects = dte.Solution.Projects; // get the modules folder project Project modulesFolderProject = (from Project p in projects where p.Name == "Modules" select p).FirstOrDefault(); // pointless error handling if (modulesFolderProject == null) { FireError("There appears to be no Modules folder"); return; } // cast to solutionfolder object SolutionFolder modulesFolder = modulesFolderProject.Object as SolutionFolder; if (modulesFolder == null) { FireError("There appears to be no Modules folder"); return; } var newDir = Path.Combine(solpath, "Orchard.Web", "Modules", name); var newproj = modulesFolder.AddFromTemplate(Path.Combine(templates, "__BlankModule", version, "BlankModule.csproj"), newDir, name); // it does not edit the assembly name so we will do that ourselves Insert(Path.Combine(newDir, name + ".csproj"), new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("$$ModuleProjectGuid$$", Guid.NewGuid().ToString()), new KeyValuePair <string, string>("$$ModuleName$$", name) }); Insert(Path.Combine(newDir, "Properties", "AssemblyInfo.cs"), new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("$$ModuleTypeLibGuid$$", Guid.NewGuid().ToString()), new KeyValuePair <string, string>("$$ModuleName$$", name) }); newproj.Properties.Item("AssemblyName").Value = name; // edit module.txt Insert(newDir + "\\Module.txt", new[] { new KeyValuePair <string, string>("$$ModuleName$$", name), }); // transformer config files are created with a build action of none which will cause the build to fail after creating a module // delete these files as not particularly useful anyway in Orchard modules DeleteTransformerConfigFiles(newDir, envsol); // save our shiny new module newproj.Save(); }