コード例 #1
0
ファイル: MM_Tie.cs プロジェクト: sylvainr/MacomberMap
        /// <summary>
        /// Initialize a new DCTie around its base line.
        /// </summary>
        /// <param name="BaseLine">The line on which the tie is based</param>
        /// <param name="TieDescriptor">The descriptor of the tie</param>
        public MM_Tie(MM_Line BaseLine, String TieDescriptor)
        {
            //Retrieve our information from our base line
            IntegrateFromLine(BaseLine);

            //Assign our tie descriptor and KV Level.
            this.TieDescriptor = MM_Repository.TitleCase(TieDescriptor);
            this.ElemType      = MM_Repository.FindElementType("Tie");
            //this.KVLevel = MM_Repository.KVLevels["DC Tie"];     //mn - was at "DCTIE vs "DC TIE" check to ensure what one is right - 20130610 -mn
        }
コード例 #2
0
        /// <summary>
        /// When the primary/secondary path is selected, display all of our elements
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbPrimarySecondary_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                lvItems.Columns.Clear();
                lvItems.Items.Clear();
                lvItems.View = View.Details;

                lvItems.Columns.Add("#");
                lvItems.Columns.Add("Action");
                lvItems.Columns.Add("Subsatation");
                lvItems.Columns.Add("Type");
                lvItems.Columns.Add("Element");
                lvItems.Columns.Add("Operator");
                lvItems.FullRowSelect = true;
                lvItems.CheckBoxes    = true;
                MM_Blackstart_Corridor_Target Target = cmbCorridorTarget.SelectedItem as MM_Blackstart_Corridor_Target;
                FieldInfo fI = Target.GetType().GetField(cmbPrimarySecondary.Text);
                if (Target != null && fI != null)
                {
                    MM_Blackstart_Corridor_Element[] Elems = fI.GetValue(Target) as MM_Blackstart_Corridor_Element[];
                    MM_Substation LastSub = null;
                    for (int a = 0; a < Elems.Length; a++)
                    {
                        try
                        {
                            ListViewItem lvI = new ListViewItem((a + 1).ToString("#,##0"));
                            lvI.UseItemStyleForSubItems = true;
                            if (MM_Server_Interface.Client != null && Array.IndexOf(Data_Integration.UserOperatorships, 999999) == -1 && Array.IndexOf(Data_Integration.UserOperatorships, Elems[a].AssociatedElement.Operator.TEID) == -1)
                            {
                                lvI.ForeColor = Color.Gray;
                            }

                            lvI.SubItems.Add(Elems[a].Action.ToString());

                            if (Elems[a].AssociatedElement != null)
                            {
                                MM_Element Elem = Elems[a].AssociatedElement;


                                if (Elem is MM_Line)
                                {
                                    MM_Line Line = (MM_Line)Elem;
                                    if (LastSub == Line.Substation2)
                                    {
                                        lvI.SubItems.Add(Line.Substation2.Name + " to " + Line.Substation1.Name);
                                    }
                                    else
                                    {
                                        lvI.SubItems.Add(Line.Substation1.Name + " to " + Line.Substation2.Name);
                                    }
                                    LastSub = Line.Substation2;
                                }
                                else
                                {
                                    lvI.SubItems.Add(Elem.Substation.Name);
                                    LastSub = Elem.Substation;
                                }

                                lvI.SubItems.Add(Elem.ElemType.Name);
                                lvI.SubItems.Add(MM_Repository.TitleCase(Elem.Name));
                                lvI.SubItems.Add(Elem.Operator.Alias.Substring(0, 1) + MM_Repository.TitleCase(Elem.Operator.Alias.Substring(1)));
                            }
                            else
                            {
                                if (Elems[a].Substation == null)
                                {
                                    lvI.SubItems.Add("?");
                                }
                                else
                                {
                                    lvI.SubItems.Add(MM_Repository.TitleCase(Elems[a].Substation.Name));
                                }
                                lvI.SubItems.Add("?");
                                lvI.SubItems.Add("?");
                                lvI.SubItems.Add("?");
                                lvI.ForeColor = Color.Red;
                                lvI.UseItemStyleForSubItems = true;
                            }
                            lvI.Tag = Elems[a];
                            lvItems.Items.Add(lvI);
                        }
                        catch (Exception ex)
                        {
                            MM_System_Interfaces.LogError(ex);
                        }
                    }
                    tmrUpdate_Tick(tmrUpdate, EventArgs.Empty);
                    lvItems.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                }
            }
            catch (Exception)
            { }
        }
コード例 #3
0
ファイル: MM_Limit.cs プロジェクト: sylvainr/MacomberMap
 /// <summary>
 /// Create a new IROL/CSC limit
 /// </summary>
 /// <param name="dr"></param>
 public MM_Limit(DataRow dr)
 {
     this.Name    = MM_Repository.TitleCase((string)dr["ID"]);
     this.Current = MM_Converter.ToSingle(dr["RTOTMW"]);
     this.Max     = MM_Converter.ToSingle(dr["LTOTMW"]);
 }