예제 #1
0
        public override object ConvertTo(
            CM::ITypeDescriptorContext context, System.Globalization.CultureInfo culture,
            object value, System.Type destinationType
            )
        {
            if (typeof(string) == destinationType)
            {
                string ret = TreeNodeCheckBox.GetName((ITreeNodeCheckBox)value);
                if (ret != null)
                {
                    return(ret);
                }
                return("(" + value.GetType().ToString() + ")" + value.ToString());
            }
            else if (typeof(CM::Design.Serialization.InstanceDescriptor) == destinationType)
            {
                string name = TreeNodeCheckBox.GetName((ITreeNodeCheckBox)value);
                if (name == null)
                {
                    name = "DoubleBorder";
                }

                return(new CM::Design.Serialization.InstanceDescriptor(
                           ((System.Converter <string, ITreeNodeCheckBox>)GetInstance).Method,
                           new object[] { name }
                           ));
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
예제 #2
0
 public override bool CanConvertTo(CM::ITypeDescriptorContext context, System.Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         return(true);
     }
     return(base.CanConvertTo(context, destinationType));
 }
예제 #3
0
 public override bool CanConvertFrom(CM::ITypeDescriptorContext context, System.Type sourceType)
 {
     if (typeof(string) == sourceType)
     {
         return(true);
     }
     if (typeof(ITreeNodeCheckBox).IsAssignableFrom(sourceType))
     {
         return(true);
     }
     return(base.CanConvertFrom(context, sourceType));
 }
예제 #4
0
 //============================================================
 //		変換子
 //============================================================
 public override bool CanConvertTo(CM::ITypeDescriptorContext context, System.Type destinationType)
 {
     if (typeof(string) == destinationType)
     {
         return(true);
     }
     //if(typeof(ITreeNodeCheckBox)==destinationType)return true;
     if (typeof(CM::Design.Serialization.InstanceDescriptor) == destinationType)
     {
         return(true);
     }
     return(base.CanConvertTo(context, destinationType));
 }
예제 #5
0
 public override object ConvertTo(
     CM::ITypeDescriptorContext context,
     System.Globalization.CultureInfo culture,
     object value,
     System.Type destinationType
     )
 {
     if (destinationType == typeof(string) && value is TreeNodeSettings)
     {
         return("(Node 基本設定)");                // 現在の状態を表す文字列
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
예제 #6
0
 public override object ConvertFrom(CM::ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
 {
     if (value is string)
     {
         ITreeNodeCheckBox ret = TreeNodeCheckBox.GetInstance((string)value);
         if (ret != null)
         {
             return(ret);
         }
         return(TreeNodeCheckBox.DoubleBorder);
     }
     else if (value is ITreeNodeCheckBox)
     {
         return(value);
     }
     return(base.ConvertFrom(context, culture, value));
 }