public void Load() { PropertiesView.Clear(); //model code bude npr system.controls.combobox.nesto: protswitch, pa zato moramo da parsiramo try { var parsedString = ModelCode.Split(':'); ModelCode = parsedString[1]; } catch (Exception) { MessageBox.Show("Choose valid Model Code from list first", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } mc = 0; try { if (!ModelCodeHelper.GetModelCodeFromString(ModelCode, out mc)) { if (ModelCode.StartsWith("0x", StringComparison.Ordinal)) { mc = (ModelCode)long.Parse(ModelCode.Substring(2), System.Globalization.NumberStyles.HexNumber); } else { mc = (ModelCode)long.Parse(ModelCode); } } } catch (Exception) { MessageBox.Show("Chosen Model Code is not valid", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); getExtendedValuesView.tbModelCode.Focus(); return; } List <ModelCode> properties = modelResourcesDesc.GetAllPropertyIds(mc); foreach (var item in properties) { PropertiesView.Add(new PopertyView(item.ToString(), true)); } }
private void Load() { PropertiesView.Clear(); if (string.IsNullOrEmpty(Gid)) { MessageBox.Show("You first have to enter GID", "Warning", MessageBoxButton.OK, MessageBoxImage.Error); return; } try { if (Gid.StartsWith("0x", StringComparison.Ordinal)) { var NewGid = Gid.Remove(0, 2); g = Convert.ToInt64(Int64.Parse(NewGid, System.Globalization.NumberStyles.HexNumber)); } else { g = Convert.ToInt64(Gid); } } catch (Exception) { MessageBox.Show("You entered invalid GID", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } try { short type = ModelCodeHelper.ExtractTypeFromGlobalId(g); List <ModelCode> properties = modelResourcesDesc.GetAllPropertyIds((DMSType)type); foreach (var v in properties) { PropertiesView.Add(new PopertyView(v.ToString(), true)); //popuni sa svim propertijima i da su svi cekirani } } catch (Exception) { // ignored } }