/// <summary> /// Assign controls to the search results window /// </summary> /// <param name="nMap">Network Map</param> /// <param name="violView">Violations view</param> /// <param name="miniMap">The mini-map</param> /// <param name="SearchText">Search Text</param> /// <param name="Parent">The parent builder</param> /// <param name="BaseData">The base data tables</param> /// <param name="ControlPressed">Whether the control button is pressed</param> /// <param name="viewSummary"></param> /// <param name="AltPressed">Whether the alt button is pressed</param> public bool SetControls(MM_Network_Map_DX nMap, MM_Violation_Viewer violView, MM_Mini_Map miniMap, String SearchText, MM_Form_Builder Parent, out MM_DataSet_Base BaseData, MM_Element_Summary viewSummary, bool ControlPressed, bool AltPressed) { MM_Repository.ViewChanged += new MM_Repository.ViewChangedDelegate(Repository_ViewChanged); this.nMap = nMap; this.miniMap = miniMap; this.violView = violView; this.viewSummary = viewSummary; ConfigureSearch(); this.txtSearch.Text = SearchText; this.SearchText = SearchText; bool Resp = PerformSearch(ControlPressed, AltPressed); BaseData = this.BaseData; return(Resp); }
/// <summary> /// Configure our search menu /// </summary> public void ConfigureSearch() { this.lvSearch.Columns.Add("TEID"); this.lvSearch.Columns.Add("Name"); this.lvSearch.Columns.Add("Type"); this.lvSearch.Columns.Add("KV Level"); this.lvSearch.Columns.Add("Substation"); this.lvSearch.Columns.Add("County"); this.lvSearch.Columns.Add("Owner"); this.lvSearch.Columns.Add("Operator"); this.lvSearch.Columns.Add("Load Zone"); this.lvSearch.Columns.Add("Weather Zone"); this.lvSearch.SmallImageList = MM_Repository.ViolationImages; this.lvSearch.LargeImageList = MM_Repository.ViolationImages; this.lvSearch.ColumnClick += new ColumnClickEventHandler(lvSearch_ColumnClick); this.lvSearch.View = View.Details; this.BaseData = new MM_DataSet_Base("Search"); }
/// <summary> /// Asssign controls to the summary viewer /// </summary> /// <param name="BaseData">The base data for the display</param> public void SetControls(MM_DataSet_Base BaseData) { if (this.InvokeRequired) { this.BeginInvoke(new SafeSetControls(SetControls), BaseData); } else { //Assign our base table and integration layer this.BaseData = BaseData; //Go through the data tables, and tally up both total and by KV level into the columns this.Items.Clear(); foreach (DataTable dt in BaseData.Data.Tables) { if (dt.Rows.Count > 0) { ListViewItem ElementRow = this.Items.Add(dt.TableName); ElementRow.UseItemStyleForSubItems = false; ElementRow.SubItems.Add(dt.Rows.Count.ToString("#,##0")).ForeColor = Color.White; ElementRow.Tag = dt; Dictionary <MM_KVLevel, int> KVLevels = new Dictionary <MM_KVLevel, int>(MM_Repository.KVLevels.Count); foreach (MM_KVLevel KVLevel in MM_Repository.KVLevels.Values) { if (KVLevel.Permitted) { KVLevels.Add(KVLevel, 0); } } foreach (DataRow dr in dt.Rows) { MM_Element Elem = dr["TEID"] as MM_Element; if (Elem is MM_Substation) { foreach (MM_KVLevel KVLevel in (Elem as MM_Substation).KVLevels) { if (KVLevel.Permitted) { KVLevels[KVLevel]++; } } } else if (Elem is MM_Transformer) { foreach (MM_TransformerWinding Winding in (Elem as MM_Transformer).Windings) { if (Winding.KVLevel != null && Winding.KVLevel.Permitted) { KVLevels[Winding.KVLevel]++; } } } else if (Elem.KVLevel != null) { KVLevels[Elem.KVLevel]++; } } foreach (KeyValuePair <MM_KVLevel, int> KVLevel in KVLevels) { if (KVLevel.Value == 0) { ElementRow.SubItems.Add("").Tag = KVLevel; } else { ListViewItem.ListViewSubItem SubItem = ElementRow.SubItems.Add(KVLevel.Value.ToString("#,##0")); SubItem.ForeColor = KVLevel.Key.Energized.ForeColor; SubItem.Tag = KVLevel; } } } } this.Sorting = SortOrder.Ascending; this.Sort(); MM_Repository.ViewChanged += new MM_Repository.ViewChangedDelegate(MM_Repository_ViewChanged); } }