private KmlFile CreateKml() { NewFileWindow newFileWindow = new NewFileWindow(); newFileWindow.ShowDialog(); return(newFileWindow.OutFile); }
private void CommandNew_Executed(object sender, ExecutedRoutedEventArgs e) { NewFileWindow dlg = new NewFileWindow(); dlg.Owner = this; if (dlg.ShowDialog().GetValueOrDefault(false)) { LoksimFile file = dlg.SelectedFile; if (_currentViewModel != null) { if (file is WeatherFile) { new MainWindow("-l3dwth").Show(); } else if (file is SkyFile) { new MainWindow("-l3dsky").Show(); } else if (file is DrivingCabFile) { new MainWindow("-l3dfst").Show(); } else { Debug.Assert(false, "Unknown File Type"); } } else { SetCtrlAndViewModel(file); } } }
private void Command_NewFromTemplate() { var nfWindow = new NewFileWindow { Owner = this, ShowInTaskbar = false }; nfWindow.ShowDialog(); }
private void BasicTerminal_Click(object sender, RoutedEventArgs e) { NewFileWindow nfw = new NewFileWindow(OutputType.terminal); if (nfw.ShowDialog() == true) { fileTabs.AddCodeFile(new CodeFile(nfw.filename, OutputType.terminal, TextType.code, Templates.terminalTemplate)); } }
private void Command_New() { NewFileWindow nfWindow = new NewFileWindow() { Owner = this, ShowInTaskbar = false }; nfWindow.ShowDialog(); }
private void File_Button_Click(object sender, RoutedEventArgs e) { var dialog = new NewFileWindow { Owner = this //Make this window the owner of the popup, so that it will show in the center. }; dialog.Show(); }
protected virtual void NewDocument() { if (_workspace == null) { _workspace = VEFModule.UnityContainer.Resolve(typeof(AbstractWorkspace), "") as AbstractWorkspace; } if (_availableNewContent.Count == 1) { IContentHandler handler = _dictionary[_availableNewContent[0]]; var openValue = handler.NewContent(_availableNewContent[0]); if (openValue == null) { return; } _workspace.Documents.Add(openValue); _workspace.ActiveDocument = openValue; } else { // throw new NotImplementedException(); NewFileWindow window = new NewFileWindow(); window.Owner = Application.Current.MainWindow; // Brush backup = _statusBar.Background; // _statusBar.Background = _newBackground; _statusBar.Text = "Select a new file"; if (Application.Current.MainWindow is MetroWindow) { window.Resources = Application.Current.MainWindow.Resources; Window win = Application.Current.MainWindow as MetroWindow; window.Resources = win.Resources; //window.GlowBrush = win.GlowBrush; //window.TitleForeground = win.TitleForeground; } window.DataContext = _availableNewContent; if (window.ShowDialog() == true) { NewContentAttribute newContent = window.NewContent; if (newContent != null) { IContentHandler handler = _dictionary[newContent]; var openValue = handler.NewContent(newContent); if (openValue != null) { _workspace.Documents.Add(openValue); _workspace.ActiveDocument = openValue; } } } // _statusBar.Background = new VEFBrush() { Brush = backup }; _statusBar.Clear(); } }
public ReferencedFileSave ShowAddNewFileDialog() { ReferencedFileSave rfs = null; NewFileWindow nfw = CreateNewFileWindow(); if (nfw.ShowDialog(MainGlueWindow.Self) == DialogResult.OK) { string name = nfw.ResultName; AssetTypeInfo resultAssetTypeInfo = nfw.ResultAssetTypeInfo; string errorMessage; string directory = null; IElement element = EditorLogic.CurrentElement; if (EditorLogic.CurrentTreeNode.IsDirectoryNode()) { directory = EditorLogic.CurrentTreeNode.GetRelativePath().Replace("/", "\\"); } var option = nfw.GetOptionFor(resultAssetTypeInfo); rfs = GlueProjectSaveExtensionMethods.AddReferencedFileSave( element, directory, name, resultAssetTypeInfo, option, out errorMessage); if (!string.IsNullOrEmpty(errorMessage)) { MessageBox.Show(errorMessage); } else if (rfs != null) { var createdFile = ProjectManager.MakeAbsolute(rfs.GetRelativePath()); if (createdFile.EndsWith(".csv")) { string location = ProjectManager.MakeAbsolute(createdFile); CsvCodeGenerator.GenerateAndSaveDataClass(rfs, AvailableDelimiters.Comma); } ElementViewWindow.UpdateChangedElements(); ElementViewWindow.SelectedNode = GlueState.Self.Find.ReferencedFileSaveTreeNode(rfs); PluginManager.ReactToNewFile(rfs); GluxCommands.Self.SaveGlux(); } } return(rfs); }
private void CreateFileOnClick(object sender, RoutedEventArgs e) { EditorFile newFile = NewFileWindow.ShowDialog(); if ((newFile is null)) { return; } new MainWindow(newFile.Path, newFile.GetType()).Show(); Close(); }
private async static void OpenCreateNewFileWindow(WorkspaceItemViewModel workspaceItem, bool isDirectory = false) { if (!workspaceItem.IsDirectory) { throw new ArgumentException("Only directories support the new file command"); } var workspace = workspaceItem.Workspace; IWorkspaceItem newItem; if (isDirectory) { newItem = await workspaceItem.Data.CreateNewDirectory(Language.Current.Get("File.New.Folder")); } else { var window = new NewFileWindow(); var viewModel = new NewFileViewModel(); await viewModel.LoadAsync(); window.DataContext = viewModel; window.Owner = Application.Current.MainWindow; if (window.ShowDialog().Value) { var sel = viewModel.Selected; newItem = await workspaceItem.Data.CreateNewFile(viewModel.Name, "." + sel.Extension, sel.Content); } else { return; } } var vm = new WorkspaceItemViewModel(workspace, workspaceItem, newItem); if (isDirectory) { vm.IsNameChanging = true; } workspaceItem.AddChild(vm); if (!isDirectory) { workspaceItem.Workspace.SelectedItem = vm; } }
private static NewFileWindow CreateNewFileWindow() { NewFileWindow nfw = new NewFileWindow(); PluginManager.AddNewFileOptions(nfw); if (GlueState.Self.CurrentElement != null) { foreach (ReferencedFileSave fileInElement in GlueState.Self.CurrentElement.ReferencedFiles) { nfw.NamedAlreadyUsed.Add(FileManager.RemovePath(FileManager.RemoveExtension(fileInElement.Name))); } } // Also add CSV files nfw.AddOption(new AssetTypeInfo("csv", "", null, "Spreadsheet (.csv)", "", "")); return(nfw); }
public BuildToolAssociation GetBuildToolAssocationAndNameFor(string fileName, out bool userCancelled, out bool userPickedNone, out string rfsName, out string extraCommandLineArguments) { userCancelled = false; userPickedNone = false; rfsName = null; BuildToolAssociation buildToolAssociation = null; string sourceExtension = FileManager.GetExtension(fileName); List <BuildToolAssociation> btaList = new List <BuildToolAssociation>(); foreach (BuildToolAssociation bta in BuildToolAssociationManager.Self.ProjectSpecificBuildTools.BuildToolList) { if (bta.SourceFileType != null && bta.SourceFileType.ToLower() == sourceExtension.ToLower()) { btaList.Add(bta); } } NewFileWindow nfw = new NewFileWindow(); nfw.ComboBoxMessage = "Which builder would you like to use for this file?"; int commandLineArgumentsId = nfw.AddTextBox("Enter extra command line arguments:"); bool showNoneOption = Elements.AvailableAssetTypes.Self.AllAssetTypes .Any(item => item.Extension == sourceExtension && string.IsNullOrEmpty(item.CustomBuildToolName)); if (showNoneOption) { nfw.AddOption("<None>"); } foreach (BuildToolAssociation bta in btaList) { nfw.AddOption(bta); } if (btaList.Count != 0) { nfw.SelectedItem = btaList[0]; } nfw.ResultName = FileManager.RemoveExtension(FileManager.RemovePath(fileName)); //DialogResult result = cbmb.ShowDialog(); DialogResult result = nfw.ShowDialog(); extraCommandLineArguments = ""; if (result == DialogResult.OK) { buildToolAssociation = nfw.SelectedItem as BuildToolAssociation; if (buildToolAssociation != null) { rfsName = nfw.ResultName; extraCommandLineArguments = nfw.GetValueFromId(commandLineArgumentsId); } else { userPickedNone = nfw.SelectedItem is string && (nfw.SelectedItem as string) == "<None>"; } } else { userCancelled = true; } return(buildToolAssociation); }
public static void Main(string[] args) { Console.SetWindowSize(160, 50); Console.SetBufferSize(160, 50); CurrentX = 0; CurrentY = 0; Console.Title = "Henja BasicGraphic Editor [Version 3.0] " + string.Join(" ", args); Redraw(true); if (args.Length == 1) { //Load a file. if (!File.Exists(args[0])) { new ErrorWindow("File not found!").Execute(); return; } Filename = args[0]; if (Filename.ToUpper().EndsWith(".DF")) { Editor = new DFEditor(); } else if (Filename.ToUpper().EndsWith(".HC")) { Editor = new HCEditor(); } else { new ErrorWindow("I don't know how to process " + Filename + ". It should end with .DF or .HC!").Execute(); return; } CurrentDocument = File.ReadAllLines(Filename); Type(); } else { //new file NewFileWindow FileWindow = new NewFileWindow(); FileWindow.Execute(); if (FileWindow.OKButton.Flag) { Filename = FileWindow.Namebox.Text; switch (FileWindow.ModeBox.SelectedItem) { case 0: Editor = new DFEditor(); if (!Filename.ToUpper().EndsWith(".DF")) { Filename += ".df"; } break; case 1: Editor = new HCEditor(); if (!Filename.ToUpper().EndsWith(".HC")) { Filename += ".hc"; } break; default: return; } CurrentDocument = Editor?.GenerateNew(FileWindow.XBox.Value, FileWindow.YBox.Value); Type(); } } RenderUtils.Pause(); }
private void Command_New() { NewFileWindow nfWindow = new NewFileWindow(this); nfWindow.ShowDialog(); }