Пример #1
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                if (mi.Header.Equals("_New Solution"))
                {
                    //M_SolutionClass m = new M_SolutionClass("Solution_" + DateTime.Now.ToString("yyyyMMdd hh:mm:ss"), "hello");

                    //this.currentSolutionCollection.SolutionsCollection.Add(m);

                    NewSolutionWindow nsw = new NewSolutionWindow();

                    nsw.PassValuesEvent += GetValuesHandler;

                    nsw.ShowDialog();
                }
                else if (mi.Header.Equals("_Add Project to Current Solution"))
                {
                    M_ProjectClass p = new M_ProjectClass("Project_" + DateTime.Now.ToString("yyyyMMdd hh:mm:ss"), "D:\\test", "D:\\test", "hello"
                                                          , new M_VersionClass());

                    this.currentSolutionCollection.CurrentSolution.SolutionProjectsCollection.Add(p);
                }
                else if (mi.Header.Equals("_Archive Project"))
                {
                    ArchiveProjectWindow apw = new ArchiveProjectWindow(this.currentProject);

                    apw.PassValuesEvent += this.GetValuesHandler;

                    apw.ShowDialog();
                }
            }
        }
Пример #2
0
        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";
                    }
                }
            }
        }