Beispiel #1
0
 protected void CreatePins(int count)
 {
     if (Inputs.Count < count)
     {
         for (int i = Inputs.Count; i < count; i++)
         {
             int ii   = i + 1;
             var attr = new InputAttribute("Input" + ii);
             attr.Order = i;
             var pin = new GenericInput(FPluginHost, attr);
             Inputs.Add(pin);
         }
     }
     if (Inputs.Count > count)
     {
         for (int i = Inputs.Count - 1; i >= count; i--)
         {
             FPluginHost.DeletePin(Inputs[i].Pin);
             Inputs.RemoveAt(i);
         }
     }
 }
Beispiel #2
0
        protected void OnConfigPinChanged(IDiffSpread <string> spread)
        {
            if (Initialized)
            {
                string[] fields = FFormular[0].Split(',');
                for (int i = 0; i < fields.Length; i++)
                {
                    fields[i] = fields[i].Trim();
                }
                var pkeys = Preserve.Keys.ToList();

                for (int i = 0; i < pkeys.Count; i++)
                {
                    Preserve[pkeys[i]] = false;
                }
                int order = 5;
                foreach (var f in fields)
                {
                    if (Inputs.ContainsKey(f))
                    {
                        Inputs[f].Pin.Order        = order * 2;
                        Inputs[f].BinSizePin.Order = order * 2 + 1;
                    }
                    else
                    {
                        var attr = new InputAttribute(f);
                        attr.Order    = order * 2;
                        attr.BinOrder = order * 2 + 1;
                        Inputs.Add(f, new GenericBinSizedInput(FPluginHost, attr));
                    }
                    Preserve.Set(f, true);
                    order++;
                }
                foreach (var k in Preserve.Keys)
                {
                    if (Inputs.ContainsKey(k))
                    {
                        if (!Preserve[k])
                        {
                            FPluginHost.DeletePin(Inputs[k].Pin);
                            FPluginHost.DeletePin(Inputs[k].BinSizePin);
                            Inputs.Remove(k);
                        }
                    }
                }
                Preserve.Clear();
                foreach (var k in Inputs.Keys)
                {
                    Preserve.Add(k, true);
                }
            }
            else
            {
                if (FFormular[0] == "")
                {
                    return;
                }
                Initialize();
                Initialized = true;
            }
        }