예제 #1
0
        private void AlgorithmRemoveEvent(object sender, SortedItem e)
        {
            if (SpeedTrackBar.Value > 0)
            {
                e.SetColor(Color.Black);

                VisualPanel.Refresh();

                SortedItem.Remove(e);

                VisualPanel.Refresh();
            }
        }
예제 #2
0
        private void AlgorithmCompareEvent(object sender, Tuple <SortedItem, SortedItem> e)
        {
            if (SpeedTrackBar.Value > 0)
            {
                e.Item1.SetColor(Color.Green);
                e.Item2.SetColor(Color.Yellow);

                VisualPanel.Refresh();

                System.Threading.Thread.Sleep(delayMilliSeconds * SpeedTrackBar.Value - 1);

                e.Item1.SetColor(Color.Blue);
                e.Item2.SetColor(Color.Blue);

                VisualPanel.Refresh();
            }
        }
예제 #3
0
        private void AlgorithmSwapEvent(object sender, Tuple <SortedItem, SortedItem> e)
        {
            if (SpeedTrackBar.Value > 0)
            {
                e.Item1.SetColor(Color.Red);
                e.Item2.SetColor(Color.Red);

                VisualPanel.Refresh();

                SortedItem.SwapPosition(e.Item1, e.Item2);

                System.Threading.Thread.Sleep(delayMilliSeconds * SpeedTrackBar.Value - 1);

                e.Item1.SetColor(Color.Blue);
                e.Item2.SetColor(Color.Blue);

                VisualPanel.Refresh();
            }
        }
예제 #4
0
        public static void DynamicPanel(FlowLayoutPanel layout, VisualPanel panel, VisualPanel menu)
        {
            if (panel.Visible == false)
            {
                layout.Height += panel.Height;
                panel.Visible  = true;

                var backColor = Color.FromArgb(26, 32, 44);
                menu.BackColorState.Enabled = backColor;
                foreach (var image in menu.Controls.OfType <PictureBox>())
                {
                    image.Image     = Resources.firmar;
                    image.BackColor = backColor;
                }

                foreach (var label in menu.Controls.OfType <Label>())
                {
                    label.BackColor = backColor;
                }

                menu.Refresh();
            }
            else
            {
                layout.Height -= panel.Height;
                panel.Visible  = false;

                var backColor = Color.FromArgb(46, 55, 72);
                menu.BackColorState.Enabled = backColor;
                foreach (var image in menu.Controls.OfType <PictureBox>())
                {
                    image.Image     = Resources.plus23;
                    image.BackColor = backColor;
                }

                foreach (var label in menu.Controls.OfType <Label>())
                {
                    label.BackColor = backColor;
                }

                menu.Refresh();
            }
        }
예제 #5
0
        public void RefreshVisualZoneData()
        {
            try
            {
                VisualPanel.Refresh();
                if (!DataZoneKeepEmpty)
                {
                    Graphics g             = VisualPanel.CreateGraphics();
                    int[]    bytes_indexes = DataMaster.GetBytesStartEndIndexes(mVisualZone.StartRowNumber, mVisualZone.StartRowNumber + mVisualZone.VisualRowsAmount - 1);
                    mVisualZone.DrawVisualZone(ref g, mDataMaster.PickOutVisualBytes(bytes_indexes));
                }

                ReDrawBlockAddress();
                RefreshScrollBarValues();
                DataZoneKeepEmpty = false;
            }
            catch
            {
            }
        }
예제 #6
0
 private void RefillItems(bool enableVisualization = true)
 {
     if (enableVisualization)
     {
         VisualPanel.Controls.Clear();
     }
     sortedItemsCount = 0;
     items.Clear();
     for (int i = 0; i < values.Count; i++)
     {
         if (enableVisualization)
         {
             SortedItem item = new SortedItem(VisualPanel, ++sortedItemsCount, values[i]);
             items.Add(item);
             VisualPanel.Refresh();
         }
         else
         {
             SortedItem item = new SortedItem(++sortedItemsCount, values[i]);
             items.Add(item);
         }
     }
 }
