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(); }
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; } }
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); }
private void Command_New() { NewFileWindow nfWindow = new NewFileWindow(this); nfWindow.ShowDialog(); }