コード例 #1
0
 public NodeValueItem(string text, Type type, bool inputEnabled, bool outputEnabled)
     : base(inputEnabled, outputEnabled)
 {
     EnableTypeField = true;
     TextMaxLength   = 20;
     if (string.IsNullOrEmpty(text))
     {
         ValueState = new ValueItemState(type);
     }
     else
     {
         ValueState = new ValueItemState(text, type);
     }
     background = Brushes.LightCyan;
 }
コード例 #2
0
        public override bool OnDoubleClick()
        {
            base.OnDoubleClick();
            DialogResult result = DialogResult.None;

            if (SupportedTypes.Length == 1 && SupportedTypes[0].IsEnum)
            {
                var form = new SelectionForm();
                form.Text  = Name ?? "Select item from list";
                form.Items = SupportedTypes[0].GetEnumNames();
                int index = Array.IndexOf(SupportedTypes[0].GetEnumNames(), ValueState.Text);
                if (index == -1)
                {
                    index = 0;
                }
                form.SelectedIndex = index;
                result             = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    ValueState = new ValueItemState(form.Items[form.SelectedIndex], SupportedTypes[0]);
                }
            }
            else
            {
                var form = new ValueBoxForm();
                form.Text = Name ?? "Value editor";
                form.SetSupportedTypes(SupportedTypes);
                form.InputText          = ValueState.Text;
                form.InputType          = ValueState.Type;
                form.EnableTypeComboBox = EnableTypeField;
                result = form.ShowDialog();
                if (result == DialogResult.OK && ValueItemState.TryParse(form.InputText, form.InputType) != null)
                {
                    ValueState = new ValueItemState(form.InputText, form.InputType);
                }
            }
            return(true);
        }
コード例 #3
0
 public AcceptNodeValueChangedEventArgs(ValueItemState oldState, ValueItemState newState, bool cancel)
     : base(cancel)
 {
     PreviousState = oldState; CurrentState = newState;
 }
コード例 #4
0
 public AcceptNodeValueChangedEventArgs(ValueItemState oldState, ValueItemState newState)
 {
     PreviousState = oldState; CurrentState = newState;
 }
コード例 #5
0
 public static object TryParse(ValueItemState state)
 {
     return TryParse(state.Text, state.Type);
 }
コード例 #6
0
 public override bool OnDoubleClick()
 {
     base.OnDoubleClick();
     DialogResult result = DialogResult.None;
     if (SupportedTypes.Length == 1 && SupportedTypes[0].IsEnum)
     {
         var form = new SelectionForm();
         form.Text = Name ?? "Select item from list";
         form.Items = SupportedTypes[0].GetEnumNames();
         int index = Array.IndexOf(SupportedTypes[0].GetEnumNames(), ValueState.Text);
         if (index == -1)
             index = 0;
         form.SelectedIndex = index;
         result = form.ShowDialog();
         if (result == DialogResult.OK)
         {
             ValueState = new ValueItemState(form.Items[form.SelectedIndex], SupportedTypes[0]);
         }
     }
     else
     {
         var form = new ValueBoxForm();
         form.Text = Name ?? "Value editor";
         form.SetSupportedTypes(SupportedTypes);
         form.InputText = ValueState.Text;
         form.InputType = ValueState.Type;
         form.EnableTypeComboBox = EnableTypeField;
         result = form.ShowDialog();
         if (result == DialogResult.OK && ValueItemState.TryParse(form.InputText, form.InputType) != null)
         {
             ValueState = new ValueItemState(form.InputText, form.InputType);
         }
     }
     return true;
 }
コード例 #7
0
 public NodeValueItem(string text, Type type, bool inputEnabled, bool outputEnabled)
     : base(inputEnabled, outputEnabled)
 {
     EnableTypeField = true;
     TextMaxLength = 20;
     if (string.IsNullOrEmpty(text))
         ValueState = new ValueItemState(type);
     else
         ValueState = new ValueItemState(text, type);
     background = Brushes.LightCyan;
 }
コード例 #8
0
 public static object TryParse(ValueItemState state)
 {
     return(TryParse(state.Text, state.Type));
 }
コード例 #9
0
 public AcceptNodeValueChangedEventArgs(ValueItemState oldState, ValueItemState newState, bool cancel) : base(cancel)
 {
     PreviousState = oldState; CurrentState = newState;
 }
コード例 #10
0
 public AcceptNodeValueChangedEventArgs(ValueItemState oldState, ValueItemState newState)
 {
     PreviousState = oldState; CurrentState = newState;
 }