Beispiel #1
0
        private ModifiedLabel TextLabelGenerator(String id, String text, Geometry.Rectangle rectangle)
        {
            var staticText = new ModifiedLabel(id, emSize: 12f);

            //staticText.BackColor = textColour;
            staticText.Text = text;
            staticText.Reorient(rectangle);
            staticText.TextAlign = ContentAlignment.TopLeft;
            return(staticText);
        }
Beispiel #2
0
        public void Implement(Control.ControlCollection motherControlCollection)
        {
            for (int i = 0; i < staticTexts.Count; i++)
            {
                motherControlCollection.Add(_staticLabels[i]);
                motherControlCollection.Add(_dynamicLabels[i]);
            }
            motherControlCollection.Add(_palleteBoxBg);

            var e = new ModifiedButton($"c{_palleteNo}", $"{_palleteNo+1}. Hücreyi Boşalt", 12f);

            e.ClickAction = EmptyPallette;
            e.Reorient(_thisRectangle.SubRectangle(new Geometry.Rectangle(0.1f, 0.9f, 0.83f, 0.97f)));
            motherControlCollection.Add(e);
            _palleteButton = e;

            var e2 = new ModifiedButton($"c{_palleteNo}", $"+", 12f);

            e2.ClickAction = Increment;
            e2.Reorient(_thisRectangle.SubRectangle(new Geometry.Rectangle(0.85f, 0.95f, 0.83f, 0.97f)));
            motherControlCollection.Add(e2);
            _plusButton = e2;

            var e3 = new ModifiedButton($"c{_palleteNo}", $"-", 12f);

            e3.ClickAction = Decrement;
            e3.Reorient(_thisRectangle.SubRectangle(new Geometry.Rectangle(0.05f, 0.15f, 0.83f, 0.97f)));
            motherControlCollection.Add(e3);
            _minusButton = e3;

            var f = new ModifiedLabel("r", $"Hücre {_palleteNo+1}");

            f.Reorient(_thisRectangle.SubRectangle(new Geometry.Rectangle(0f, 1f, 0.1f, 0.201f)));
            var c2 = Color.FromArgb(255, 204, 204, 12);

            // var c2 = Color.FromArgb(255,255,255,15); burayı uncommentlersen geri kalanıyla aynı sarı olur
            f.BackColor  = c2;
            f.TextAlign  = ContentAlignment.MiddleCenter;
            _palleteName = f;

            /*
             * fast testing
             * f.ClickAction = () =>
             * {
             *  _prodCap = 5;
             *  _modifiedProgressBar.Maximum = 5;
             *  incementCount(1);
             * };
             */

            motherControlCollection.Add(f);
            motherControlCollection.Add(_modifiedProgressBarFilled);
            motherControlCollection.Add(_modifiedProgressBarDefined);
        }
Beispiel #3
0
        public PalletteVisual(Geometry.Rectangle r, int palleteNo)
        {
            _palleteNo     = palleteNo;
            _thisRectangle = r;
            var centreRect = r.SubRectangle(new Geometry.Rectangle(0f, 1f, 0.2f, 0.7f)); // centre
            var a          = centreRect.SliceVertical(0.05f, 0.95f).Split(staticTexts.Count, 2);

            a = new List <Geometry.Rectangle>
            {
                centreRect.SliceVertical(0.05f, 0.65f),
                centreRect.SliceVertical(0.65f, 0.95f)
            };
            a = new List <Geometry.Rectangle> {
            };
            a.AddRange(centreRect.SliceVertical(0.05f, 0.7f).Split(staticTexts.Count, 1));
            a.AddRange(centreRect.SliceVertical(0.7f, 0.95f).Split(staticTexts.Count, 1));


            _palleteBoxBg = new ModifiedLabel("bg");
            var c1 = Color.FromArgb(255, 255, 255, 15);


            _palleteBoxBg.BackColor = c1;
            _palleteBoxBg.Reorient(centreRect);
            _palleteBoxBg.Text = "";
            for (int i = 0; i < staticTexts.Count; i++)
            {
                var staticText = new ModifiedLabel($"{i}", emSize: 12f);
                staticText.BackColor = c1;
                staticText.Text      = staticTexts[i];
                staticText.Reorient(a[i]);
                staticText.TextAlign = ContentAlignment.MiddleLeft;
                _staticLabels.Add(staticText);

                var dynamicText = new ModifiedLabel($"{i}", emSize: 12f);
                dynamicText.BackColor = c1;
                dynamicText.Text      = "???";
                dynamicText.Reorient(a[i + staticTexts.Count]);
                dynamicText.Parent    = _palleteBoxBg;
                dynamicText.TextAlign = ContentAlignment.MiddleLeft;
                _dynamicLabels.Add(dynamicText);
            }

            _modifiedProgressBarDefined = new ModifiedProgressBar("h", "");
            _modifiedProgressBarDefined.Reorient(r.SubRectangle(new Geometry.Rectangle(0.02f, 0.99f, 0.7f, 0.75f)));

            _modifiedProgressBarFilled = new ModifiedProgressBar("h2", "");
            _modifiedProgressBarFilled.Reorient(r.SubRectangle(new Geometry.Rectangle(0.02f, 0.99f, 0.75f, 0.8f)));
        }
