private void Init() { try { if (ScorePropertyInfoItem == null) { return; } CurrentApp = ScorePropertyInfoItem.CurrentApp; ScorePropertyInfoItem.Editor = this; mScoreObject = ScorePropertyInfoItem.ScoreObject; ScoreProperty scoreProperty = ScorePropertyInfoItem.ScoreProperty; mScoreProperty = scoreProperty; if (scoreProperty != null) { ConvertFormat = scoreProperty.DataType; } if (mScoreObject != null && scoreProperty != null) { var objValue = scoreProperty.GetPropertyValue(mScoreObject); if (objValue != null) { Value = objValue.ToString(); if (objValue is Color) { ColorValue = (Color)objValue; } if (objValue is Boolean) { BoolValue = (bool)objValue; } } } InitSelectValueItems(); ShowValue(); } catch (Exception ex) { ShowException(ex.Message); } }
private void ShowValue() { try { if (mScoreObject == null || mScoreProperty == null) { return; } switch (ConvertFormat) { case ScorePropertyDataType.Enum: case ScorePropertyDataType.FontFamily: case ScorePropertyDataType.FontWeight: for (int i = 0; i < mListEnumValueItems.Count; i++) { var temp = mListEnumValueItems[i]; var info = temp.Info; if (info == null) { continue; } var value = mScoreProperty.GetPropertyValue(mScoreObject); if (value == null) { continue; } if (info.ToString() == value.ToString()) { if (mItemSelectControl != null) { mItemSelectControl.SelectedItem = temp; } } } break; case ScorePropertyDataType.ScoreItem: for (int i = 0; i < mListEnumValueItems.Count; i++) { var temp = mListEnumValueItems[i]; var info = temp.Info; if (info == null) { continue; } var scoreItem = info as ScoreItem; if (scoreItem == null) { continue; } var value = mScoreProperty.GetPropertyValue(mScoreObject) as ScoreItem; if (value == null) { continue; } if (scoreItem.ID == value.ID) { if (mItemSelectControl != null) { mItemSelectControl.SelectedItem = temp; } } } break; } } catch (Exception ex) { ShowException(ex.Message); } }