Ejemplo n.º 1
0
        private void ReloadUI()
        {
            this.BatchSuspend();
            this.ClearControls();

            List <TriggerEffect> effectList;// = mParentTriggerNamespace.WalkEffects(Trigger);

            if (EffectsOnFalse)
            {
                effectList = this.Trigger.TriggerEffectsFalse.Effects;
            }
            else
            {
                effectList = this.Trigger.TriggerEffects.Effects;
            }
            foreach (TriggerEffect e in effectList)
            {
                if ((e.Type == TriggerSystemMain.mTriggerDefinitions.GetDeactivateEffectName()) ||
                    (e.Type == TriggerSystemMain.mTriggerDefinitions.GetActivateEffectName()))
                {
                    continue;
                }

                AddExistingEffectToUI(e, mParentTriggerNamespace.GetValues());
            }
            this.BatchResume();
        }
Ejemplo n.º 2
0
        private void ReloadUI()
        {
            this.BatchSuspend();
            this.ClearControls();
            List <TriggerCondition> conditionList = mParentTriggerNamespace.WalkConditions(Trigger.TriggerConditions.Child);

            foreach (TriggerCondition c in conditionList)
            {
                AddExistingConditionToUI(c, mParentTriggerNamespace.GetValues());
            }
            this.BatchResume();
        }
Ejemplo n.º 3
0
        public override Control GetEditor(out string bindPropName)
        {
            string text = "";

            if (PresentationValue != null)
            {
                if ((int)PresentationValue == -1)
                {
                    text = mUnitializedText;
                }
                else
                {
                    text = PresentationValue.ToString();
                }
            }
            else
            {
                text = "empty";
            }

            Label l = new Label();

            int idval;

            if (System.Int32.TryParse(text, out idval))
            {
                TriggerValue val;
                if (mTriggerNamespace.GetValues().TryGetValue(idval, out val))
                {
                    text = val.Name;
                }
            }
            l.Text = text;

            l.ForeColor = Color.Blue;
            if (text == mUnitializedText)
            {
                l.ForeColor = Color.Red;
            }
            bindPropName = "Text";
            l.AutoSize   = true;
            l.Margin     = new Padding(0);

            l.DragEnter += new DragEventHandler(l_DragEnter);
            l.DragDrop  += new DragEventHandler(l_DragDrop);
            l.AllowDrop  = true;
            return(l);


            //return base.GetEditor(out bindPropName);
        }
Ejemplo n.º 4
0
        public void RefreshList()
        {
            if (ParentTriggerNamespace == null)
            {
                return;
            }

            //gridControl1.DataSource =
            List <TriggerValueContainer> list = new List <TriggerValueContainer>();

            foreach (TriggerValue v in mParentTriggerNamespace.GetValues().Values)
            {
                list.Add(new TriggerValueContainer(v));
            }

            gridControl1.SingleClickEdit = false;// true;

            gridControl1.AddingDataRow += new Xceed.Grid.AddingDataRowEventHandler(gridControl1_AddingDataRow);
            //gridControl1.DataSource = mParentTriggerNamespace.GetValues().Values;
            gridControl1.DataSource = list;

            //gridControl1.DataMember = "TriggerValueContainer";

            //foreach (Xceed.Grid.DataCell cell in gridControl1.DataRowTemplate.Cells)
            //{

            //   cell.Click += new EventHandler(cell_Click);

            //}

            //gridControl1.DataRowTemplate.Cells["DefaultValue"].Click += new EventHandler(cell_Click);

            //AddIDEditor(gridControl1.Columns, "DefaultValue");
            //AddIDEditor(gridControl1.Columns, "Value");

            //gridControl1
        }