Beispiel #4
0
        public GenericWarning(string warningText = "ben bir uyarıyım", string buttonText = "onay")
        {
            AutoScaleMode = AutoScaleMode.Font;
            ClientSize    = new Size((int)W, (int)H);
            StartPosition = FormStartPosition.CenterParent;
            Text          = @"Uyarı";

            Geometry.Rectangle v = new Geometry.Rectangle(W * 0.1f, W * 0.9f, 0f, H);

            var a = v.Split(2, 1);

            ModifiedLabel textLabel = new ModifiedLabel("warning text", warningText, 12f);

            textLabel.Reorient(a[0]);
            textLabel.TextAlign = ContentAlignment.MiddleCenter;
            Controls.Add(textLabel);

            ModifiedButton confirm = new ModifiedButton("confirm", buttonText);

            confirm.Reorient(a[1].SubRectangle(new Geometry.Rectangle(0.25f, 0.75f, 0.2f, 0.7f)));
            confirm.ClickAction = Close;
            Controls.Add(confirm);
        }
Beispiel #5
0
        public BoxVisuals(int x, int y, int w, int h, bool asVisual = false)
        {
            _asVisual = asVisual;
            _realSize = new Geometry.Rectangle(w, h, new Geometry.Point(x, y));
            if (asVisual)
            {
                _plotIndicator = new Indicator("plc", References.ProjectPath + "Images\\placeholder.jpg");
                _plotIndicator.PaintIndicator(Color.Chartreuse);
                Geometry.Rectangle r3 = _realSize.SliceVertical(0f, 1f);
                _plotIndicator.Reorient(r3);
            }
            else
            {
                // examples

                /*
                 * var sb = new SingleBox("111", "elma", "15", "152", "154",true,0);
                 * boxes.Add(sb);
                 * var sb2 = new SingleBox("111", "elma", "25", "252", "254",true,1);
                 * boxes.Add(sb2);
                 * var sb3 = new SingleBox("111", "elma3", "125", "152", "154",false,0);
                 * boxes.Add(sb3);
                 * var sb4 = new SingleBox("111", "elma1", "225", "252", "254",false,1);
                 * boxes.Add(sb4);
                 */

                // {BackColor = Color.Black};
                _beltIndicator = new Indicator("beltIndicator", References.ProjectPath + "Images\\belt.jpg");
                _beltIndicator.Reorient(_realSize.SubRectangle(_beltRect));
                for (int i = 0; i < 3; i++)
                {
                    //_palleteIndicators[i].BackColor = Color.Black;
                    _palleteIndicators[i].Reorient(_realSize.SubRectangle(_palleteRects[i]));
                    _robotIndicators[i].TextAlign = ContentAlignment.MiddleCenter;
                    _robotIndicators[i].Reorient(_realSize.SubRectangle(_palleteRects[i]).SubRectangle(new Geometry.Rectangle(0.3f, 0.7f, -0.15f, -0.05f)));
                    var j = i;
                    _robotIndicators[i].ClickAction = () =>
                    {
                        RobotOperation(j);
                    };
                }


                for (var j = 0; j < BeltCol; j++)
                {
                    for (var i = 0; i < BeltRow; i++)
                    {
                        var ml = new ModifiedLabel("aa", $"{i}, {j}", 8f)
                        {
                            ForeColor = Color.Black,
                            BackColor = Color.Goldenrod,
                            TextAlign = ContentAlignment.TopCenter
                        };
                        var otb = new Geometry.Rectangle((float)j / BeltCol,
                                                         (float)(j + 1) / BeltCol, (float)i / BeltRow, (float)
                                                         (i + 1) / BeltRow);
                        var tb = _realSize.SubRectangle(_beltRect.SubRectangle(otb)).SubRectangle(new Geometry.Rectangle(0.05f, 0.95f, 0.05f, 0.95f));
                        ml.Reorient(tb);
                        _beltBoxLabels.Add(ml);
                    }
                }

                for (var i = 0; i < RobotRow; i++)
                {
                    for (var j = 0; j < RobotCol; j++)
                    {
                        var index = 0;
                        foreach (var e in _palleteRects)
                        {
                            var ml = new ModifiedLabel("aa", $"{i}, {j}", 8f)
                            {
                                ForeColor = Color.Black,
                                BackColor = Color.Goldenrod,
                                TextAlign = ContentAlignment.TopCenter
                            };
                            var otb = new Geometry.Rectangle((float)j / RobotCol,
                                                             (float)(j + 1) / RobotCol, (float)i / RobotRow, (float)
                                                             (i + 1) / RobotRow);
                            var tb = _realSize.SubRectangle(e.SubRectangle(otb)).SubRectangle(new Geometry.Rectangle(0.05f, 0.95f, 0.05f, 0.95f));
                            ml.Reorient(tb);
                            _robotLabels[index].Add(ml);
                            index++;
                        }
                    }
                }
            }
            Refresh();
        }
