Beispiel #1
0
        public Bitmap DrawPieChart(List <Tuple <string, float> > data)
        {
            int   pieSize   = (Int32)(UI_General.GetSizeScreen().Width / 6.4);
            float prevStart = 0;

            Bitmap   result = new Bitmap(pieSize, pieSize);
            Graphics g      = Graphics.FromImage(result);

            float totalValue = 0;

            for (int i = 0; i < data.Count; i++)
            {
                totalValue += data[i].Item2;
            }

            for (int i = 0; i < data.Count; i++)
            {
                g.FillPie(new SolidBrush(ShowStatistics.DetermineColor()), new Rectangle(0, 0, pieSize, pieSize), prevStart, (data[i].Item2 / totalValue) * 360);
                prevStart += (data[i].Item2 / totalValue) * 360;
            }

            ShowStatistics.getUsedColors().Clear();

            return(result);
        }
Beispiel #2
0
        private void SetElements()
        {
            UI_General._labelWhite.Height = (Convert.ToInt32(UI_General.GetSizeScreen().Height * 0.64));
            UI_General._labelWhite.Controls.Add(_backBtn);
            UI_General._labelWhite.Controls.Add(_fwdBtn);
            UI_General._labelWhite.Controls.Add(_itemImage);
            UI_General._labelWhite.Controls.Add(_description);
            UI_General._labelWhite.Controls.Add(_technicalSpecs);
            Controls.Add(_homeBtn);


            int containerHeight = UI_General._labelWhite.Height;
            int containerWidth  = UI_General._labelWhite.Width;

            _backBtn.Size = new Size(100, 100);
            _fwdBtn.Size  = new Size(100, 100);
            _homeBtn.Size = new Size(50, 50);


            _backBtn.BackgroundImage       = new Bitmap(projectFolder + @"Pictures\general\back.png");
            _backBtn.BackgroundImageLayout = ImageLayout.Stretch;
            _fwdBtn.BackgroundImage        = new Bitmap(projectFolder + @"Pictures\general\forward.png");
            _fwdBtn.BackgroundImageLayout  = ImageLayout.Stretch;
            _homeBtn.BackgroundImage       = new Bitmap(projectFolder + @"Pictures\general\home_icon.png");
            _homeBtn.BackgroundImageLayout = ImageLayout.Stretch;
            _homeBtn.BackColor             = Color.Transparent;
            _backBtn.BackColor             = _fwdBtn.BackColor = Color.White;

            double verticalSpacing = (containerHeight - _backBtn.Height) / 2;

            _backBtn.Top += Convert.ToInt32(verticalSpacing);

            _fwdBtn.Top  += Convert.ToInt32(verticalSpacing);
            _fwdBtn.Left += Convert.ToInt32(containerWidth - _fwdBtn.Width);


            int home_x = Convert.ToInt32(UI_General.GetSizeScreen().Width * 0.95);
            int home_y = Convert.ToInt32(UI_General.GetSizeScreen().Height * 0.95 - _homeBtn.Height);

            _homeBtn.Location = new Point(home_x, home_y);

            _backBtn.Click += _backBtn_Click;
            _fwdBtn.Click  += _fwdBtn_Click;
            _homeBtn.Click += _homeBtn_Click;

            _description.Size           = new Size(350, 400);
            _technicalSpecs.Size        = new Size(250, 200);
            _description.Font           = new Font("Century Gothic", 14);
            _technicalSpecs.Font        = new Font("Arial", 10);
            _description.ReadOnly       = true;
            _technicalSpecs.ReadOnly    = true;
            _description.Enter         += _description_Enter;
            _technicalSpecs.Enter      += _description_Enter;
            _description.BorderStyle    = BorderStyle.None;
            _description.BackColor      = Color.White;
            _technicalSpecs.BorderStyle = BorderStyle.None;
            _technicalSpecs.BackColor   = Color.White;
        }
Beispiel #3
0
 public UI_WhatsInside()
 {
     this.DoubleBuffered = true;
     InitializeComponent();
     UI_General.SetGeneralElements(this);
     InstantiateElements();
     SetElements();
     BringElementsToFront();
     SetDefaultScreen();
     ConnectToDB();
 }
