private void btnMDAdd_Click(object sender, EventArgs e)
        {
            switch (cEditor.Description)
            {
            case strDevType:
                sysTreeDevelopment sd = bs_sysTreeDevelopment.Current as sysTreeDevelopment;
                if (sd != null)
                {
                    sysDevelopment newdev = new sysDevelopment("", "", sd);
                    bs_sysTreeDevelopment_CurrentChanged(this, null);
                    bs_sysDevelopment.ResetBindings(false);
                    bs_sysDevelopment.Position = bs_sysDevelopment.IndexOf(newdev);
                }
                break;

            case strStatGroup:
                sysTreeStatistic st = bs_sysTreeStatistic.Current as sysTreeStatistic;
                if (st != null)
                {
                    sysBaseStatistic newstat = new sysBaseStatistic("", "", st);
                    bs_sysTreeStatistic_CurrentChanged(this, null);
                    bs_sysStatistic.ResetBindings(false);
                    bs_sysStatistic.Position = bs_sysStatistic.IndexOf(newstat);
                }
                break;
            }
        }
        private void UpdateMasterDetailPath()
        {
            nwdbTree cat;

            switch (cEditor.Description)
            {
            case strDevType:
                if (bs_sysDevelopment.Current != null)
                {
                    sysDevelopment sd = bs_sysDevelopment.Current as sysDevelopment;
                    cat = sd.DevelopmentGroup;
                    lblMasterPath.Text = cat.Path("\\") + "\\" + sd.Name;
                }
                break;

            case strStatGroup:
                if (bs_sysStatistic.Current != null)
                {
                    sysBaseStatistic st = bs_sysStatistic.Current as sysBaseStatistic;
                    cat = st.StatisticGroup;
                    lblMasterPath.Text = cat.Path("\\") + "\\" + st.Name;
                }
                break;

            case strMilestoneTree:
                if (bs_nwMilestone.Current != null)
                {
                    campMilestone sm = bs_nwMilestone.Current as campMilestone;
                    cat = sm.Type;
                    lblMasterPath.Text = cat.Path("\\") + "\\" + sm.Name;
                }
                break;
            }
            //;
        }
        private void bs_sysStat_CurrentChanged(object sender, EventArgs e)
        {
            if (bs_sysStatistic.Current == null)
            {
                return;
            }
            sysBaseStatistic st = bs_sysStatistic.Current as sysBaseStatistic;

            bs_statStacking.DataSource = st.StackingTypes;
        }
Exemple #4
0
 public hostCharStat(sysBaseStatistic s, hostChar c, int v)
 {
     this.stat = s;
     if (v == 0)
     {
         v = s.defvalue;
     }
     this.value = v;
     character  = c;
     if (this.value < s.min || this.value > s.max)
     {
         throw new ApplicationException("System Stat out of range," + s.LongName + " =" + v.ToString());
     }
 }
        private void btnMDChangePath_Click(object sender, EventArgs e)
        {
            switch (cEditor.Description)
            {
            case strDevType:
                sysDevelopment     sd       = bs_sysDevelopment.Current as sysDevelopment;
                sysTreeDevelopment selected = treeman.Select <sysTreeDevelopment>(sess, sd.DevelopmentGroup) as sysTreeDevelopment;
                sysTreeDevelopment original = sd.DevelopmentGroup;
                if (selected != sd.DevelopmentGroup)
                {
                    sd.DevelopmentGroup = selected;
                    //Repository.Save(sd);
                    //UpdateMasterDetailPath();
                    original.Paths.Remove(sd);
                    selected.Paths.Add(sd);
                    treeMasterDetail.SelectedNode = treeMasterDetail.Nodes[treeMasterDetail.Nodes.IndexOfKey(selected.Name)];
                    lboxMDDetails.SelectedIndex   = lboxMDDetails.FindStringExact(sd.LongName);
                    //PaintMasterDetail();
                }
                break;

            case strStatGroup:
                sysBaseStatistic st   = bs_sysStatistic.Current as sysBaseStatistic;
                sysTreeStatistic sel  = treeman.Select <sysTreeStatistic>(sess, st.StatisticGroup) as sysTreeStatistic;
                sysTreeStatistic orig = st.StatisticGroup;
                if (sel != st.StatisticGroup)
                {
                    st.StatisticGroup = sel;
                    //Repository.Save(st);
                    //UpdateMasterDetailPath();
                    //refreshBindings();

                    orig.Statistics.Remove(st);
                    sel.Statistics.Add(st);
                    treeMasterDetail.SelectedNode = treeMasterDetail.Nodes[treeMasterDetail.Nodes.IndexOfKey(sel.Name)];
                    lboxMDDetails.SelectedIndex   = lboxMDDetails.FindStringExact(st.LongName);
                    //PaintMasterDetail();
                }
                break;
            }
        }
        private void btnMDSaveDetail_Click(object sender, EventArgs e)
        {
            switch (cEditor.Description)
            {
            case strDevType:
                sysDevelopment sd = bs_sysDevelopment.Current as sysDevelopment;
                if (sd != null)
                {
                    this.Repository.Save(sd);
                }
                break;

            case strStatGroup:
                sysBaseStatistic st = bs_sysStatistic.Current as sysBaseStatistic;
                if (st != null)
                {
                    this.Repository.Save(st);
                }
                break;
            }
        }