public override void SetValue(object component, object value) { try { SetValueCommand cmd = new SetValueCommand(); cmd.Execute(); } catch(Exception ex) { MessageBox.Show(ex.Message, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); throw; } if (component is CustomClass) { CustomClass o = (CustomClass)component; if (m_Property.ValueType == enumValueType.vtCombo) o.OnDataValidate(m_Property, m_Property.ComboValues[value], value); else o.OnDataValidate(m_Property, value, value); } if (m_Property.ValueType == enumValueType.vtFileNameScript) { string strFullPath = (string)value; // to 相对路径 string strBase = null; if (System.IO.File.Exists(Application.StartupPath + "\\GameDesingerTools.ini")) { StringBuilder sb = new StringBuilder(255); FileFolderHelper.ReadIniFile("Browsing Base Folder", "Script", "", sb, 255, Application.StartupPath + "\\GameDesingerTools.ini"); strBase = sb.ToString(); } string strConverted = strFullPath.Replace(strBase + "\\", ""); // '\' -> '/' strConverted = strConverted.Replace("\\", "/"); m_Property.Value = strConverted; } else if (m_Property.ValueType == enumValueType.vtExpandNode && m_Property.Value is DBCustomClass) { //((DBCustomClass)m_Property.Value).Value = value; //((DBCustomClass)m_Property.Value).ReinitData(); //((DBCustomClass)m_Property.Value).GetDynamicClass(new object[]{value}); //m_Property.Value = (DBCustomClass)m_Property.Value; //m_Property.ValueType = enumValueType.vtExpandNode; } else { //if (m_Property.IsClearDisplayValue) //仅在 oneditvalue 时会被置 false, 用于设置显示值,不影响保存的值 // m_Property.DisplayValue = null; //m_Property.IsClearDisplayValue = true; m_Property.Value = value; } if (component is CustomClass) { CustomClass o = (CustomClass)component; if (m_Property.ValueType == enumValueType.vtCombo) o.OnAfterDataValidate(m_Property, m_Property.ComboValues[value], value); else o.OnAfterDataValidate(m_Property, value, value); } }
public override void SetValue(object component, object value) { try { SetValueCommand cmd = new SetValueCommand(); cmd.Execute(); } catch (Exception ex) { MessageBox.Show(ex.Message, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); throw; } if (component is CustomClass) { CustomClass o = (CustomClass)component; if (m_Property.ValueType == enumValueType.vtCombo) { o.OnDataValidate(m_Property, m_Property.ComboValues[value], value); } else { o.OnDataValidate(m_Property, value, value); } } if (m_Property.ValueType == enumValueType.vtFileNameScript) { string strFullPath = (string)value; // to 相对路径 string strBase = null; if (System.IO.File.Exists(Application.StartupPath + "\\GameDesingerTools.ini")) { StringBuilder sb = new StringBuilder(255); FileFolderHelper.ReadIniFile("Browsing Base Folder", "Script", "", sb, 255, Application.StartupPath + "\\GameDesingerTools.ini"); strBase = sb.ToString(); } string strConverted = strFullPath.Replace(strBase + "\\", ""); // '\' -> '/' strConverted = strConverted.Replace("\\", "/"); m_Property.Value = strConverted; } else if (m_Property.ValueType == enumValueType.vtExpandNode && m_Property.Value is DBCustomClass) { //((DBCustomClass)m_Property.Value).Value = value; //((DBCustomClass)m_Property.Value).ReinitData(); //((DBCustomClass)m_Property.Value).GetDynamicClass(new object[]{value}); //m_Property.Value = (DBCustomClass)m_Property.Value; //m_Property.ValueType = enumValueType.vtExpandNode; } else { //if (m_Property.IsClearDisplayValue) //仅在 oneditvalue 时会被置 false, 用于设置显示值,不影响保存的值 // m_Property.DisplayValue = null; //m_Property.IsClearDisplayValue = true; m_Property.Value = value; } if (component is CustomClass) { CustomClass o = (CustomClass)component; if (m_Property.ValueType == enumValueType.vtCombo) { o.OnAfterDataValidate(m_Property, m_Property.ComboValues[value], value); } else { o.OnAfterDataValidate(m_Property, value, value); } } }