Exemplo n.º 1
0
        public ArchiveProjectWindow(MyVersionManagementLib.M_ProjectClass project)
        {
            InitializeComponent();

            this.project = project;
        }
Exemplo n.º 2
0
        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)
        {
            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
                {
                    //
                }
            }
        }