public void Execute(object parameter) { string path = null; if (parameter != null && !File.Exists(parameter.ToString())) { MessageBox.Show("Unable to find the path, please select new path!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); parameter = null; } if (parameter == null) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "打开项目"; ofd.Filter = "gse项目文件|*.gse"; if (ofd.ShowDialog().GetValueOrDefault()) { path = ofd.FileName; } } else { path = parameter.ToString(); } if (!string.IsNullOrEmpty(path)) { TreeItem.Solution = Solution.Deserialize(path); New @new = null; if (Application.Current.MainWindow != null && Application.Current.MainWindow.GetType().Name.Equals("New")) { @new = (New)Application.Current.MainWindow; } Application.Current.MainWindow = new MainWindow(); Application.Current.MainWindow.Show(); if (@new != null) { @new.Close(); } } }