예제 #7
0
        private void LoadMesas(string searchText = "")
        {
            flowLayout.Controls.Clear();

            var txtSearch = $"%{searchText}%";
            if (IniFile.Read("MesasPreCadastrada", "Comercial") == "True")
            {
                var mesas = new Model.Mesas().FindAll().WhereFalse("excluir").Where("mesa", "like", txtSearch)
                    .Get<Model.Mesas>();
                if (mesas.Any())
                    foreach (var mesa in mesas)
                    {
                        var idMesa = mesa.Mesa;

                        var pedidoItem = new PedidoItem().FindAll().WhereFalse("excluir").Where("pedido", 0)
                            .Where("mesa", idMesa).FirstOrDefault<PedidoItem>();

                        var panel1 = new VisualPanel
                        {
                            Anchor = AnchorStyles.Top | AnchorStyles.Left
                                                      | AnchorStyles.Right,
                            BackColor = Color.Transparent,
                            BackColorState
                                = {Disabled = Color.FromArgb(224, 224, 224), Enabled = Color.FromArgb(249, 249, 249)},
                            BackgroundImageLayout = ImageLayout.Zoom,
                            Border =
                            {
                                Color = Color.FromArgb(224, 224, 224),
                                HoverColor = Color.FromArgb(224, 224, 224),
                                HoverVisible = true,
                                Rounding = 6,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            ForeColor = Color.FromArgb(0, 0, 0),
                            Location = new Point(3, 3),
                            MouseState = MouseStates.Normal,
                            Name = $"{idMesa}mesa",
                            Cursor = Cursors.Hand,
                            Padding = new Padding(5),
                            Size = new Size(229, 140),
                            TabIndex = 40060,
                            Text = @"visualPanel2",
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };

                        #region panel2

                        var panel2 = new VisualPanel
                        {
                            BackColor = Color.Gray,
                            BackColorState = {Disabled = Color.FromArgb(224, 224, 224), Enabled = Color.Gray},
                            Border =
                            {
                                Color = Color.Gray,
                                HoverColor = Color.Gray,
                                HoverVisible = true,
                                Rounding = 6,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            ForeColor = Color.FromArgb(0, 0, 0),
                            Location = new Point(0, 0),
                            MouseState = MouseStates.Normal,
                            Name = "visualPanel1",
                            Padding = new Padding(5),
                            Size = new Size(229, 41),
                            TabIndex = 11,
                            Text = @"visualPanel1",
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };

                        var txtNrMesa = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.Gray,
                            Font = new Font("Segoe UI", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.White,
                            Location = new Point(33, 8),
                            Name = $"{idMesa}",
                            Size = new Size(34, 25),
                            TabIndex = 6,
                            Text = mesa.Mesa
                        };
                        txtNrMesa.Click += ActionMesa;

                        var check = new VisualCheckBox
                        {
                            BackColor = Color.Gray,
                            Border =
                            {
                                Color = Color.White,
                                HoverColor = Color.White,
                                HoverVisible = true,
                                Rounding = 3,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            Box = new Size(14, 14),
                            BoxColorState =
                            {
                                Disabled = Color.FromArgb(224, 224, 224),
                                Enabled = Color.White,
                                Hover = Color.White,
                                Pressed = Color.White
                            },
                            BoxSpacing = 2,
                            CheckStyle =
                            {
                                AutoSize = true,
                                Bounds = new Rectangle(0, 0, 125, 23),
                                Character = '✔',
                                CheckColor = Color.Gray,
                                Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point,
                                    0),
                                ShapeRounding = 3,
                                ShapeType = ShapeTypes.Rounded,
                                Style = CheckStyle.CheckType.Checkmark,
                                Thickness = 2F
                            },
                            Cursor = Cursors.Hand,
                            ForeColor = Color.FromArgb(0, 0, 0),
                            IsBoxLarger = false,
                            Location = new Point(9, 9),
                            MouseState = MouseStates.Normal,
                            Name = $"{idMesa}check",
                            Size = new Size(18, 23),
                            TabIndex = 9,
                            TextSize = new Size(0, 0),
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            },
                            Checked = false
                        };
                        check.Click += ActionCheck;

                        if (pedidoItem == null)
                            check.Visible = false;

                        panel2.Controls.Add(check);
                        panel2.Controls.Add(txtNrMesa);

                        #endregion

                        var subTotal = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 112),
                            Name = "label13",
                            Size = new Size(54, 15),
                            TabIndex = 15,
                            Text = @"Subtotal:"
                        };

                        var txtSubTotal = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 112),
                            Name = "label12",
                            Size = new Size(56, 15),
                            TabIndex = 16,
                            Text = pedidoItem != null
                                ? $"R$ {Validation.FormatPrice(GetSubTotal(idMesa))}"
                                : "R$ 00,00"
                        };


                        var hra = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 91),
                            Name = "label3",
                            Size = new Size(46, 15),
                            TabIndex = 7,
                            Text = @"Tempo:"
                        };

                        var txtHra = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 91),
                            Name = "label11",
                            Size = new Size(56, 15),
                            TabIndex = 14
                        };

                        if (pedidoItem != null)
                        {
                            var date = DateTime.Now;
                            var hourMesa = date.AddHours(-GetData(idMesa).Criado.Hour);
                            var minMesa = date.AddMinutes(-GetData(idMesa).Criado.Minute);

                            txtHra.Text = $@"{hourMesa.Hour}h {minMesa.Minute}m";
                        }
                        else
                        {
                            txtHra.Text = @"00h 00m";
                        }

                        var status = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 70),
                            Name = "label7",
                            Size = new Size(42, 15),
                            TabIndex = 10,
                            Text = @"Status:"
                        };

                        var txtStatus = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            Location = new Point(72, 70),
                            Name = "label10",
                            Size = new Size(56, 15),
                            ForeColor = pedidoItem != null ? Color.Red : Color.Green,
                            Text = pedidoItem != null ? "Ocupado" : "Livre"
                        };


                        var atendente = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 49),
                            Name = "label4",
                            Size = new Size(65, 15),
                            TabIndex = 8,
                            Text = @"Atendente:"
                        };

                        var txtAtendente = new Label
                        {
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 49),
                            Name = "label9",
                            Size = new Size(151, 15),
                            TabIndex = 12
                        };

                        if (txtStatus.Text == @"Ocupado")
                        {
                            var userName = GetUsuario(idMesa) == null ? "" : GetUsuario(idMesa).Nome;
                            txtAtendente.Text = $@"{Validation.FirstCharToUpper(userName)}";
                        }
                        else
                        {
                            txtAtendente.Text = "";
                        }

                        panel1.Controls.Add(txtSubTotal);
                        panel1.Controls.Add(subTotal);
                        panel1.Controls.Add(txtHra);
                        panel1.Controls.Add(txtStatus);
                        panel1.Controls.Add(txtAtendente);
                        panel1.Controls.Add(panel2);
                        panel1.Controls.Add(status);
                        panel1.Controls.Add(atendente);
                        panel1.Controls.Add(hra);

                        flowLayout.Controls.Add(panel1);
                    }
            }
            else
            {
                var mesas = _mPedidoItem.FindAll(new[] {"mesa"}).Where("pedido", 0).Where("mesa", "like", txtSearch)
                    .GroupBy("mesa").Get();
                if (mesas != null)
                    foreach (var mesa in mesas)
                    {
                        string idMesa = mesa.MESA.ToString();

                        var panel1 = new VisualPanel
                        {
                            Anchor = AnchorStyles.Top | AnchorStyles.Left
                                                      | AnchorStyles.Right,
                            BackColor = Color.Transparent,
                            BackColorState =
                                {Disabled = Color.FromArgb(224, 224, 224), Enabled = Color.FromArgb(249, 249, 249)},
                            BackgroundImageLayout = ImageLayout.Zoom,
                            Border =
                            {
                                Color = Color.FromArgb(224, 224, 224),
                                HoverColor = Color.FromArgb(224, 224, 224),
                                HoverVisible = true,
                                Rounding = 6,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            ForeColor = Color.FromArgb(0, 0, 0),
                            Location = new Point(3, 3),
                            MouseState = MouseStates.Normal,
                            Name = $"{idMesa}mesa",
                            Cursor = Cursors.Hand,
                            Padding = new Padding(5),
                            Size = new Size(229, 140),
                            TabIndex = 40060,
                            Text = @"visualPanel2",
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };

                        #region panel2

                        var panel2 = new VisualPanel
                        {
                            BackColor = Color.Gray,
                            BackColorState = {Disabled = Color.FromArgb(224, 224, 224), Enabled = Color.Gray},
                            Border =
                            {
                                Color = Color.Gray,
                                HoverColor = Color.Gray,
                                HoverVisible = true,
                                Rounding = 6,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            ForeColor = Color.FromArgb(0, 0, 0),
                            Location = new Point(0, 0),
                            MouseState = MouseStates.Normal,
                            Name = "visualPanel1",
                            Padding = new Padding(5),
                            Size = new Size(229, 41),
                            TabIndex = 11,
                            Text = @"visualPanel1",
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };

                        var txtNrMesa = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.Gray,
                            Font = new Font("Segoe UI", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.White,
                            Location = new Point(33, 8),
                            Name = $"{idMesa}",
                            Size = new Size(34, 25),
                            TabIndex = 6,
                            Text = mesa.MESA.ToString()
                        };
                        txtNrMesa.Click += ActionMesa;

                        var check = new VisualCheckBox
                        {
                            Checked = false,
                            BackColor = Color.Gray,
                            Border =
                            {
                                Color = Color.White,
                                HoverColor = Color.White,
                                HoverVisible = true,
                                Rounding = 3,
                                Thickness = 1,
                                Type = ShapeTypes.Rounded,
                                Visible = true
                            },
                            Box = new Size(14, 14),
                            BoxColorState =
                            {
                                Disabled = Color.FromArgb(224, 224, 224),
                                Enabled = Color.White,
                                Hover = Color.White,
                                Pressed = Color.White
                            },
                            BoxSpacing = 2,
                            CheckStyle =
                            {
                                AutoSize = true,
                                Bounds = new Rectangle(0, 0, 125, 23),
                                Character = '✔',
                                CheckColor = Color.Gray,
                                Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point,
                                    0),
                                ShapeRounding = 3,
                                ShapeType = ShapeTypes.Rounded,
                                Style = CheckStyle.CheckType.Checkmark,
                                Thickness = 2F
                            },
                            Cursor = Cursors.Hand,
                            ForeColor = Color.FromArgb(0, 0, 0),
                            IsBoxLarger = false,
                            Location = new Point(9, 9),
                            MouseState = MouseStates.Normal,
                            Name = $"{idMesa}check",
                            Size = new Size(18, 23),
                            TabIndex = 9,
                            TextSize = new Size(0, 0),
                            TextStyle =
                            {
                                Disabled = Color.FromArgb(131, 129, 129),
                                Enabled = Color.FromArgb(0, 0, 0),
                                Hover = Color.FromArgb(0, 0, 0),
                                Pressed = Color.FromArgb(0, 0, 0),
                                TextAlignment = StringAlignment.Center,
                                TextLineAlignment = StringAlignment.Center,
                                TextRenderingHint = TextRenderingHint.ClearTypeGridFit
                            }
                        };
                        check.Click += ActionCheck;

                        panel2.Controls.Add(check);
                        panel2.Controls.Add(txtNrMesa);

                        #endregion

                        var subTotal = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 112),
                            Name = "label13",
                            Size = new Size(54, 15),
                            TabIndex = 15,
                            Text = @"Subtotal:"
                        };

                        var txtSubTotal = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 112),
                            Name = "label12",
                            Size = new Size(56, 15),
                            TabIndex = 16,
                            Text = $@"R$ {Validation.FormatPrice(GetSubTotal(idMesa))}"
                        };

                        var hra = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 91),
                            Name = "label3",
                            Size = new Size(46, 15),
                            TabIndex = 7,
                            Text = @"Tempo:"
                        };

                        var txtHra = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 91),
                            Name = "label11",
                            Size = new Size(56, 15),
                            TabIndex = 14
                        };

                        var date = DateTime.Now;
                        var hourMesa = date.AddHours(-GetData(idMesa).Criado.Hour);
                        var minMesa = date.AddMinutes(-GetData(idMesa).Criado.Minute);

                        txtHra.Text = $@"{hourMesa.Hour}h {minMesa.Minute}m";

                        var status = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 70),
                            Name = "label7",
                            Size = new Size(42, 15),
                            TabIndex = 10,
                            Text = @"Status:"
                        };

                        var txtStatus = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Red,
                            Location = new Point(72, 70),
                            Name = "label10",
                            Size = new Size(56, 15),
                            TabIndex = 13,
                            Text = @"Ocupado"
                        };

                        var atendente = new Label
                        {
                            AutoSize = true,
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                            ForeColor = Color.DarkGray,
                            Location = new Point(5, 49),
                            Name = "label4",
                            Size = new Size(65, 15),
                            TabIndex = 8,
                            Text = @"Atendente:"
                        };

                        var txtAtendente = new Label
                        {
                            BackColor = Color.FromArgb(249, 249, 249),
                            Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 0),
                            ForeColor = Color.Gray,
                            Location = new Point(72, 49),
                            Name = "label9",
                            Size = new Size(151, 15),
                            TabIndex = 12
                        };

                        var userName = GetUsuario(idMesa) == null ? "" : GetUsuario(idMesa).Nome;
                        txtAtendente.Text = $@"{userName}";

                        panel1.Controls.Add(txtSubTotal);
                        panel1.Controls.Add(subTotal);
                        panel1.Controls.Add(txtHra);
                        panel1.Controls.Add(txtStatus);
                        panel1.Controls.Add(txtAtendente);
                        panel1.Controls.Add(panel2);
                        panel1.Controls.Add(status);
                        panel1.Controls.Add(atendente);
                        panel1.Controls.Add(hra);

                        flowLayout.Controls.Add(panel1);
                    }
            }
        }
