Esempio n. 1
0
        //################################################################################
        #region Private Members

        private void InitializeComponent()
        {
            ContainerPanel.SuspendLayout();
            SuspendLayout();

            #region Container Panel

            ContainerPanel.Margin        = new Padding(0);
            ContainerPanel.Padding       = new Padding(0);
            ContainerPanel.Location      = new Point(0, 0);
            ContainerPanel.FlowDirection = FlowDirection.LeftToRight;

            #endregion

            #region Name Label

            NameLabel.Name = "NameLabel";
            NameLabel.Text = Formatter.FormatString(StockService.GetStockInfo.Name, Pad.Right, 9);
            //NameLabel.Width = 90;
            NameLabel.AutoSize  = true;
            NameLabel.Margin    = new Padding(0, 0, Style.PanelSpacing, 0);
            NameLabel.Padding   = new Padding(Style.PanelPadding);
            NameLabel.TextAlign = ContentAlignment.MiddleLeft;
            NameLabel.Font      = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold);
            Painter <Black> .Paint(NameLabel, PaintMode.Normal);

            #endregion

            #region Value Label

            ValueLabel.Name = "ValueLabel";
            ValueLabel.Text = Formatter.FormatString("#,#### TL", Pad.Left, 12);
            //ValueLabel.Width = 100;
            ValueLabel.AutoSize  = true;
            ValueLabel.Margin    = new Padding(0, 0, Style.PanelSpacing, 0);
            ValueLabel.Padding   = new Padding(Style.PanelPadding);
            ValueLabel.TextAlign = ContentAlignment.MiddleRight;
            ValueLabel.Font      = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold);
            Painter <Green> .Paint(ValueLabel, PaintMode.Light);

            #endregion

            #region Function Button

            void SlideAction(Control button)
            {
                button.Click += (sender, args) =>
                {
                };
            }

            FunctionButton = new ImageButton(SlideAction, Resources.Options)
            {
                Margin = new Padding(0)
            };
            FunctionButton.SetToolTip("Open panel");
            FunctionButton.SetBackgroundColor(Color.FromArgb(38, 124, 181));

            #endregion

            #region Stock Panel

            Name          = $"StockPanel_{StockService.GetStockInfo.Tag}";
            AutoSize      = true;
            Margin        = new Padding(0, 0, 0, Style.PanelSpacing);
            BackColor     = Color.FromArgb(100, 100, 100);
            BorderStyle   = BorderStyle.FixedSingle;
            AutoScaleMode = AutoScaleMode.Font;

            #endregion

            ContainerPanel.Controls.Add(NameLabel);
            ContainerPanel.Controls.Add(ValueLabel);
            ContainerPanel.Controls.Add(FunctionButton);
            Controls.Add(ContainerPanel);

            ContainerPanel.ResumeLayout(false);
            ContainerPanel.PerformLayout();
            ResumeLayout(false);
        }
Esempio n. 2
0
        //################################################################################
        #region Private Members

        private void InitializeComponent()
        {
            ContainerPanel.SuspendLayout();
            SuspendLayout();

            #region Container Panel

            ContainerPanel.Margin        = new Padding(0);
            ContainerPanel.Padding       = new Padding(0);
            ContainerPanel.Location      = new Point(0, 0);
            ContainerPanel.FlowDirection = FlowDirection.LeftToRight;

            #endregion

            #region Logo Button

            void HideAction(Control button)
            {
                button.DoubleClick += (sender, arg) =>
                {
                    ParentControl.Visible = false;
                };
            }

            LogoButton = new ImageButton(HideAction, Resources.Logo)
            {
                Margin = new Padding(0, 0, Style.PanelSpacing, 0)
            };
            LogoButton.SetToolTip("Handy Box App v2.4");
            LogoButton.SetBackgroundColor(Color.FromArgb(226, 87, 76));

            #endregion

            #region Title Label

            TitleLabel.Name = $"TitleLabel";
            TitleLabel.Text = $@"Handy Box App v2.4  ";
            //TitleLabel.Width = 190 - LogoButton.Width;
            TitleLabel.AutoSize  = true;
            TitleLabel.Margin    = new Padding(0, 0, Style.PanelSpacing, 0);
            TitleLabel.Padding   = new Padding(Style.PanelPadding);
            TitleLabel.TextAlign = ContentAlignment.MiddleLeft;
            TitleLabel.Font      = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold);
            Painter <Black> .Paint(TitleLabel, PaintMode.Dark);

            TitleLabel.MouseDown += DragAndDrop;

            #endregion

            #region Close Button

            void CloseAction(Control button)
            {
                button.Click += (sender, args) =>
                {
                    ((MainForm)ParentControl).Close();
                    CustomApplicationContext.Exit();
                };
            }

            CloseButton = new ImageButton(CloseAction, Resources.Close)
            {
                Margin = new Padding(0)
            };
            CloseButton.SetToolTip("Close");
            CloseButton.SetBackgroundColor(Color.FromArgb(201, 54, 54));

            #endregion

            #region Title Panel

            Name          = "TitlePanel";
            AutoSize      = true;
            Margin        = new Padding(0, 0, 0, Style.PanelSpacing);
            BackColor     = Color.FromArgb(100, 100, 100);
            BorderStyle   = BorderStyle.FixedSingle;
            AutoScaleMode = AutoScaleMode.Font;

            #endregion

            ContainerPanel.Controls.Add(LogoButton);
            ContainerPanel.Controls.Add(TitleLabel);
            ContainerPanel.Controls.Add(CloseButton);
            Controls.Add(ContainerPanel);

            ContainerPanel.ResumeLayout(false);
            ContainerPanel.PerformLayout();
            ResumeLayout(false);
        }