Beispiel #4
0
 public UI_DYK(int displayQuestion)
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     UI_General.SetGeneralElements(this);
     _dykForm         = this;
     _displayQuestion = displayQuestion;
     _numQuestions    = GetNumQuestions();
     _answers         = GetRightAnswers();
     InstantiateElements();
     SetUniqueElements();
     AddControlsToContainer();
     AddEventHandlers();
     UpdateDisplay();
 }
        public UI_Default(bool quitForm)
        {
            defaultForm = this;
            _quitForm   = quitForm;

            InitializeComponent();
            this.DoubleBuffered = true;
            this.FormClosing   += UI_Default_FormClosing;
            UI_General.SetGeneralElements(this);
            UI_General._labelWhite._BackColor = Color.Transparent;
            SetUniqueElements();
            SetRfidTriggerBox();
            AddAndBringToFrontControls();
            AddEventHandlers();
        }
        public void SetRfidTriggerBox()
        {
            _rfidTriggerTextBox              = new TextBox();
            _rfidTriggerTextBox.BackColor    = Color.Black;
            _rfidTriggerTextBox.TextChanged += _rfidScanned;
            _rfidTriggerTextBox.ForeColor    = Color.Black;
            _rfidTriggerTextBox.BorderStyle  = BorderStyle.None;
            _rfidTriggerTextBox.Font         = UI_General.GetLabelGrayFont();
            _rfidTriggerTextBox.Location     = new Point(Convert.ToInt32(UI_General.GetSizeScreen().Width * 0.5) - Convert.ToInt32(UI_General.GetSizeScreen().Width * 0.1), Convert.ToInt32(UI_General.GetSizeScreen().Height * 0.9));
            _rfidTriggerTextBox.Size         = new Size(0, 0);
            _rfidTriggerTextBox.Text         = "";
            _rfidTriggerTextBox.TabIndex     = 0;

            _rfidTriggerTextBox.Select();

            Controls.Add(_rfidTriggerTextBox);
        }