예제 #8
0
        private void Initialization()
        {
            Interface.Surface.GetScreenSize(out int ScreenWidth, out int ScreenHeight);

            #region Buttons
            VisualButton  = new Button();
            ESPButton     = new Button();
            ChamsButton   = new Button();
            SkinButton    = new Button();
            MiscButton    = new Button();
            ProfileButton = new Button();
            #endregion

            VisualButton.BackColor       = Color.FromArgb(18, 21, 26);
            VisualButton.ForeColor       = Color.FromArgb(152, 241, 221);
            VisualButton.Font            = new Font("Tahoma", 20, Font.FontFlags.FONTFLAG_ANTIALIAS);
            VisualButton.Position        = new Point(0, 37);
            VisualButton.Size            = new Size(200, 60);
            VisualButton.Visible         = true;
            VisualButton.MouseLeftClick += VisualButton_MouseLeftClick;

            ESPButton.BackColor       = Color.FromArgb(25, 30, 37);
            ESPButton.Font            = new Font("Tahoma", 20, Font.FontFlags.FONTFLAG_ANTIALIAS);
            ESPButton.Position        = new Point(0, 99);
            ESPButton.Size            = new Size(200, 60);
            ESPButton.Visible         = true;
            ESPButton.MouseLeftClick += ESPButton_MouseLeftClick;

            ChamsButton.BackColor       = Color.FromArgb(25, 30, 37);
            ChamsButton.Font            = new Font("Tahoma", 20, Font.FontFlags.FONTFLAG_ANTIALIAS);
            ChamsButton.Position        = new Point(0, 161);
            ChamsButton.Size            = new Size(200, 60);
            ChamsButton.Visible         = true;
            ChamsButton.MouseLeftClick += ChamsButton_MouseLeftClick;

            SkinButton.BackColor       = Color.FromArgb(25, 30, 37);
            SkinButton.Font            = new Font("Tahoma", 20, Font.FontFlags.FONTFLAG_ANTIALIAS);
            SkinButton.Position        = new Point(0, 223);
            SkinButton.Size            = new Size(200, 60);
            SkinButton.Visible         = true;
            SkinButton.MouseLeftClick += SkinButton_MouseLeftClick;

            MiscButton.BackColor       = Color.FromArgb(25, 30, 37);
            MiscButton.Font            = new Font("Tahoma", 20, Font.FontFlags.FONTFLAG_ANTIALIAS);
            MiscButton.Position        = new Point(0, 285);
            MiscButton.Size            = new Size(200, 60);
            MiscButton.Visible         = true;
            MiscButton.MouseLeftClick += MiscButton_MouseLeftClick;

            ProfileButton.BackColor       = Color.FromArgb(25, 30, 37);
            ProfileButton.Font            = new Font("Tahoma", 20, Font.FontFlags.FONTFLAG_ANTIALIAS);
            ProfileButton.Position        = new Point(0, 347);
            ProfileButton.Size            = new Size(200, 60);
            ProfileButton.Visible         = true;
            ProfileButton.MouseLeftClick += ProfileButton_MouseLeftClick;

            Text      = "TRION";
            Size      = new Size(800, 407);
            Position  = new Point((ScreenWidth / 2) - (Size.Width / 2), (ScreenHeight / 2) - (Size.Height / 2));
            Font      = new Font("Impact", 25, Font.FontFlags.FONTFLAG_ANTIALIAS);
            BackColor = Color.FromArgb(18, 21, 26);
            KeyDown  += Main_KeyDown;

            this["VisualButton", "Visual"]   = VisualButton;
            this["ESPButton", "ESP"]         = ESPButton;
            this["ChamsButton", "Chams"]     = ChamsButton;
            this["SkinButton", "Skins"]      = SkinButton;
            this["MiscButton", "Misc"]       = MiscButton;
            this["ProfileButton", "Profile"] = ProfileButton;

            this["VisualPanel", true] = new VisualPanel(Position, new Point(202, 37))
            {
                Visible = true
            };
        }
