private void RemoveRecent(object sender, ExecutedRoutedEventArgs e) { RecentProject recent = e.Parameter as RecentProject; if (recent == null) { return; } RecentProjects.Instance.Remove(recent); DoPropertyChanged("Recents"); }
public async void Open_Cmd(object sender, ExecutedRoutedEventArgs e) { string projectFileName = null; if (e.Parameter is RecentProject) { RecentProject project = e.Parameter as RecentProject; if (project.IsAvailable == false) { if (await App.MainWindow.ShowMessage( StringUtils.String("RecentProjectNotFound"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) { RecentProjects.Instance.Remove(project); DoPropertyChanged("Recents"); } return; } projectFileName = project.ProjectFile; } if (projectFileName == null) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = StringUtils.String("OpenSave_Filter"); if (dialog.ShowDialog() == true) { projectFileName = dialog.FileName; } } if (!String.IsNullOrWhiteSpace(projectFileName)) { Document newDocument = null; MainWindow.DoAsync(() => newDocument = new Document(projectFileName)); if (newDocument == null) { return; } ((MainWindow)Application.Current.MainWindow).Document = newDocument; } }
private void Open_CanCmd(object sender, CanExecuteRoutedEventArgs e) { if (e.Parameter == null) { e.CanExecute = true; return; } RecentProject project = e.Parameter as RecentProject; if (project == null) { e.CanExecute = false; return; } e.CanExecute = true; }