コード例 #1
0
ファイル: ClassificationRule.cs プロジェクト: wshanshan/DDD
 private void button1_Click(object sender, EventArgs e)
 {
     if (controller == null)
         return;
     String state = ""; 
     String classification = "";
     String icon = "";
     EditClassificationDialog dlg = new EditClassificationDialog();
     dlg.controller = this.controller;
     dlg.StateEnum.AddRange(GetStatesListBySpecies(controller, rootId, link, componentId));
     dlg.ClassificationEnum.AddRange(GetClassificationList(controller, rootId));
     dlg.IconEnum.AddRange(controller.CurrentIconLibraryIconNames());
     if (dlg.StateEnum.Count == 0)
     {
         MessageBox.Show(this, "In order to create Classification Display Rules, you'll need to define States for this Species first.");
         return;
     }
     if (dlg.ClassificationEnum.Count == 0)
     {
         MessageBox.Show(this, "In order to create Classification Display Rules, you'll need to define Classifications first.  You can do this on the Scenario Elements window, under the Players tab.");
         return;
     }
     if (dlg.IconEnum.Count == 0)
     {
         MessageBox.Show(this, "In order to create Classification Display Rules, you'll need to choose an Icon library first");
         return;
     }
     //dlg.StateName = state;
     //dlg.ClassificationName = classification;
     //dlg.IconName = icon;
     dlg.Initialize();
     if (dlg.ShowDialog(this) == DialogResult.OK)
     {
         state = dlg.StateName;
         classification = dlg.ClassificationName;
         icon = dlg.IconName;
         if (currentRules == null)
             currentRules = new ClassificationDisplayRules();
         currentRules.Rules.Add(new ClassificationDisplayRule(state, classification, icon));
         UpdateRuleInAME(currentRules);
         UpdateViewComponent();
         //DataGridViewRow row = new DataGridViewRow();
         //row.CreateCells(dataGridView1, state, classification, icon, GetImage(icon), "Edit...", "Delete");
         //dataGridView1.Rows.Add(row);
     }
     //ClassificationDisplayRule r = new ClassificationDisplayRule(state, classification, icon);
     //dataGridView1.Rows.Add(CreateRow(r));
 }
コード例 #2
0
ファイル: ClassificationRule.cs プロジェクト: wshanshan/DDD
        private void EditRule(int rowIndex)
        {
            if (dataGridView1.Rows.Count - 1 < rowIndex || rowIndex < 0)
                return;
            String state = dataGridView1.Rows[rowIndex].Cells[0].Value.ToString();
            String classification = dataGridView1.Rows[rowIndex].Cells[1].Value.ToString();
            String icon = dataGridView1.Rows[rowIndex].Cells[2].Value.ToString();

            EditClassificationDialog dlg = new EditClassificationDialog();
            dlg.controller = this.controller;
            dlg.StateEnum.AddRange(GetStatesListBySpecies(controller, rootId, link, componentId));
            List<String> s = GetClassificationList(controller, rootId);
            dlg.ClassificationEnum.AddRange(s);
            dlg.IconEnum.AddRange(controller.CurrentIconLibraryIconNames());
            dlg.StateName = state;
            dlg.ClassificationName = classification;
            dlg.IconName = icon;
            dlg.Initialize();
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                //state = dlg.StateName;
                //classification = dlg.ClassificationName;
                //icon = dlg.IconName;
                UpdateClassificationRule(classification, state, icon, dlg.ClassificationName, dlg.StateName, dlg.IconName);
                UpdateViewComponent();
                //dataGridView1.Rows[rowIndex].Cells[0].Value = state;
                //dataGridView1.Rows[rowIndex].Cells[1].Value = classification;
                //dataGridView1.Rows[rowIndex].Cells[2].Value = icon;
                //dataGridView1.Rows[rowIndex].Cells[3].Value = GetImage(icon);
            }
        }