private void OnSelection(FileNewData fileNewData) { // Hide dialog _mainViewModel.DialogContent = null; _mainViewModel.MenuFileNew2(fileNewData); }
internal void MenuFileNew2(FileNewData fileNewData) { IModuleFileNew moduleFile = null; moduleFile = fileNewData.FileCreateModule; if (moduleFile == null) { return; } if (((IModuleFileProject)moduleFile).SpawnNewMainWindow) { // get executable path String[] cmds = Environment.GetCommandLineArgs(); FileInfo fi = new FileInfo(cmds[0]); string exefilename = cmds[0]; exefilename = exefilename.Replace(".vshost.", "."); // spawn a new process string docfilename = ""; ProcessStartInfo pinfo = new ProcessStartInfo(exefilename, docfilename); System.Diagnostics.Process.Start(pinfo); return; } var fileViewModel = moduleFile.FileNew(); return; }
public FileNewDialogViewModel(MainViewModel mainViewModel) : base("New") { _mainViewModel = mainViewModel; IconSource = CreateImageSource(@"/ProtonType.Editor;component/icons/NewDocument.png"); IconSource.Freeze(); // create list of file extensions var fileDocumentsMgr = mainViewModel.Model.FileDocumentsMgr; foreach (var fileCreateModule in fileDocumentsMgr.FileCreateModules) { foreach (var fileExtension in fileCreateModule.FileExtensions) { var fileNewList = new FileNewData(fileCreateModule, fileExtension); _fileNewList.Add(fileNewList); } } }