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 Start(ProjectSummaryViewModelBase project, Action finishedAction = null) { if (project == null || project.GetTargetProject() == null) { return; } if (!project.GetTargetProject().CanRun()) { MessageBox.Show("Project can not run, please suppliment information"); return; } project.OnPropertyChanged("IsRunning"); project.GetTargetProject().Status = ProjectStatus.Running; Task.Factory.StartNew(() => CurrentProject.GetTargetProject().Start()).ContinueWith((t) => { if (finishedAction != null) { finishedAction(); } }); project.StartObserveViewModel(); SynchroniseWindow(project); }