/// <summary> /// Replaces the specified selected height. /// </summary> /// <param name="selectedHeight">Height of the selected.</param> internal void Replace(String code, BordeoPanelHeight selectedHeight) { this.Clear(); BordeoPanelHeightItem item = new BordeoPanelHeightItem() { Height = selectedHeight }; String pName = item.ImageName; for (int i = 0; i < pName.Length; i += 2) { if (pName.Substring(i, 2) == "PB") { this.list.Items.Add(new PanelItem() { Code = String.Format("{0}27T", code), Acabado = "", Height = 135 }); } else if (pName.Substring(i, 2) == "Ps") { this.list.Items.Add(new PanelItem() { Code = String.Format("{0}15T", code), Acabado = "", Height = 75 }); } } }
/// <summary> /// Fills the specified stack. /// </summary> /// <param name="stack">The stack.</param> internal void Fill(IBordeoPanelStyler stack, Boolean sideA = true) { this.Clear(); BordeoPanelHeightItem item = new BordeoPanelHeightItem() { Height = stack.Height }; String pName = item.ImageName; String[] acabados = sideA ? stack.AcabadosLadoA.Select(x => x.Acabado).ToArray() : stack.AcabadosLadoB.Select(x => x.Acabado).ToArray(); String code = this.GetCode(stack); for (int i = 0, j = 0; i < pName.Length; i += 2) { if (pName.Substring(i, 2) == "PB") { this.list.Items.Add(new PanelItem() { Code = String.Format("{0}27T", code), Acabado = acabados[j], Height = 135 }); } else if (pName.Substring(i, 2) == "Ps") { this.list.Items.Add(new PanelItem() { Code = String.Format("{0}15T", code), Acabado = acabados[j], Height = 75 }); } if (pName.Substring(i, 2) == "PB" || pName.Substring(i, 2) == "Ps") { j++; } } }
/// <summary> /// Handles the SelectionChanged event of the cboPanelHeights control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="SelectionChangedEventArgs"/> instance containing the event data.</param> private void cboPanelHeights_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cboPanelHeights.SelectedIndex != -1) { BordeoPanelHeightItem sel = (BordeoPanelHeightItem)cboPanelHeights.SelectedItem; String imgPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(CtrlBordeoHeights)).Location); imgPath = System.IO.Path.Combine(imgPath, "img", sel.ImageName); if (System.IO.File.Exists(imgPath)) { img.Source = new System.IO.FileInfo(imgPath).LoadImage(true); } if (SelectionChanged != null) { SelectionChanged(this, e); } } }