Esempio n. 3
0
        //################################################################################
        #region Private Members

        #region Timer Panel Initialization

        private void InitializeComponent()
        {
            ContainerPanel.SuspendLayout();
            SuspendLayout();

            #region Container Panel

            ContainerPanel.Margin        = new Padding(0);
            ContainerPanel.Padding       = new Padding(0);
            ContainerPanel.Location      = new Point(0, 0);
            ContainerPanel.FlowDirection = FlowDirection.LeftToRight;

            #endregion

            #region Timer TextBox

            FunctionText.Name        = $"TimerText";
            FunctionText.Text        = Formatter.FormatMode($"{TimerMode.Stopped}");
            FunctionText.AutoSize    = true;
            FunctionText.BorderStyle = BorderStyle.None;
            FunctionText.Padding     = new Padding(Style.PanelPadding);
            FunctionText.Margin      = new Padding(0, 0, Style.PanelSpacing, 0);
            FunctionText.Font        = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold);
            Painter <Black> .Paint(FunctionText, PaintMode.Normal);

            FunctionText.DoubleClick += FunctionText_DoubleClick;

            var hourTextGuideLabel = new Label
            {
                AutoSize = true,
                Text     = new string(' ', 12),
                Margin   = new Padding(0),
                Padding  = new Padding(Style.PanelPadding),
                Font     = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold)
            };

            TimerText.Text        = c_InitialTime;
            TimerText.ReadOnly    = true;
            TimerText.AutoSize    = false;
            TimerText.TabStop     = false;
            TimerText.Margin      = new Padding(0);
            TimerText.BorderStyle = BorderStyle.None;
            TimerText.Size        = hourTextGuideLabel.PreferredSize;
            TimerText.TextAlign   = HorizontalAlignment.Center;
            TimerText.Font        = new Font(new FontFamily(Style.FontName), Style.PanelFontSize + 2, FontStyle.Bold);
            Painter <Blue> .Paint(TimerText, PaintMode.Normal);

            TimerText.DoubleClick += TimerText_DoubleClick;
            TimerText.KeyPress    += TimerText_KeyPress;
            TimerText.LostFocus   += TimerText_LostFocus;

            TimerContainer.Width         = FunctionText.PreferredWidth + Style.PanelSpacing + TimerText.Width;
            TimerContainer.Height        = FunctionText.PreferredHeight;
            TimerContainer.Padding       = new Padding(0);
            TimerContainer.Margin        = new Padding(0, 0, Style.PanelSpacing, 0);
            TimerContainer.BorderStyle   = BorderStyle.None;
            TimerContainer.FlowDirection = FlowDirection.LeftToRight;
            TimerContainer.Controls.Add(FunctionText);
            TimerContainer.Controls.Add(TimerText);

            #endregion

            #region Function Button

            void PauseAction(Control button)
            {
                button.Click += FunctionButton_Click;
            }

            void ManualStopAction(object sender, EventArgs args)
            {
                Log.Info("Stop has been triggered manually. WorkTimer will stop.");
                StopTimer();
            }

            FunctionButton = new ImageButton(PauseAction, Resources.Stop)
            {
                Margin      = new Padding(0),
                ContextMenu = new ContextMenu {
                    MenuItems = { new MenuItem("Stop", (s, a) => ManualStopAction(s, a)) }
                }
            };
            FunctionButton.SetToolTip("Pause/Resume timer");
            FunctionButton.SetBackgroundColor(Color.FromArgb(152, 0, 47));

            #endregion

            #region Timer Panel

            Name          = "TimerPanel";
            AutoSize      = true;
            Margin        = new Padding(0, 0, 0, Style.PanelSpacing);
            BackColor     = Color.FromArgb(100, 100, 100);
            BorderStyle   = BorderStyle.FixedSingle;
            AutoScaleMode = AutoScaleMode.Font;

            #endregion

            ContainerPanel.Controls.Add(TimerContainer);
            ContainerPanel.Controls.Add(FunctionButton);
            Controls.Add(ContainerPanel);

            ContainerPanel.ResumeLayout(false);
            ContainerPanel.PerformLayout();
            ResumeLayout(false);
        }