private void PassValuesEventMethod(PassValuesEventArgs args) { if (this.PassValuesEvent != null) { PassValuesEvent(this, args); } }
private void projectBtn_Click(object sender, RoutedEventArgs e) { var bt = sender as Button; if (bt != null) { if (bt.Name.Equals(this.selectLocationBtn.Name)) { System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.projectLocationTb.Text = dialog.SelectedPath; } } else if (bt.Name.Equals(this.selectWorkspaceBtn.Name)) { System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog(); dialog.Description = "Your project files will be stored here."; dialog.ShowNewFolderButton = true; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.projectWorkspaceTb.Text = dialog.SelectedPath; } } else if (bt.Name.Equals(this.okBtn.Name)) { MyVersionManagementLib.M_ProjectClass project = null; string name = this.projectNameTb.Text; string description = this.projectDescriptionTb.Text; string location = this.projectLocationTb.Text; string workspace = this.projectWorkspaceTb.Text; int main = this.mainCmb.SelectedIndex + 1; int sub = this.subCmb.SelectedIndex; int stage = this.stageCmb.SelectedIndex; MyVersionManagementLib.M_VersionClass.GreekAlphabet greek = (MyVersionManagementLib.M_VersionClass.GreekAlphabet) this.greekCmb.SelectedIndex; MyVersionManagementLib.M_VersionClass version = new MyVersionManagementLib.M_VersionClass(DateTime.Now.ToString("yyyyMMdd"), main, sub, stage, greek); bool flag; string resDescription = ""; //create a new solution if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(location) || string.IsNullOrWhiteSpace(workspace) || string.IsNullOrWhiteSpace(description)) { flag = false; resDescription = "Project Name/Location/Workspace/Description is null or whitespace."; } else { project = new MyVersionManagementLib.M_ProjectClass(name, location, workspace, description, version); flag = true; resDescription = "Project create successfully."; } PassValuesEventArgs args = new PassValuesEventArgs(project, flag, resDescription); PassValuesEvent(this, args); this.Close(); } else if (bt.Name.Equals(this.cancleBtn.Name)) { PassValuesEventArgs args = new PassValuesEventArgs(null, false, "Create project canceled."); PassValuesEvent(this, args); this.Close(); } else { // } } }
private void projectBtn_Click(object sender, RoutedEventArgs e) { var bt = sender as Button; if (bt != null) { if (bt.Name.Equals(this.viewLocationBtn.Name)) { Process.Start(this.project.ProjectLocation); //System.Windows.Forms.FolderBrowserDialog dialog = // new System.Windows.Forms.FolderBrowserDialog(); //if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) //{ // this.projectLocationTb.Text = dialog.SelectedPath; //} } else if (bt.Name.Equals(this.selectOrViewWorkspaceBtn.Name)) { System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog(); dialog.Description = "Your project files will be stored here."; dialog.ShowNewFolderButton = true; dialog.SelectedPath = this.project.ProjectWorkspace; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.projectWorkspaceTb.Text = dialog.SelectedPath; } } else if (bt.Name.Equals(this.okBtn.Name)) { //MyVersionManagementLib.M_ProjectClass project = null; //string name = this.projectNameTb.Text; //string description = this.projectDescriptionTb.Text; //string location = this.projectLocationTb.Text; //string workspace = this.projectWorkspaceTb.Text; int main = this.mainCmb.SelectedIndex; int sub = this.subCmb.SelectedIndex; int stage = this.stageCmb.SelectedIndex; MyVersionManagementLib.M_VersionClass.GreekAlphabet greek = (MyVersionManagementLib.M_VersionClass.GreekAlphabet) this.greekCmb.SelectedIndex; MyVersionManagementLib.M_VersionClass version = new MyVersionManagementLib.M_VersionClass(DateTime.Now.ToString("yyyyMMdd"), main, sub, stage, greek); bool flag; string archiveResult; string resDescription = ""; this.project.CurrentProjectVersion.VersionDescription = this.projectDescriptionTb.Text; //更新版本号,默认只更新日期版本号 if (main < 0 || sub < 0 || stage < 0 || greek < 0) { flag = false; resDescription = "Project new version NO. is not select correctly."; } else { //判断是否需要进一步更新版本号(防止出现版本号相同的情况) if (this.project.CurrentProjectVersion.Version.CompareTo(version, out resDescription) >= 0) { version.Update(out resDescription); } if (this.project.Archive(out archiveResult, version) > 0) { flag = true; resDescription = "Project Archive successfully."; } else { flag = false; resDescription = "Project Archive Failed, Details: " + archiveResult; } } PassValuesEventArgs args = new PassValuesEventArgs(project, flag, resDescription); PassValuesEventMethod(args); this.Close(); } else if (bt.Name.Equals(this.cancleBtn.Name)) { PassValuesEventArgs args = new PassValuesEventArgs(null, false, "Archive project canceled."); PassValuesEventMethod(args); this.Close(); } else { // } } }
private void GetValuesHandler(object sender, PassValuesEventArgs args) { //获取新建的解决方案 NewSolutionWindow nsw = sender as NewSolutionWindow; if (nsw != null && args != null) { bool flag = args.Flag; if (flag == true) { M_SolutionClass m = args.Result as M_SolutionClass; if (m != null) { this.currentSolutionCollection.SolutionsCollection.Add(m); } } this.otherLb.Content = args.Description; } else { NewProjectWindow npw = sender as NewProjectWindow; if (nsw != null && args != null) { bool flag = args.Flag; if (flag == true) { M_ProjectClass m = args.Result as M_ProjectClass; if (m != null) { this.currentSolution.SolutionProjectsCollection.Add(m); } } this.otherLb.Content = args.Description; } else { ArchiveProjectWindow apw = sender as ArchiveProjectWindow; if (apw != null && args != null) { //bool flag = args.Flag; //if (flag == true) //{ // M_SolutionClass m = args.Result as M_SolutionClass; // if (m != null) // { // this.currentSolutionCollection.SolutionsCollection.Add(m); // } //} this.otherLb.Content = args.Description; //更新解决方案显示 //this.currentProjectItem.Header = this.currentProject.CurrentProjectVersion.Name; } else { this.otherLb.Content = "Incorrect Sender or Invalid args"; } } } }
private void projectBtn_Click(object sender, RoutedEventArgs e) { Button bt = sender as Button; if (bt != null) { if (bt.Name.Equals(this.AddProjectBtn.Name)) { //todo NewProjectWindow npw = new NewProjectWindow(); npw.PassValuesEvent += (ss, ee) => { this.infoSbi.Content = ee.Description; if (ee.Flag == true) { MyVersionManagementLib.M_ProjectClass project = ee.Result as MyVersionManagementLib.M_ProjectClass; if (project != null) { this.projectsCollection.Add(project); } } }; npw.ShowDialog(); } else if (bt.Name.Equals(this.removeProjectBtn.Name)) { //todo if (this.projectsCollection != null && this.projectsCollection.Count > 0 && this.projectsCollectionTv.SelectedIndex >= 0) { this.projectsCollection.RemoveAt(this.projectsCollectionTv.SelectedIndex); } } else if (bt.Name.Equals(this.okBtn.Name)) { MyVersionManagementLib.M_SolutionClass solution = null; string name = this.solutoinTitleTb.Text; string description = this.solutionDescriptionTb.Text; bool flag; string resDescription = ""; //create a new solution if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(description)) { flag = false; resDescription = "Solution Name/Description is null or whitespace."; } else { solution = new MyVersionManagementLib.M_SolutionClass(name, description); if (this.projectsCollection != null && this.projectsCollection.Count > 0) { foreach (MyVersionManagementLib.M_ProjectClass p in this.projectsCollection) { solution.SolutionProjectsCollection.Add(p); } } flag = true; resDescription = "Solution create successfully."; } PassValuesEventArgs args = new PassValuesEventArgs(solution, flag, resDescription); PassValuesEvent(this, args); this.Close(); } else if (bt.Name.Equals(this.cancleBtn.Name)) { // PassValuesEventArgs args = new PassValuesEventArgs(null, false, "Create solution canceled."); PassValuesEvent(this, args); this.Close(); } else { // } } }