/// <summary> /// 试图加入 /// </summary> /// <param name="project"></param> public void Add(ProjectConfig project) { if (!ProjectList.Contains(project)) { ProjectList.Add(project); } GlobalConfig.Add(project); }
public void SaveToFile() { if (CurrentProject != null && ProjectList.Contains(CurrentProject)) { var dlg = new SaveFileDialog() { Filter = "back testing project|*.btproject|analyse project | *.alyproject |(*.*)|*.*" }; if (dlg.ShowDialog() == true) { CurrentProject.GetTargetProject().SerialObject(); CommonLib.CommonProc.SaveObjToFile(CurrentProject.GetTargetProject(), dlg.FileName); } } else { MessageBox.Show("Please select project"); } }
void Delete(ProjectSummaryViewModelBase project) { if (MessageBox.Show("Confirm delete? Press OK to delete selected item.", "Confirm", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { if (project != null && ProjectList.Contains(project)) { var w = ProjectWindowList.FirstOrDefault(v => (v.DataContext as ProjectViewModelBase).TargetSummaryVM == project); if (w != null) { if (MessageBox.Show("Project still open! Press OK to close project and delete, or press cancel to active project window.", "Confirm", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) { w.Activate(); return; } else { //ProjectWindowList.Remove(w); w.Close(); } } ProjectList.Remove(project); } } }