Ejemplo n.º 5
0
            protected override void ActivateControlCore(Control control, Xceed.Grid.Cell cell)
            {
                int id = (int)(cell.ParentRow.Cells["ID"].Value);

                if (mEditorforms.ContainsKey(id))
                {
                    mEditorforms[id].BringToFront();
                }
                else
                {
                    TriggerValue      val    = mParentTriggerNamespace.GetValues()[id];
                    VarValueBinder    binder = new VarValueBinder(val, val);
                    HighLevelProperty HLProp = TriggerSystemMain.mTriggerDefinitions.GetHLProperty(binder, mParentTriggerNamespace);
                    string            bindName;
                    Control           c = HLProp.GetEditor(out bindName);
                    //this.TemplateControl = c;
                    //this.TemplateControl

                    Form f = new Form();


                    f.Tag = id;


                    f.Controls.Add(c);
                    c.Dock = DockStyle.Fill;
                    f.Text = binder.GetName();
                    //f.TopLevelControl = true;
                    f.Size = new Size(200, 55);

                    Point p1 = new Point(0, 0);
                    Point p2 = cell.PointToScreen(p1);
                    f.StartPosition = FormStartPosition.Manual;
                    p2.Y           -= 30;
                    p2.X           -= 60;
                    f.Location      = p2;
                    //f.Init(this, mVariable, mValue, mHLProp);
                    //f.FormClosed += new FormClosedEventHandler(f_FormClosed);
                    //f.Show();
                    f.FormClosed += new FormClosedEventHandler(f_FormClosed);

                    f.TopMost = true;
                    f.Show();

                    mEditorforms[id] = f;

                    base.ActivateControlCore(c, cell);
                }
            }
Ejemplo n.º 6
0
        public bool Setup(TriggerNamespace triggerNamespace, TriggerComponent component)
        {
            mParentTriggerNamespace = triggerNamespace;
            mTriggerComponent       = component;

            if (TriggerSystemMain.mTriggerDefinitions.TryGetDefinition(component.DBID, component.Version, out mDefinition) == false)
            {
                return(false);
            }

            this.ComponentNameLabel.Text = mDefinition.Type;



            int column1X = 0;
            int column2X = 100;
            int column3X = 200;
            int row1Y    = 50;

            int rowN   = row1Y;
            int deltaY = 20;

            Dictionary <int, TriggerValue> values = mParentTriggerNamespace.GetValues();

            foreach (TriggerVariable v in component.Parameter)
            {
                Label ioLabel = new Label();
                if (v is TriggersInputVariable)
                {
                    ioLabel.Text = "Input";
                }
                else if (v is TriggersOutputVariable)
                {
                    ioLabel.Text = "Output";
                }
                ioLabel.Height -= 5;

                Label nameLabel = new Label();
                nameLabel.Text    = v.Name;
                nameLabel.Height -= 5;

                Label typeLabel = new Label();
                typeLabel.Text    = values[v.ID].Type;
                typeLabel.Height -= 5;


                TriggerParameterControl c = new TriggerParameterControl();
                c.Init(component, v, values[v.ID], mParentTriggerNamespace);
                c.LabelChanged += new EventHandler(c_LabelChanged);

                AddControl(InputPanel, ioLabel, column1X, rowN);
                AddControl(TypesPanel, typeLabel, column1X, rowN);
                AddControl(NamePanel, nameLabel, column1X, rowN);
                AddControl(ParameterPanel, c, column1X, rowN);


                nameLabel.Width = nameLabel.Parent.Width;
                c.Width         = c.Parent.Width;



                mParamcontrols.Add(c);

                rowN += deltaY;
            }

            //smart help text

            string helptext = mDefinition.HelpText;

            //string newHelpText;
            //int startOffset  = helptext.IndexOf("{",startOffset);
            //int lastSpot = 0;
            //while(startOffset != -1)
            //{
            //   newHelpText += helptext.Substring(lastSpot, startOffset - lastSpot);
            //   newHelpText +=

            //   startOffset = helptext.IndexOf("{", startOffset);
            //}

            UpdateHelpText();

            return(true);
        }