示例#1
0
 public Info(int id, uint nCtrlKey, uint nAuxKey, SwitchBox ckboxCtrl, SwitchBox ckboxAlt, SwitchBox ckboxShift, TextBoxCu tbxAux, string strError)
 {
     this.ID         = id;
     this.CtrlKey    = nCtrlKey;
     this.AuxKey     = nAuxKey;
     this.sbox_Ctrl  = ckboxCtrl;
     this.sbox_Alt   = ckboxAlt;
     this.sbox_Shift = ckboxShift;
     this.Tbx_Aux    = tbxAux;
     this.ErrorInfo  = strError;
 }
        private void switchList(SwitchBox d)
        {
            switch (d)
            {
            case SwitchBox.Left:
                int index = lbCultures.SelectedIndex;
                cbCultures.Items.Add(lbCultures.Items[lbCultures.SelectedIndex]);
                lbCultures.Items.RemoveAt(lbCultures.SelectedIndex);
                if (index >= lbCultures.Items.Count)
                {
                    lbCultures.SelectedIndex = lbCultures.Items.Count - 1;
                }
                else
                {
                    lbCultures.SelectedIndex = index;
                }
                break;

            case SwitchBox.FullLeft:
                for (int i = 0; i < lbCultures.Items.Count; i++)
                {
                    cbCultures.Items.Add(lbCultures.Items[i]);
                }
                lbCultures.Items.Clear();
                break;

            case SwitchBox.Right:
                lbCultures.Items.Add(cbCultures.Items[cbCultures.SelectedIndex]);
                cbCultures.Items.RemoveAt(cbCultures.SelectedIndex);
                cbCultures.Text = string.Empty;
                break;

            case SwitchBox.FullRight:
                for (int i = 0; i < cbCultures.Items.Count; i++)
                {
                    lbCultures.Items.Add(cbCultures.Items[i]);
                }
                cbCultures.Items.Clear();
                cbCultures.Text = string.Empty;
                break;

            default:
                break;
            }
        }
示例#3
0
        public override void AddedToContainer()
        {
            base.AddedToContainer();

            CloseButtonOn = false;

            var builder = new FieldBuilder();

            builder.BuildSessionStart(this);

            var symmetricalBordersCheckBox = builder.AddCheckBoxField("Symmetrical Borders: ");

            symmetricalBordersCheckBox.Checked = sigmoid.SymmetricalBorders;

            builder.AddLabelField("P: ");
            var pMin     = builder.AddDoubleField("Min: ");
            var pMax     = builder.AddDoubleField("Max: ");
            var pVal     = builder.AddDoubleField("Value: ");
            var pMutable = builder.AddCheckBoxField("IsMutable: ");

            builder.AddVerticalMargin(4);

            builder.AddLabelField("Output-Border: ");
            var o1Min     = builder.AddDoubleField("Min: ");
            var o1Max     = builder.AddDoubleField("Max: ");
            var o1Val     = builder.AddDoubleField("Value: ");
            var o1Mutable = builder.AddCheckBoxField("IsMutable: ");

            var switchBox = new SwitchBox();

            switchBox.Initialize();
            builder.AddDrawBoxAsField(switchBox, DrawBoxAlignment.GetLeftRight());

            var emptyPanel = new Panel();

            emptyPanel.Initialize();

            switchBox.AddDrawBox(emptyPanel, "symmetrical");

            var panel = new Panel();

            panel.Initialize();

            var builder2 = new FieldBuilder();

            builder2.BuildSessionStart(panel);
            builder2.AddLabelField("Output-Border 2: ");
            var o2Min     = builder2.AddDoubleField("Min: ");
            var o2Max     = builder2.AddDoubleField("Max: ");
            var o2Val     = builder2.AddDoubleField("Value: ");
            var o2Mutable = builder2.AddCheckBoxField("IsMutable: ");

            builder2.BuildSessionEnd();

            switchBox.AddDrawBox(panel, "non-symmetrical");

            int largestHeight = 0;

            foreach (var p in switchBox.DrawBoxList)
            {
                if (p.Height > largestHeight)
                {
                    largestHeight = panel.Height;
                }
            }

            switchBox.Width  = builder.FieldWidth;
            switchBox.Height = largestHeight;

            if (sigmoid.GeneList.Count != 0)
            {
                var o1Gene = (DoubleGene)sigmoid.GeneList[0];
                o1Min.Value       = o1Gene.Min;
                o1Max.Value       = o1Gene.Max;
                o1Val.Value       = o1Gene.Value;
                o1Mutable.Checked = o1Gene.IsMutable;

                int n = 1;

                if (!sigmoid.SymmetricalBorders)
                {
                    var o2Gene = (DoubleGene)sigmoid.GeneList[n++];
                    o2Min.Value       = o2Gene.Min;
                    o2Max.Value       = o2Gene.Max;
                    o2Val.Value       = o2Gene.Value;
                    o2Mutable.Checked = o2Gene.IsMutable;
                }

                var pGene = (DoubleGene)sigmoid.GeneList[n++];
                pMin.Value       = pGene.Min;
                pMax.Value       = pGene.Max;
                pVal.Value       = pGene.Value;
                pMutable.Checked = pGene.IsMutable;
            }

            if (sigmoid.SymmetricalBorders)
            {
                switchBox.SelectDrawBoxWithKey("symmetrical");
            }
            else
            {
                switchBox.SelectDrawBoxWithKey("non-symmetrical");
            }

            symmetricalBordersCheckBox.CheckedChanged += delegate(object sender, bool newValue)
            {
                if (newValue)
                {
                    switchBox.SelectDrawBoxWithKey("symmetrical");
                }
                else
                {
                    switchBox.SelectDrawBoxWithKey("non-symmetrical");
                }
            };

            builder.AddResizableButtonField("OK", delegate(object sender)
            {
                Close();
            }, FieldBuilder.ResizableButtonOrientation.Left);

            builder.BuildSessionEnd();

            IsClosing += delegate(object sender)
            {
                geneList.Clear();

                var _o1Gene = new DoubleGene();
                _o1Gene.SetMinMaxValue(o1Min.Value, o1Max.Value, o1Val.Value);
                _o1Gene.IsMutable = o1Mutable.Checked;
                geneList.Add(_o1Gene);

                if (!symmetricalBordersCheckBox.Checked)
                {
                    var _o2Gene = new DoubleGene();
                    _o2Gene.SetMinMaxValue(o2Min.Value, o2Max.Value, o2Val.Value);
                    _o2Gene.IsMutable = pMutable.Checked;
                    geneList.Add(_o2Gene);
                }

                var _pGene = new DoubleGene();
                _pGene.SetMinMaxValue(pMin.Value, pMax.Value, pVal.Value);
                _pGene.IsMutable = pMutable.Checked;
                geneList.Add(_pGene);
            };

            CanResizeFormVertically = false;

            X = (Parent.Width / 2) - (Width / 2);
            Y = (Parent.Height / 2) - (Height / 2);
        }