예제 #9
0
        private void SortButton_Click(object sender, EventArgs e)
        {
            if (sortedItemsCount > 0)
            {
                (sender as Button).Enabled = false;

                int methods = 1;

                if (SpeedTrackBar.Value == 0)
                {
                    SpeedTrackBar.Enabled = false;
                    methods = allMethods.GetLength(0);
                    VisualPanel.Controls.Clear();
                }

                string methodName = "";
                for (int methodNumber = 1; methodNumber <= methods; methodNumber++)
                {
                    Label label = new Label();
                    AlgorithmBase <SortedItem> algorithm = new AlgorithmBase <SortedItem>();

                    if (SpeedTrackBar.Value > 0)
                    {
                        foreach (RadioButton radioButton in panel3.Controls.OfType <RadioButton>())
                        {
                            if (radioButton.Checked)
                            {
                                if (!Int32.TryParse(radioButton.Name.Substring("radioButton".Length), out methodNumber))
                                {
                                    methodNumber = 1;
                                }
                                break;
                            }
                        }
                    }

                    if (panel3.Controls.Find("radioButton" + methodNumber.ToString(), false).Any())
                    {
                        methodName = panel3.Controls["radioButton" + methodNumber.ToString()].Text;
                    }

                    switch (methodName)
                    {
                    case "Bubble Sort":
                        algorithm = new BubbleSort <SortedItem>();
                        break;

                    case "Cocktail Sort":
                        algorithm = new CocktailSort <SortedItem>();
                        break;

                    case "Insertion Sort":
                        algorithm = new InsertionSort <SortedItem>();
                        break;

                    case "Shell Sort":
                        algorithm = new ShellSort <SortedItem>();
                        break;

                    case "Tree Sort":
                        algorithm = new Algorithm.DataStructures.Tree <SortedItem>();
                        break;

                    case "Heap Sort":
                        algorithm = new Algorithm.DataStructures.Heap <SortedItem>();
                        break;

                    case "Selection Sort":
                        algorithm = new SelectionSort <SortedItem>();
                        break;

                    case "Gnome Sort":
                        algorithm = new GnomeSort <SortedItem>();
                        break;

                    case "Radix Sort":
                        algorithm = new RadixSort <SortedItem>(RadixSortCheckBox.Checked);
                        break;

                    case "Merge Sort":
                        algorithm = new MergeSort <SortedItem>();
                        break;

                    case "Quick Sort":
                        algorithm = new QuickSort <SortedItem>();
                        break;

                    case "Odd-Even Sort":
                        algorithm = new OddEvenSort <SortedItem>();
                        break;

                    case "Comb Sort":
                        algorithm = new CombSort <SortedItem>();
                        break;

                    default:
                        algorithm = new BubbleSort <SortedItem>();
                        break;
                    }
                    //MessageBox.Show("Вы выбрали метод сортировки " + panel3.Controls["radioButton" + methodNumber.ToString()].Text + " : " + methodNumber.ToString());

                    if (SpeedTrackBar.Value > 0)
                    {
                        algorithm.CompareEvent += AlgorithmCompareEvent;
                        algorithm.SwapEvent    += AlgorithmSwapEvent;
                        algorithm.RemoveEvent  += AlgorithmRemoveEvent;
                    }
                    else
                    {
                        int verticalInterval = 15;
                        if (methodNumber > 1 && ((methodNumber - 1) % (VisualPanel.Height / verticalInterval)) == 0)
                        {
                            VisualPanel.Controls.Clear();
                        }
                        label.Name     = "label_" + methodNumber.ToString();
                        label.Text     = "Идет сортировка массива из " + items.Count.ToString() + " элементов по методу " + panel3.Controls["radioButton" + methodNumber.ToString()].Text + " ...";
                        label.AutoSize = true;
                        label.Location = new Point(5, verticalInterval * ((methodNumber - 1) % (VisualPanel.Height / verticalInterval)));
                        VisualPanel.Controls.Add(label);
                        VisualPanel.Refresh();
                    }

                    algorithm.AddRange(items);
                    TimeSpan runTime = algorithm.SortAndGetSpan(!reverseSortCheckBox.Checked);

                    if (SpeedTrackBar.Value == 0)
                    {
                        label.Text = "Сортировка " + items.Count.ToString() + " элементов по методу " + panel3.Controls["radioButton" + methodNumber.ToString()].Text + " завершена.";
                    }
                    else if (methodName == "Heap Sort")
                    {
                        VisualPanel.Controls.Clear();
                        sortedItemsCount = 0;
                        for (int i = 0; i < algorithm.Items.Count; i++)
                        {
                            SortedItem item = new SortedItem(VisualPanel, ++sortedItemsCount, algorithm.Items[i].Value);
                            VisualPanel.Refresh();
                        }
                        VisualPanel.Refresh();
                    }

                    ResultTableLayoutPanel.GetControlFromPosition(methodNumber, 3).Text = runTime.Seconds.ToString() + "." + runTime.Milliseconds.ToString();
                    ResultTableLayoutPanel.GetControlFromPosition(methodNumber, 4).Text = algorithm.ComparisonCount.ToString();
                    ResultTableLayoutPanel.GetControlFromPosition(methodNumber, 5).Text = algorithm.SwapCount.ToString();

                    VisualPanel.Refresh();
                }

                SpeedTrackBar.Enabled = true;

                if (SpeedTrackBar.Value == 0)
                {
                    for (int i = 1; i <= 3; i++)
                    {
                        ResultTableLayoutPanel.Controls["TestsRadioButton_" + i.ToString()].Enabled = true;
                    }
                }
            }
        }