Beispiel #6
0
        public PalletePopup()
        {
            AutoScaleMode = AutoScaleMode.Font;
            ClientSize    = new Size((int)w, (int)h);
            Text          = @"Palet Ekleme";
            Geometry.Rectangle v = new Geometry.Rectangle(w * 0.1f, w * 0.9f, 0f, h);


            var helpfulText = new ModifiedLabel("warn", "*Hücre no seçimi yapın.");

            helpfulText.Reorient(v.SliceHorizontal(0.5f, 0.75f));
            helpfulText.ForeColor  = Color.Red;
            helpfulText.ImageAlign = ContentAlignment.TopLeft;
            helpfulText.Visible    = false;
            Controls.Add(helpfulText);



            // buttons
            var buttonsRect = v.SliceHorizontal(0.75f, 0.9f);

            _confButton = new ModifiedButton("onay", "Onay");
            _confButton.Reorient(buttonsRect.SliceVertical(0.1f, 0.4f));
            _confButton.ClickAction = () =>
            {
                if (cb.SelectedIndex != -1)
                {
                    Confirmed = true;
                    Close();
                }
                else
                {
                    helpfulText.Visible = true;
                }
            };
            _confButton.Enabled = false;


            var exit = new ModifiedButton("çık", "Çık");

            exit.Reorient(buttonsRect.SliceVertical(0.6f, 0.9f));
            exit.ClickAction = Close;

            Controls.Add(_confButton);
            Controls.Add(exit);


            for (float i = 0; i < 3; i++)
            {
                var mrb = new ModifiedRadioButton("radio");
                mrb.Reorient(v.SliceHorizontal(1f / 8f, 2f / 8f).SliceVertical(i / 3f, (i + 1) / 3f));
                mrb.Text = $"Hücre {i+1}";
                var i1 = i;
                mrb.ClickAction = () =>
                {
                    if (RobotNo == 0)
                    {
                        _confButton.Enabled = true;
                    }
                    RobotNo = (int)i1 + 1;
                };


                Controls.Add(mrb);
            }



            cb.Reorient(v.SliceHorizontal(2.5f / 8f, 4f / 8f));
            //cb.IntegralHeight = false;
            cb.MaxDropDownItems = 5;
            cb.DropDownStyle    = ComboBoxStyle.Simple;
            //cb.DropDownStyle = ComboBoxStyle.DropDownList;
            cb.AutoCompleteMode = AutoCompleteMode.Append;
            cb.TabIndex         = 0;
            Controls.Add(cb);
        }