Example #1
0
        /// <summary>
        /// 获取当前工程的父级对象
        /// </summary>
        /// <param name="project"></param>
        private void GetProjectParents(M_ProjectClass project)
        {
            if (this.currentSolutionCollection != null &&
                this.currentSolutionCollection.SolutionsCollection != null &&
                this.currentSolutionCollection.SolutionsCollection.Count > 0)
            {
                foreach (M_SolutionClass s in this.currentSolutionCollection.SolutionsCollection)
                {
                    if (s != null &&
                        s.SolutionProjectsCollection != null &&
                        s.SolutionProjectsCollection.Count > 0)
                    {
                        foreach (M_ProjectClass p in s.SolutionProjectsCollection)
                        {
                            if (p.Equals(project))
                            {
                                this.currentSolution = s;
                                this.currentProject  = p;
                                this.currentVersion  = (this.currentProject == null)? null : this.currentProject.CurrentProjectVersion;

                                return;
                            }
                        }
                    }
                }
            }
        }
Example #2
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();
                }
            }
        }
Example #3
0
        private void TreeView_Selected(object sender, RoutedEventArgs e)
        {
            TreeView tree = sender as TreeView;

            if (tree != null)
            {
                TreeViewItem ti = e.OriginalSource as TreeViewItem;

                if (ti != null)
                {
                    ti.IsExpanded = !ti.IsExpanded;
                }

                M_SolutionClass s = tree.SelectedItem as M_SolutionClass;

                if (s != null)
                {
                    GetSolutionParents(s);

                    SetTextBoxBindings();
                }
                else
                {
                    M_ProjectClass p = tree.SelectedItem as M_ProjectClass;

                    if (p != null)
                    {
                        GetProjectParents(p);

                        SetTextBoxBindings();

                        //this.currentProjectItem = ti;
                    }
                    else
                    {
                        M_ProjectVersionClass v = tree.SelectedItem as M_ProjectVersionClass;

                        if (v != null)
                        {
                            GetProjectVersionParents(v);

                            SetTextBoxBindings();
                        }
                    }
                }
            }
        }
Example #4
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";
                    }
                }
            }
        }