Beispiel #7
0
 public UI_Default()
 {
     InitializeComponent();
     UI_General.SetGeneralElements(this);
 }
        public void SetUniqueElements()
        {
            // Instantiate elements
            _didYouKnowBtn          = new Button();
            _whatsInsideBtn         = new Button();
            _leaveSomeFeedbackBtn   = new Button();
            projectFolder           = UI_General.GetProjectFolder();
            _didYouKnowLabel        = new Label();
            _whatsInsideLabel       = new Label();
            _leaveSomeFeedbackLabel = new Label();
            _leaveSomeFeedbackPanel = new Panel();
            _whatsInsidePanel       = new Panel();
            _didYouKnowPanel        = new Panel();
            _rfidScanImage          = new Button();


            //_rfidScanLabel = new Label();



            UI_General._labelWhite.Controls.Add(_didYouKnowPanel);
            UI_General._labelWhite.Controls.Add(_whatsInsidePanel);
            UI_General._labelWhite.Controls.Add(_leaveSomeFeedbackPanel);

            double containerWidth  = UI_General._labelWhite.Width;
            double containerHeight = UI_General._labelWhite.Height;

            _didYouKnowPanel.Size      = new Size(200, 250);
            _didYouKnowPanel.BackColor = Color.Transparent;
            _didYouKnowPanel.Top      += 50;
            double spacing = (containerWidth - _didYouKnowPanel.Width * 3) / 4;

            _didYouKnowPanel.Left += Convert.ToInt16(spacing);

            _whatsInsidePanel.Size      = new Size(200, 250);
            _whatsInsidePanel.BackColor = Color.Transparent;
            _whatsInsidePanel.Top      += 50;
            _whatsInsidePanel.Left     += Convert.ToInt16(spacing + _whatsInsidePanel.Width + spacing + _whatsInsidePanel.Width + spacing);

            _leaveSomeFeedbackPanel.Size      = new Size(200, 250);
            _leaveSomeFeedbackPanel.BackColor = Color.Transparent;
            _leaveSomeFeedbackPanel.Top      += 50;
            _leaveSomeFeedbackPanel.Left     += Convert.ToInt16(spacing + _leaveSomeFeedbackPanel.Width + spacing);


            //Set their properties
            _rfidScanImage.Size                              = new Size(Convert.ToInt32(350 * 0.75), Convert.ToInt32(100 * 0.75));
            _rfidScanImage.Location                          = new Point(Convert.ToInt32(UI_General.GetSizeScreen().Width - (_rfidScanImage.Size.Width)), Convert.ToInt32(UI_General.GetSizeScreen().Height * 0.89));
            _rfidScanImage.BackgroundImage                   = new Bitmap(projectFolder + @"Pictures\rfid\rfid_scan.png");
            _rfidScanImage.BackColor                         = Color.Transparent;
            _rfidScanImage.BackgroundImageLayout             = ImageLayout.Stretch;
            _rfidScanImage.FlatStyle                         = FlatStyle.Flat;
            _rfidScanImage.FlatAppearance.BorderSize         = 0;
            _rfidScanImage.FlatAppearance.MouseOverBackColor = _rfidScanImage.BackColor;
            _rfidScanImage.FlatAppearance.MouseDownBackColor = _rfidScanImage.BackColor;


            _didYouKnowBtn.Size                  = new Size(200, 200);
            _didYouKnowBtn.BackgroundImage       = new Bitmap(projectFolder + @"Pictures\default\did_you_know.jpg");
            _didYouKnowBtn.BackgroundImageLayout = ImageLayout.Stretch;


            _didYouKnowPanel.Controls.Add(_didYouKnowBtn);
            _didYouKnowPanel.Controls.Add(_didYouKnowLabel);
            _didYouKnowBtn.Top    += 25;
            _didYouKnowLabel.Left += (_didYouKnowPanel.Width - _didYouKnowLabel.Width) / 2;


            _whatsInsideBtn.Size                  = new Size(200, 200);
            _whatsInsideBtn.BackgroundImage       = new Bitmap(projectFolder + @"Pictures\default\whats_inside.jpg");
            _whatsInsideBtn.BackgroundImageLayout = ImageLayout.Stretch;

            _whatsInsidePanel.Controls.Add(_whatsInsideBtn);
            _whatsInsidePanel.Controls.Add(_whatsInsideLabel);
            _whatsInsideBtn.Top += 25;
            //_whatsInsideLabel.Text = "What's Inside?";
            _whatsInsideLabel.Left += (_whatsInsidePanel.Width - _whatsInsideLabel.Width) / 2;


            _leaveSomeFeedbackBtn.Size                  = new Size(200, 200);
            _leaveSomeFeedbackBtn.BackgroundImage       = new Bitmap(projectFolder + @"Pictures\default\feedback.jpg");
            _leaveSomeFeedbackBtn.BackgroundImageLayout = ImageLayout.Stretch;
            _leaveSomeFeedbackPanel.Controls.Add(_leaveSomeFeedbackBtn);
            _leaveSomeFeedbackPanel.Controls.Add(_leaveSomeFeedbackLabel);
            _leaveSomeFeedbackBtn.Top += 25;
            //_leaveSomeFeedbackLabel.Text = "Leave feedback!";
            _leaveSomeFeedbackLabel.Left += (_leaveSomeFeedbackPanel.Width - _leaveSomeFeedbackLabel.Width) / 2;



            _didYouKnowBtn.BackColor = Color.FromArgb(255, 255, 255);
            _didYouKnowBtn.ForeColor = UI_General.GetLabelGrayForeColor();

            _whatsInsideBtn.BackColor = Color.FromArgb(255, 255, 255);
            _whatsInsideBtn.ForeColor = UI_General.GetLabelGrayForeColor();


            _leaveSomeFeedbackBtn.BackColor = Color.FromArgb(255, 255, 255);
            _leaveSomeFeedbackBtn.ForeColor = UI_General.GetLabelGrayForeColor();
        }