public FileListVM(OpenFileListVM owner, FileList fileList, bool isExistingList, bool isUserList) { this.owner = owner; this.fileList = fileList; this.isExistingList = isExistingList; this.isUserList = isUserList; }
public override void Execute(IMenuItemContext context) { if (!fileListLoader.CanLoad) return; fileListLoader.SaveCurrentFilesToList(); var win = new OpenFileListDlg(); const bool syntaxHighlight = true; var vm = new OpenFileListVM(syntaxHighlight, fileListManager, labelMsg => messageBoxManager.Ask<string>(labelMsg, ownerWindow: win, verifier: s => string.IsNullOrEmpty(s) ? dnSpy_Resources.OpenList_MissingName : string.Empty)); win.DataContext = vm; win.Owner = appWindow.MainWindow; if (win.ShowDialog() != true) return; var flvm = win.SelectedItems.FirstOrDefault(); var oldSelected = fileListManager.SelectedFileList; if (flvm != null) { fileListLoader.SaveCurrentFilesToList(); fileListManager.Add(flvm.FileList); fileListManager.SelectedFileList = flvm.FileList; } vm.Save(); if (flvm == null) return; var fileList = flvm.FileList; if (fileList == oldSelected) return; fileListLoader.Load(fileList, new FileLoader(fileManager, appWindow.MainWindow)); }