Ejemplo n.º 1
0
 private void Dg_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 1)
     {
         DataGridViewComboBoxCell cb = (DataGridViewComboBoxCell)dg.Rows[e.RowIndex].Cells[1];
         if (cb.Value != null)
         {
             if (cb.Value.ToString() == "<Edit...>")
             {
                 ArrayList       L   = ConfigurationManagerForm.GetSolutionPlatform(vs);
                 EditProjectForm epf = new EditProjectForm();
                 epf.Text = "Edit Project Configurations";
                 epf.LoadPlatforms(L);
                 DialogResult r = epf.ShowDialog();
                 cb.Value = cmb.Items[2];
             }
             else if (cb.Value.ToString() == "<New...>")
             {
                 ArrayList         L   = ConfigurationManagerForm.GetSolutionPlatform(vs);
                 NewProjectConForm epf = new NewProjectConForm();
                 epf.Text = "New Project Configurations";
                 epf.LoadProject(L);
                 DialogResult r = epf.ShowDialog();
                 cb.Value = cmb.Items[2];
             }
         }
     }
     else if (e.ColumnIndex == 2)
     {
         DataGridViewComboBoxCell cd = (DataGridViewComboBoxCell)dg.Rows[e.RowIndex].Cells[2];
         if (cd.Value != null)
         {
             if (cd.Value.ToString() == "<Edit...>")
             {
                 ArrayList       L   = ConfigurationManagerForm.GetProjectPlatform(vs);
                 EditProjectForm epf = new EditProjectForm();
                 epf.Text = "Edit Platform Configurations";
                 epf.LoadPlatforms(L);
                 DialogResult r = epf.ShowDialog();
                 cd.Value = cmp.Items[2];
             }
             else if (cd.Value.ToString() == "<New...>")
             {
                 int                c   = e.RowIndex;
                 string             p   = dg.Rows[c].Tag as string;
                 VSProject          vp  = vs.GetProjectbyName(p);
                 ArrayList          L   = ConfigurationManagerForm.GetProjectPlatform(vs);
                 NewPlatformConForm epf = new NewPlatformConForm(this);
                 epf.vp   = vp;
                 epf.Text = "New Platform Configurations";
                 epf.LoadPlatforms(L);
                 DialogResult r = epf.ShowDialog();
                 cd.Value = cmp.Items[2];
             }
         }
     }
 }
Ejemplo n.º 2
0
        public void LoadConfigs(VSSolution _vs)
        {
            vs = _vs;

            LoadProjects(comboBox4);
            LoadProjects(checkedListBox1);

            ArrayList L = vs.GetSolutionPlatforms();

            pc.Items.Clear();
            sc.Items.Clear();

            foreach (string s in L)
            {
                string[] cc = s.Split("|".ToCharArray());

                if (cc.Length < 1)
                {
                    continue;
                }

                if (pc.Items.Contains(cc[0]) == false)
                {
                    pc.Items.Add(cc[0]);
                }

                if (cc.Length == 2)
                {
                    if (sc.Items.Contains(cc[1]) == false)
                    {
                        sc.Items.Add(cc[1]);
                    }
                }
            }

            pc.Items.Add("New");
            pc.Items.Add("Edit");

            L = vs.GetProjectPlatforms();

            ArrayList C = ConfigurationManagerForm.GetProjectPlatform(vs);

            LoadConfigItems(C);

            ArrayList P = ConfigurationManagerForm.GetSolutionPlatform(vs);

            LoadProjectItems(P);

            Dictionary <string, string> dict = vs.GetProjectGuids();

            foreach (string s in L)
            {
                string[] cc = s.Split(".".ToCharArray());

                string project = cc[0];

                project = project.Replace("{", "");
                project = project.Replace("}", "");

                project = project.Trim();

                if (dict.ContainsKey(project))
                {
                    dict.TryGetValue(project, out project);
                }

                string[] dd = cc[1].Split("|".ToCharArray());

                if (C.Contains(dd[1]) == false)
                {
                    continue;
                }
                if (P.Contains(dd[0]) == false)
                {
                    continue;
                }

                DataGridViewRow row = (DataGridViewRow)dg.RowTemplate.Clone();
                row.CreateCells(dg, project, dd[0], dd[1], true, true);

                row.Tag = project;

                dg.Rows.Add(row);
            }
        }