private void SizeOfUnit_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (SizeOfUnit == null) { return; } var sqlBaseData = new SqlBaseData(); var standartUnitSizes = sqlBaseData.StandartSize( SizeOfUnit.SelectedItem.ToString().Replace("" + "System.Windows.Controls.ListBoxItem: ", "")); if (WidthU == null || HeightU == null) { return; } WidthU.Text = standartUnitSizes[0]; HeightU.Text = standartUnitSizes[1]; }
void SizeOfUnit_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (SizeOfUnit?.SelectedItem == null) { return; } var id = Convert.ToInt32(((DataRowView)SizeOfUnit.SelectedItem)["SizeID"].ToString()); var sqlBaseData = new SqlBaseData(); var type = Convert.ToInt32(TypeOfPanel.SelectedValue); var standartUnitSizes = sqlBaseData.StandartSize(id, type); switch(type) { case 1: thicknessOfPanel = "30"; break; case 2: thicknessOfPanel = "50"; break; case 7: thicknessOfPanel = "70"; break; default: thicknessOfPanel = "40"; break; } if (WidthU == null || HeightU == null) { return; } WidthU.Text = standartUnitSizes[0]; HeightU.Text = standartUnitSizes[1]; } catch (Exception) { if (WidthU != null) WidthU.Text = ""; if (HeightU != null) HeightU.Text = ""; } }
void SizeOfUnit_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (SizeOfUnit?.SelectedItem == null) return; var id = Convert.ToInt32(((DataRowView) SizeOfUnit.SelectedItem)["SizeID"].ToString()); var sqlBaseData = new SqlBaseData(); var standartUnitSizes = sqlBaseData.StandartSize(id, 6); if (WidthU == null || HeightU == null) { return; } WidthU.Text = standartUnitSizes[0]; HeightU.Text = standartUnitSizes[1]; }