public void generateName() { using (NameDialog n = new NameDialog()) { n.EntryText = "Battlefield"; n.LabelText = "Enter the stage name. (Use \\n for a line break.)\nType just ] to launch genname.bat/genname.exe instead."; if (n.ShowDialog() == DialogResult.OK) { if (n.EntryText == "]") { generateNameExternal(); } else { if (fontSettings == null) { changeFrontStnameFont(); } if (fontSettings == null) { return; } Bitmap bmp = NameCreator.createImage(fontSettings, n.EntryText); string tempfile = TempFiles.Create(".png"); bmp.Save(tempfile); Replace(frontstname, tempfile); } } } }
protected IDocument DocumentCreator() { var dialog = new NameDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var name = dialog.EnteredText; var projectDir = FProject.Location.GetLocalDir(); var documentPath = projectDir.ConcatPath(name); var document = DocumentFactory.CreateDocumentFromFile(documentPath); if (File.Exists(document.Location.LocalPath)) { document.Load(); } else { document.Save(); } return(document); } else { return(null); } }
public override sealed void Click() { if (LabelEditor != null) { LabelEditor.BeforeLabelEdit += LabelEditor_BeforeLabelEdit; LabelEditor.AfterLabelEdit += LabelEditor_AfterLabelEdit; if (!LabelEditor.BeginEdit(Renameable)) { LabelEditor.BeforeLabelEdit -= LabelEditor_BeforeLabelEdit; LabelEditor.AfterLabelEdit -= LabelEditor_AfterLabelEdit; } } else { var diag = new NameDialog(); var nameDialog = new NameDialog(); nameDialog.Text = Renameable.Name; var result = nameDialog.ShowDialog(); if (result == DialogResult.OK) { if (Renameable.CanRenameTo(nameDialog.EnteredText)) { CommandHistory.Insert(Command.Rename(Renameable, nameDialog.EnteredText)); } } } }
public void dragDrop(object sender, DragEventArgs e) { string[] s = (string[])e.Data.GetData(DataFormats.FileDrop); this.BeginInvoke(new Action(() => { string filepath = s[0].ToLower(); if (sender == listBox1) { using (NameDialog nd = new NameDialog()) { nd.EntryText = s[0].Substring(s[0].LastIndexOf('\\') + 1); // Textbox on the dialog ("Text" is already used by C#) if (nd.ShowDialog(this) == DialogResult.OK) { if (!nd.EntryText.ToLower().EndsWith(".brstm")) { nd.EntryText += ".brstm"; // Force .brstm extension so it shows up in the list } if (string.Equals(nd.EntryText, Path.GetFileName(songPanel1.RootPath), StringComparison.InvariantCultureIgnoreCase)) { songPanel1.Close(); // in case the file is already open } SongPanel.copyBrstm(filepath, CurrentDirectory + "\\" + nd.EntryText); refreshDirectory(); } } } })); }
protected IProject ProjectCreator() { var dialog = new NameDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var name = dialog.EnteredText; var solutionDir = FSolution.Location.GetLocalDir(); var projectPath = solutionDir.ConcatPath(name).ConcatPath(name + ".csproj"); var location = new Uri(projectPath); var project = new CSProject(Path.GetFileName(location.LocalPath), location); if (File.Exists(project.Location.LocalPath)) { project.Load(); } else { project.Save(); } return(project); } else { return(null); } }
private void saveTemplate(object sender, EventArgs e) { NameDialog dialog = new NameDialog(); if (dialog.ShowDialog() == DialogResult.OK && dialog.Result != "") { Querytemplate tem = new Querytemplate(); tem.ENTITYNAME = queryEntity.QueryEntityName; tem.TEMPLATENAME = dialog.Result; tem.XMLTEXT = GetQueryXml(); queryTaemplate.Add(tem); queryTaemplate.Save(); } }
/// <summary> /// Runs create new model procedure. /// </summary> public void AddNewObjectUI() { string name = ""; while (true) { Type type = baseType; if (extraTypes.Length > 1) { if (ObjectSelector.Show(this, "Select class", "Add", extraTypes.ToDictionary(tt => tt.Name), out type)) { } else { return; } } name = NameDialog.Show(this, "Create new " + objectName + ":", "Add " + objectName, name); if (name == null) { return; } var fullPath = Path.Combine(fullSourceFolder, name + ".xml"); if (File.Exists(fullPath)) { var r = MessageBox.Show(this, string.Format("{0} '{1}' already exists", objectName, name), "Add", MessageBoxButtons.OKCancel); if (r == DialogResult.OK) { continue; } else { return; } } var newObject = Activator.CreateInstance(type); File.WriteAllText(fullPath, Misc.SaveObjectToXml(newObject, baseType, extraTypes)); RefreshFileList(); return; } }
public override sealed void Click() { var diag = new NameDialog(); var nameDialog = new NameDialog(); nameDialog.Text = Property.ValueObject.ToString(); var result = nameDialog.ShowDialog(); if (result == DialogResult.OK) { Property.SetByCommand(nameDialog.EnteredText, CommandHistory); } }
public void NewMaterial() { NameDialog nameDialog = new NameDialog(); RewriteDialog rewrite = new RewriteDialog(); DialogResult rewriteResult; if (nameDialog.ShowDialog() == DialogResult.OK) { if (Material.floor.ContainsKey(nameDialog.textBox.Text)) { do { rewriteResult = rewrite.ShowDialog(); if (rewriteResult == DialogResult.OK) { Material.floor.Remove(nameDialog.textBox.Text); Material.floor.Add(nameDialog.textBox.Text, materialEditPreview.CreateMaterial(nameDialog.textBox.Text)); break; } else if (rewriteResult == DialogResult.Retry) { nameDialog.ShowDialog(); } else if (rewriteResult == DialogResult.Cancel) { break; } } while (Material.floor.ContainsKey(nameDialog.textBox.Text)); if (rewriteResult == DialogResult.Retry) { Material.floor.Add(nameDialog.textBox.Text, materialEditPreview.CreateMaterial(nameDialog.textBox.Text)); } } else { Material.floor.Add(nameDialog.textBox.Text, materialEditPreview.CreateMaterial(nameDialog.textBox.Text)); } } nameDialog.Dispose(); rewrite.Dispose(); }
protected IProject ProjectCreator() { var dialog = new NameDialog(); if (dialog.ShowDialog() == DialogResult.OK) { var name = dialog.EnteredText; var solutionDir = Path.GetDirectoryName(FSolution.LocalPath); var projectPath = solutionDir.ConcatPath(name).ConcatPath(name + ".csproj"); var project = new CSProject(projectPath); if (!File.Exists(project.LocalPath)) { project.Save(); } return(project); } else { return(null); } }
public string NameDialog(Window parent, string title, string prompt, string initialName) { NameDialogViewModel viewModel = new NameDialogViewModel { Title = title, Prompt = prompt, Name = initialName }; Window nameDialog = new NameDialog { DataContext = viewModel, Owner = parent }; bool?dialogResult = nameDialog.ShowDialog(); return(dialogResult.HasValue && dialogResult.Value ? viewModel.Name : null); }
private void newRecipe() { NameDialog dialog = new NameDialog(); dialog.ShowDialog(); Recipes.Add(new Recipe(dialog.tbName.Text)); }
private void TagDuplicator_Click(object sender, EventArgs e) { //Prepare Group newTagGroup = null; IndexEntry last = Map.IndexEntries.Last; //Check if (SelectedEntry != null) { //Get name string tagName = string.Empty; using (NameDialog nameDlg = new NameDialog()) { //Setup nameDlg.TagName = SelectedEntry.Filename; //Show DialogResult result = DialogResult.OK; while (Map.IndexEntries.Count(i => i.Filename == nameDlg.TagName && i.Root == SelectedEntry.Root) > 0 && result == DialogResult.OK) { result = nameDlg.ShowDialog(); } //Check if (result == DialogResult.OK) { tagName = nameDlg.TagName; } else { return; } } //Initialize BinaryReader instance for the selected tag using (BinaryReader reader = SelectedEntry.TagData.CreateReader()) { //Create tag group for selected entry newTagGroup = TagLookup.CreateTagGroup(SelectedEntry.Root); //Goto tag data and read SelectedEntry.TagData.Seek((uint)SelectedEntry.PostProcessedOffset, SeekOrigin.Begin); newTagGroup.Read(reader); } //Check the root for a scenario structure tag if (SelectedEntry.Root == HaloTags.sbsp || SelectedEntry.Root == HaloTags.ltmp) { //Scenario dialog using (StructureBspSelectDialog scenarioDlg = new StructureBspSelectDialog(Map.Scenario)) if (scenarioDlg.ShowDialog() == DialogResult.OK && scenarioDlg.SelectedBlockIndex >= 0) { //Prepare ScenarioStructureTag bspTag = new ScenarioStructureTag(scenarioDlg.SelectedBlockIndex) { SourceEntry = SelectedEntry, Name = tagName, Id = last.Id, TagGroup = newTagGroup }; //Add Map.AddScenarioStructureTags(bspTag); //Reload Host.Request(this, "ReloadMap"); } } else { //Prepare Tag tag = new Tag() { SourceEntry = SelectedEntry, Name = tagName, Id = last.Id, TagGroup = newTagGroup }; //Add Map.AddTags(tag); //Reload Host.Request(this, "ReloadMap"); } } }
private void NewTagButton_Click(object sender, EventArgs e) { //Get last IndexEntry last = Map.IndexEntries.Last; if (last.Root != HaloTags.ugh_) { return; } //Prepare using (GroupDialog groupDlg = new GroupDialog()) { //Show if (groupDlg.ShowDialog() == DialogResult.OK) { using (NameDialog nameDialog = new NameDialog()) if (nameDialog.ShowDialog() == DialogResult.OK) { //Prepare string tagName = nameDialog.TagName; Group tagGroup = TagLookup.CreateTagGroup(groupDlg.SelectedGroup); //Check if (tagGroup != null) { if (groupDlg.SelectedGroup == HaloTags.ltmp || groupDlg.SelectedGroup == HaloTags.sbsp) { //Ask for which BSP index to build into using (StructureBspSelectDialog bspSelectDlg = new StructureBspSelectDialog(Map.Scenario)) if (bspSelectDlg.ShowDialog() == DialogResult.OK && bspSelectDlg.SelectedBlockIndex >= 0) { //Create tag ScenarioStructureTag tag = new ScenarioStructureTag(bspSelectDlg.SelectedBlockIndex) { TagGroup = tagGroup, Name = tagName, Id = last.Id, }; //Add Map.AddScenarioStructureTags(tag); } } else { //Create tag Tag tag = new Tag() { TagGroup = tagGroup, Name = tagName, Id = last.Id, }; //Add Map.AddTags(tag); } } //Reload Host.Request(this, "ReloadMap"); } } } }
private void saveRecipeBox() { recipeBox.RecipeGroups.Clear(); recipeBox.RecipeGroups = Recipes.ToList(); if (string.IsNullOrEmpty(recipeBox.Name)) { NameDialog nd = new NameDialog(); nd.Title = "Enter Recipe Box Name"; nd.ShowDialog(); recipeBox.Name = nd.tbName.Text; } _dataService.SaveData(recipeBox); }
/// <summary> /// Show the enter name dialog /// </summary> /// <returns>The wanted name</returns> public string ShowNameDialog() { var dialog = new NameDialog(); return(dialog.ShowDialog().Value ? dialog.UiObjectName : null); }
private void saveAsRecipeBox() { recipeBox.RecipeGroups.Clear(); recipeBox.RecipeGroups = Recipes.ToList(); NameDialog nd = new NameDialog(); nd.Title = "Enter Recipe Box Name"; nd.ShowDialog(); recipeBox.Name = nd.tbName.Text; _dataService.SaveData(recipeBox); }
public void SetUp() { _nameDialog = new NameDialog(); }