示例#1
0
        public static DialogResult RestoreConfigAsk()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1));
            MetroForm metroForm = new MetroForm
            {
                ShadowType      = MetroFormShadowType.AeroShadow,
                Width           = 280,
                Height          = 135,
                FormBorderStyle = FormBorderStyle.None,
                Resizable       = false,
                AutoSize        = true,
                Icon            = (Icon)componentResourceManager.GetObject("notifyIcon1.Icon"),
                AutoSizeMode    = AutoSizeMode.GrowOnly,
                ControlBox      = false,
                Theme           = MetroThemeStyle.Dark,
                DisplayHeader   = false,
                TopMost         = true,
                Text            = "",
                StartPosition   = FormStartPosition.CenterScreen
            };
            MetroLabel metroLabel = new MetroLabel();

            metroLabel.Text      = "You are about to restore the selected file back to normal" + Environment.NewLine + "Please make sure the file is dated from this patch." + Environment.NewLine + "Are you willing to continue?";
            metroLabel.AutoSize  = true;
            metroLabel.Left      = 5;
            metroLabel.Top       = 20;
            metroLabel.Width     = 270;
            metroLabel.Height    = 40;
            metroLabel.TextAlign = ContentAlignment.MiddleCenter;
            metroLabel.Theme     = MetroThemeStyle.Dark;
            MetroLabel  value       = metroLabel;
            MetroButton metroButton = new MetroButton
            {
                Text         = "Yes",
                Left         = 5,
                Width        = 100,
                Top          = 100,
                DialogResult = DialogResult.Yes,
                Theme        = MetroThemeStyle.Dark
            };
            MetroButton metroButton2 = new MetroButton
            {
                Text         = "No",
                Left         = 125,
                Width        = 100,
                Top          = 100,
                DialogResult = DialogResult.No,
                Theme        = MetroThemeStyle.Dark
            };

            metroButton.TabStop  = false;
            metroButton2.TabStop = false;
            metroForm.Controls.Add(metroButton);
            metroForm.Controls.Add(value);
            metroForm.Controls.Add(metroButton2);
            metroForm.AcceptButton = metroButton;
            metroForm.AcceptButton = metroButton2;
            metroForm.Style        = ColorSet;
            return(metroForm.ShowDialog());
        }
示例#2
0
 /// <summary>
 /// 双击模型树添加标签图片,修改制图参数
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tvModule_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (tvModule.SelectedNode == null)
     {
         return;
     }
     if (tvModule.SelectedNode.Level == 2)
     {
         string drawingPlanId = tvModule.SelectedNode.Parent.Tag.ToString();
         string moduleTreeId  = tvModule.SelectedNode.Tag.ToString();
         if (drawingPlanId.Length < 4)
         {
             return;
         }
         drawingPlanId = drawingPlanId.Substring(4);//除去item
         Drawing    objDrawing    = objDrawingService.GetDrawingById(drawingPlanId);
         ModuleTree objModuleTree = objModuleTreeService.GetModuleTreeById(moduleTreeId);
         //利用反射,打开修改模型参数窗口,同时实现传递窗口参数
         object[] parameters = new object[2];
         parameters[0] = objDrawing;
         parameters[1] = objModuleTree;
         MetroForm objFrmModel = (MetroForm)Assembly.Load("Compass").CreateInstance("Compass.Frm" + objModuleTree.CategoryName, true, BindingFlags.Default, null, parameters, null, null);
         objFrmModel.ShowDialog();
     }
 }
示例#3
0
        /// <summary>
        /// Set the cell format by Tool Strip Menu Item
        /// </summary>
        private void formatCellsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            form = new MetroForm();
            form.IsMdiContainer = true;
            dialog = new GroupingGridFormatCellDialog(this.gridGroupingControl1);
            dialog.FormBorderStyle = FormBorderStyle.None;
            dialog.Dock            = DockStyle.Fill;
            dialog.MdiParent       = form;
            form.Size = dialog.Size + new Size(17, 37);

            dialog.Controls[1].Click += new EventHandler(ButtonClick);
            dialog.Controls[0].Click += new EventHandler(ButtonClick);
            form.FormBorderStyle      = FormBorderStyle.FixedSingle;
            form.Font             = new System.Drawing.Font("Segoe UI", 8.25F);
            form.BorderColor      = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(161)))), ((int)(((byte)(226)))));
            form.BorderThickness  = 2;
            form.CaptionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(161)))), ((int)(((byte)(226)))));
            form.ShowIcon         = false;
            form.MaximizeBox      = false;
            form.MetroColor       = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(161)))), ((int)(((byte)(226)))));
            form.MinimizeBox      = false;
            form.Text             = "Format Cell Dialog";
            dialog.Show();
            form.ShowDialog();
        }
示例#4
0
        public static string ShowDialog(string text)
        {
            MetroForm prompt = new MetroForm
            {
                Width           = 500,
                Height          = 150,
                FormBorderStyle = FormBorderStyle.FixedDialog,
                StartPosition   = FormStartPosition.CenterScreen,
                Theme           = MetroThemeStyle.Dark,
                ShowInTaskbar   = false,
                MinimizeBox     = false,
                MaximizeBox     = false
            };
            MetroLabel textLabel = new MetroLabel()
            {
                Left = 50, Top = 20, Text = text, Width = 400, Theme = MetroThemeStyle.Dark
            };
            MetroTextBox textBox = new MetroTextBox()
            {
                Left = 50, Top = 50, Width = 400, Theme = MetroThemeStyle.Dark
            };
            MetroButton confirmation = new MetroButton()
            {
                Text = "Confirm", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK, Theme = MetroThemeStyle.Dark
            };

            confirmation.Click += (sender, e) => { prompt.Close(); };
            prompt.Controls.Add(textBox);
            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(textLabel);
            prompt.AcceptButton = confirmation;

            return(prompt.ShowDialog() == DialogResult.OK ? textBox.Text : "");
        }
示例#5
0
        public static DialogResult MultipleClient()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1));
            MetroForm obj = new MetroForm
            {
                ShadowType      = MetroFormShadowType.AeroShadow,
                Width           = 280,
                Height          = 135,
                FormBorderStyle = FormBorderStyle.None,
                Resizable       = false,
                AutoSize        = true,
                Icon            = (Icon)componentResourceManager.GetObject("notifyIcon1.Icon"),
                AutoSizeMode    = AutoSizeMode.GrowOnly,
                ControlBox      = false,
                Theme           = MetroThemeStyle.Dark,
                DisplayHeader   = false,
                TopMost         = true,
                Text            = "",
                StartPosition   = FormStartPosition.CenterScreen
            };
            MetroLabel value = new MetroLabel
            {
                Text      = "32bit and 64bit clients were found. Which would you like to use by default?",
                AutoSize  = true,
                Left      = 5,
                Top       = 20,
                Width     = 270,
                Height    = 40,
                TextAlign = ContentAlignment.MiddleCenter,
                Theme     = MetroThemeStyle.Dark
            };
            MetroButton metroButton = new MetroButton
            {
                Text         = "32 bit",
                Left         = 5,
                Width        = 100,
                Top          = 100,
                DialogResult = DialogResult.Yes,
                Theme        = MetroThemeStyle.Dark
            };
            MetroButton metroButton2 = new MetroButton
            {
                Text         = "64 bit",
                Left         = 125,
                Width        = 100,
                Top          = 100,
                DialogResult = DialogResult.No,
                Theme        = MetroThemeStyle.Dark
            };

            metroButton.TabStop  = false;
            metroButton2.TabStop = false;
            obj.Controls.Add(metroButton);
            obj.Controls.Add(value);
            obj.Controls.Add(metroButton2);
            obj.AcceptButton = metroButton;
            obj.AcceptButton = metroButton2;
            obj.Style        = ColorSet;
            return(obj.ShowDialog());
        }
示例#6
0
        /// <summary>
        /// 双击行修改制图参数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvQuickBrowse_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvQuickBrowse.RowCount == 0)
            {
                return;
            }
            if (dgvQuickBrowse.CurrentRow == null)
            {
                return;
            }

            string       moduleTreeId  = dgvQuickBrowse.CurrentRow.Cells["ModuleTreeId"].Value.ToString();
            ModuleTree   objModuleTree = objModuleTreeService.GetModuleTreeById(moduleTreeId);
            DialogResult result        = DialogResult.No;

            //利用反射,打开修改模型参数窗口,同时实现传递窗口参数
            object[] parameters = new object[2];
            parameters[0] = objDrawing;
            parameters[1] = objModuleTree;
            MetroForm objFrmModel = (MetroForm)Assembly.Load("Compass").CreateInstance("Compass.Frm" + objModuleTree.CategoryName, true, BindingFlags.Default, null, parameters, null, null);

            result = objFrmModel.ShowDialog();
            if (result == DialogResult.OK)
            {
                RefreshData(objDrawing, objModuleTree);//更新数据表
            }
        }
示例#7
0
            public static string ShowDialog(string text, string caption)
            {
                MetroForm prompt = new MetroForm()
                {
                    Width         = 450,
                    Height        = 150,
                    Text          = caption,
                    Style         = MetroFramework.MetroColorStyle.Orange,
                    Resizable     = false,
                    ControlBox    = false,
                    TextAlign     = MetroFormTextAlign.Center,
                    StartPosition = FormStartPosition.CenterScreen
                };
                MetroTextBox textBox = new MetroTextBox()
                {
                    Left = 115, Top = 65, Width = 200
                };
                MetroButton confirmation = new MetroButton()
                {
                    Text = "Ok", Left = 165, Width = 100, Top = 100, DialogResult = DialogResult.OK
                };

                confirmation.Click += (sender, e) => { prompt.Close(); };
                prompt.Controls.Add(textBox);
                prompt.Controls.Add(confirmation);
                textBox.Style       = MetroFramework.MetroColorStyle.Orange;
                textBox.KeyPress   += (sender, e) => { e.Handled = !char.IsLetter(e.KeyChar) && !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar); };
                prompt.AcceptButton = confirmation;

                return(prompt.ShowDialog() == DialogResult.OK ? textBox.Text : "");
            }
示例#8
0
 public static DialogResult GetShowDialog(MetroForm myfrm)
 {
     myfrm.StyleManager  = MyFormStyles.GetStyleManager(myfrm);
     myfrm.StartPosition = FormStartPosition.CenterScreen;
     myfrm.ShadowType    = MetroFormShadowType.DropShadow;
     myfrm.BorderStyle   = MetroFormBorderStyle.FixedSingle;
     return(myfrm.ShowDialog());
 }
示例#9
0
 private void OpenForm(MetroForm form)
 {
     if (form is null)
     {
         return;
     }
     Hide();
     form.ShowDialog();
     Show();
 }
示例#10
0
        public static void Popup(string Message)
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1));
            MetroForm obj = new MetroForm
            {
                ShadowType      = MetroFormShadowType.AeroShadow,
                Width           = 280,
                Height          = 135,
                FormBorderStyle = FormBorderStyle.None,
                Resizable       = false,
                AutoSize        = true,
                AutoSizeMode    = AutoSizeMode.GrowOnly,
                Icon            = (Icon)componentResourceManager.GetObject("notifyIcon1.Icon"),
                ControlBox      = false,
                Theme           = MetroThemeStyle.Dark,
                Style           = MetroColorStyle.White,
                DisplayHeader   = false,
                TopMost         = true,
                Text            = "",
                StartPosition   = FormStartPosition.CenterScreen
            };
            MetroLabel value = new MetroLabel
            {
                Dock      = DockStyle.Fill,
                AutoSize  = true,
                Left      = 5,
                Top       = 0,
                Text      = Message + Environment.NewLine + Environment.NewLine,
                Width     = 270,
                Height    = 40,
                TextAlign = ContentAlignment.MiddleCenter,
                Theme     = MetroThemeStyle.Dark
            };
            MetroButton metroButton = new MetroButton
            {
                Dock         = DockStyle.Bottom,
                Text         = "Ok",
                Left         = 5,
                Width        = 100,
                Top          = obj.Height - 20,
                DialogResult = DialogResult.OK,
                Theme        = MetroThemeStyle.Dark
            };

            metroButton.TabStop = false;
            obj.Controls.Add(metroButton);
            obj.Controls.Add(value);
            obj.AcceptButton = metroButton;
            obj.Style        = ColorSet;
            obj.TopMost      = true;
            obj.ShowDialog();
        }
示例#11
0
            public static void Popup(string Message)
            {
                ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));
                MetroForm metroForm = new MetroForm();

                metroForm.ShadowType      = MetroFormShadowType.AeroShadow;
                metroForm.Width           = 280;
                metroForm.Height          = 135;
                metroForm.FormBorderStyle = FormBorderStyle.None;
                metroForm.Resizable       = false;
                metroForm.AutoSize        = true;
                metroForm.AutoSizeMode    = AutoSizeMode.GrowOnly;
                metroForm.Icon            = (Icon)resources.GetObject("notifyIcon1.Icon");
                metroForm.ControlBox      = false;
                metroForm.Theme           = MetroThemeStyle.Dark;
                metroForm.DisplayHeader   = false;
                metroForm.TopMost         = true;
                metroForm.Text            = "";
                metroForm.StartPosition   = FormStartPosition.CenterScreen;
                MetroForm  metroForm2 = metroForm;
                MetroLabel metroLabel = new MetroLabel();

                metroLabel.Dock      = DockStyle.Fill;
                metroLabel.AutoSize  = true;
                metroLabel.Left      = 5;
                metroLabel.Top       = 0;
                metroLabel.Text      = Message + Environment.NewLine + Environment.NewLine;
                metroLabel.Width     = 270;
                metroLabel.Height    = 40;
                metroLabel.TextAlign = ContentAlignment.MiddleCenter;
                metroLabel.Theme     = MetroThemeStyle.Dark;
                MetroLabel  value       = metroLabel;
                MetroButton metroButton = new MetroButton();

                metroButton.Dock         = DockStyle.Bottom;
                metroButton.Text         = "Ok";
                metroButton.Left         = 5;
                metroButton.Width        = 100;
                metroButton.Top          = metroForm2.Height - 20;
                metroButton.DialogResult = DialogResult.OK;
                metroButton.Theme        = MetroThemeStyle.Dark;
                MetroButton metroButton2 = metroButton;

                metroButton2.TabStop = false;
                metroForm2.Controls.Add(metroButton2);
                metroForm2.Controls.Add(value);
                metroForm2.AcceptButton = metroButton2;
                metroForm2.Style        = ColorSet;
                metroForm2.ShowDialog();
            }
        public static DialogResult InputBox(string title, string promptText, ref string value)
        {
            MetroForm form = new MetroForm();

            MetroLabel   label        = new MetroLabel();
            MetroTextBox textBox      = new MetroTextBox();
            MetroButton  buttonOk     = new MetroButton();
            MetroButton  buttonCancel = new MetroButton();

            //form.Text = title;
            label.Text   = promptText;
            textBox.Text = value;

            buttonOk.Text             = "OK";
            buttonCancel.Text         = "Cancel";
            buttonOk.DialogResult     = DialogResult.OK;
            buttonCancel.DialogResult = DialogResult.Cancel;

            label.SetBounds(9, 10, 372, 13);
            textBox.SetBounds(12, 36, 372, 20);
            buttonOk.SetBounds(228, 72, 75, 23);
            buttonCancel.SetBounds(309, 72, 75, 23);

            label.AutoSize      = true;
            textBox.Anchor      = textBox.Anchor | AnchorStyles.Right;
            buttonOk.Anchor     = AnchorStyles.Bottom | AnchorStyles.Right;
            buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            form.ClientSize = new Size(396, 107);
            form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });

            form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);

            //form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.StartPosition = FormStartPosition.CenterScreen;

            form.MinimizeBox  = false;
            form.MaximizeBox  = false;
            form.AcceptButton = buttonOk;
            form.CancelButton = buttonCancel;

            DialogResult dialogResult = form.ShowDialog();

            value = textBox.Text;

            return(dialogResult);
        }
示例#13
0
        public void ShowNotification(string Notification, bool ShowDialog, int LifeTimeFormSecond, bool TopMost)
        {
            //lbl.Text = Notification;
            txtMessage.Text = Notification;
            SecondLifeForm  = LifeTimeFormSecond;

            //Позиция Оповещения
            int left;
            int top;

            //
            //
            getXY(380, 120, out top, out left);
            frm.StartPosition = FormStartPosition.Manual;
            frm.Location      = new System.Drawing.Point(left + 375, top);
            frm.TopMost       = TopMost;
            //
            //
            //
            posStop = (ushort)left;
            OpenFormTimer.Interval = 1;
            OpenFormTimer.Tick    += new System.EventHandler(OpenFormTimer_Tick);
            OpenFormTimer.Enabled  = true;
            //
            //
            //
            //Close Form
            LifeTimeForm.Interval = 1;
            LifeTimeForm.Tick    += new System.EventHandler(LifeTimeForm_Tick);
            LifeTimeForm.Enabled  = true;
            //
            if (ShowDialog)
            {
                frm.ShowDialog();
            }
            else
            {
                frm.Show();
            }
        }
示例#14
0
        private void menuItem2_Click(object sender, System.EventArgs e)
        {
            Form form1 = new MetroForm();

            form1.Text                                = "Script";
            form1.ShowIcon                            = false;
            form1.StartPosition                       = FormStartPosition.CenterScreen;
            this.editControl1                         = new EditControl();
            editControl1.ScrollVisualStyle            = ScrollBarCustomDrawStyles.Metro;
            this.editControl1.Dock                    = DockStyle.Fill;
            this.editControl1.ShowLineNumbers         = false;
            this.editControl1.ShowOutliningCollapsers = false;
            this.editControl1.SaveOnClose             = false;
            this.editControl1.ReadOnly                = true;
            this.editControl1.ShowVerticalSplitters   = false;
            this.editControl1.ShowHorizontalSplitters = false;
            this.editControl1.ShowIndicatorMargin     = false;
            editControl1.ApplyConfiguration(Edit.Enums.KnownLanguages.HTML);
            form1.Controls.Add(editControl1);
            form1.Size             = new System.Drawing.Size(600, 500);
            this.editControl1.Text = this.htmluiControl1.Text;
            form1.ShowDialog();
        }
示例#15
0
        private string InputBox()
        {
            // 바꿀 이름 입력받기 위한 새 폼

            MetroForm form         = new MetroForm();
            Label     label        = new Label();
            TextBox   textbox      = new TextBox();
            Button    buttonOk     = new Button();
            Button    buttonCancel = new Button();

            form.ClientSize = new System.Drawing.Size(400, 100);
            form.Controls.AddRange(new Control[] { label, textbox, buttonOk, buttonCancel });
            form.MaximizeBox  = false;
            form.MinimizeBox  = false;
            form.AcceptButton = buttonOk;
            form.CancelButton = buttonCancel;

            label.Text        = "바꿀 이름을 입력하세요";
            textbox.Text      = "";
            buttonOk.Text     = "확인";
            buttonCancel.Text = "취소";

            buttonOk.DialogResult     = DialogResult.OK;
            buttonCancel.DialogResult = DialogResult.Cancel;

            label.SetBounds(65, 17, 200, 20);
            textbox.SetBounds(65, 40, 220, 20);
            buttonOk.SetBounds(135, 70, 70, 20);
            buttonCancel.SetBounds(215, 70, 70, 20);

            form.ShowDialog();

            string Rename = textbox.Text;

            return(Rename);
        }
示例#16
0
        public void ButtonCodesReturn(string buttonCode)
        {
            switch (buttonCode)
            {
            case "Enter Here":
                LoginRegisterSlider.Visible    = true;
                EnterHere.Visible              = false;
                LoginRegisterSlider.OpenBounds = new Rectangle(this.Width - (LoginRegisterSlider.Width + 15), 3, LoginRegisterSlider.Width, this.DisplayRectangle.Height - StatusPanel.Height);
                LoginRegisterSlider.IsOpen     = true;
                break;

            case "Exit Login":
                LoginRegisterSlider.IsOpen = false;
                EnterHere.Visible          = true;
                break;

            case "Log Out":
                LogOut();
                ButtonCodesReturn("Exit Login");
                MainSlidePanel.IsOpen = MainStatusPanel.Visible = false;
                StatusPanel.Parent    = this;
                DateTimeLabel.Visible = true;
                break;

            case "Login":
                if (Username.Text != "" && Password.Text != "")
                {
                    var user = Username.Text;
                    var pass = Password.Text;

                    GetAllAccounts();
                    if (IsAccountExist(user))
                    {
                        if (RetryCount > 0 && RefreshRetryTimer() <= 0)
                        {
                            if (AccountsList[user.ToLower()] == pass)
                            {
                                if (CheckUserStatus(user) || CheckUserStatus(user, "admin"))
                                {
                                    ShowManagersSales.Visible = DateTimeLabel.Visible = LoginRegisterSlider.IsOpen = ManagerList.Visible = AccountsView.Visible = EditorMode.VisibleDock(false, ToolsPanel);
                                    MainStatusPanel.Visible   = true;
                                    CurrentAdmin = "";
                                    AccountPanel.VisibleDock(false, ToolsPanel);
                                    if (IsAdmin(user))
                                    {
                                        CurrentAdmin = user;
                                        EditorMode.VisibleDock(true, ToolsPanel, DockStyle.Top);
                                        EditorMode.SetValueAndAnimate(true, eEventSource.Code);
                                    }
                                    else
                                    {
                                        SalesView.Visible = SalesPanel.VisibleDock(true, ToolsPanel);
                                        EditorMode.VisibleDock(false, ToolsPanel);
                                        SetUserStatus(user, "Online");
                                        SetSalesDataSet(user, this);
                                    }

                                    MainSlidePanel.OpenBounds = new Rectangle(0, 0, this.DisplayRectangle.Width, this.DisplayRectangle.Height);
                                    MainSlidePanel.IsOpen     = true;
                                    StatusPanel.Parent        = MainSlidePanel;
                                    ManagerNameLabel.Text     = $"{user} | {AccountTable.Rows.Find(user)["ManagerName"].ToString()}";
                                    foreach (Control c in this.GetAllControls())
                                    {
                                        if (c is TextBoxX)
                                        {
                                            c.Text = "";
                                        }
                                    }
                                }
                                else
                                {
                                    ToastNotification.Show(LoginPanel, $"{user} has already logged in");
                                }
                            }
                            else
                            {
                                ToastNotification.Show(LoginPanel, $"Invalid Password: Retries Left {RetryCount--}");
                            }
                        }
                        else
                        {
                            if (!RetryTimer.Enabled)
                            {
                                File.WriteAllText("Penalty.txt", DateTime.Now.AddMinutes(RetryTimes++).ToString());
                                RefreshRetryTimer();
                            }
                        }
                    }
                    else
                    {
                        ToastNotification.Show(LoginPanel, $"{user} not registered");
                    }
                }
                else
                {
                    ToastNotification.Show(LoginPanel, "Input all fields");
                }
                break;

            case "Register":
                GetAllAccounts();
                if (!IsAccountExist(AccountUsername.Text))
                {
                    if (CheckAllFields())
                    {
                        ToastNotification.Show(this, $"Registered: {AccountUsername.Text}");

                        AccountTable.Rows.Add(AccountUsername.Text, AccountPassword.Text, AccountManagerName.Text, AccountSecretQuestion.Text, AccountSecretAnswer.Text, "Offline");
                        GetAllAccounts();
                        foreach (Control c in this.GetAllControls())
                        {
                            if (c is TextBoxX)
                            {
                                c.Text = "";
                            }
                        }
                        if (AccountStatus.Visible)
                        {
                            ShowAccounts();
                            ToastNotification.Show(this, "Reverting back to edit mode");
                        }
                    }
                    else
                    {
                        ToastNotification.Show(this, "Input all Fields");
                    }
                }
                else
                {
                    ToastNotification.Show(this, $"Account Already Registered: {AccountUsername.Text}");
                }
                break;

            case "Create Account Mode":
                AccountControls.ClearBindings();
                AccountUsername.Enabled = AccountStatus.Enabled = true;
                foreach (Control c in AccountPanel.GetAllControls())
                {
                    if (c is TextBoxX)
                    {
                        c.Text = "";
                    }
                }
                RegisterButton.Text = "Register";
                ToastNotification.Show(this, "Create Account Mode activated please enter credentials on the blank fields then press register");
                break;

            case "Forgot Password":
                if (Username.Text == "")
                {
                    ToastNotification.Show(LoginPanel, "Enter a registered account then click this again");
                    return;
                }
                var rows = AccountTable.Select($"Username='******'");
                if (rows.Length != 0)
                {
                    var row            = rows[0];
                    var renameVal      = "";
                    var RenameInputBox = new MetroForm();
                    RenameInputBox.Height          = 150;
                    RenameInputBox.Width           = 250;
                    RenameInputBox.StartPosition   = FormStartPosition.CenterScreen;
                    RenameInputBox.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                    RenameInputBox.MaximizeBox     = false;
                    RenameInputBox.Controls.Add(new LabelX {
                        AutoSize = true, Name = "ForgotPass", Text = row["SecretQuestion"].ToString(), Location = new Point(10, 10)
                    });
                    RenameInputBox.Controls.Add(new TextBoxX {
                        Size = new Size(200, 100), PasswordChar = '*', AutoSize = true, Name = "InputField", Location = new Point(10, 30)
                    });
                    RenameInputBox.Controls.Add(new ButtonX {
                        AutoSize = true, Name = "Submit", Text = "Submit", Location = new Point(10, 60)
                    });
                    RenameInputBox.Text = "Forgot Password";
                    RenameInputBox.GetControl <ButtonX>("Submit").Click += (_, ee) =>
                    {
                        renameVal = RenameInputBox.GetControl <TextBoxX>("InputField").Text;
                        RenameInputBox.Close();
                    };
                    RenameInputBox.ShowDialog();
                    var answerCheck = renameVal == row["SecretAnswer"].ToString();
                    ToastNotification.Show(LoginPanel, answerCheck ? $"Your password is: {row["Password"].ToString()}" : RetryCount > 0 ? $"Invalid Secret Answer: Retries Left {RetryCount--}" : "Invalid Secret Answer: PENALTY!");

                    if (RetryCount <= 0 && !answerCheck && !RetryTimer.Enabled)
                    {
                        File.WriteAllText("Penalty.txt", DateTime.Now.AddMinutes(RetryTimes++).ToString());
                        RefreshRetryTimer();
                    }
                    if (answerCheck)
                    {
                        Password.Text = row["Password"].ToString();
                    }
                }
                else
                {
                    ToastNotification.Show(LoginPanel, $"{Username.Text} doesn't exist");
                }
                break;

            case "Save Changes":
                if (SalesView.Visible)
                {
                    DatabaseSave();
                }
                if (AccountsView.Visible)
                {
                    GetAllAccounts();
                    ToastNotification.Show(AccountsView, "Saved changes to accounts");
                }
                break;

            case "Rename Product":
                if (SalesView.ReadOnly)
                {
                    ToastNotification.Show(this, ($"Can't rename the product because you are on viewing mode only"));
                    return;
                }
                DataColumn col = CurrentTable.Columns[SelectedProduct.Text];
                if (col == null)
                {
                    ToastNotification.Show(this, "No selected product");
                    return;
                }

                if (SelectedProduct.Text == "Rename Agent")
                {
                    ToastNotification.Show(this, ($"Can't rename the agent fields: {SelectedProduct.Text}"));
                    return;
                }
                var newName  = "";
                var InputBox = new MetroForm();
                InputBox.Height          = 150;
                InputBox.Width           = 250;
                InputBox.StartPosition   = FormStartPosition.CenterScreen;
                InputBox.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                InputBox.MaximizeBox     = false;
                InputBox.Controls.Add(new LabelX {
                    AutoSize = true, Name = "ForgotPass", Text = $"Enter New Name for {SelectedProduct.Text}", Location = new Point(10, 10)
                });
                InputBox.Controls.Add(new TextBoxX {
                    Size = new Size(200, 100), AutoSize = true, Name = "InputField", Location = new Point(10, 30)
                });
                InputBox.Controls.Add(new ButtonX {
                    AutoSize = true, Name = "Submit", Text = "Submit", Location = new Point(10, 60)
                });
                InputBox.Text = "Rename Product";
                InputBox.GetControl <ButtonX>("Submit").Click += (_, ee) =>
                {
                    newName = InputBox.GetControl <TextBoxX>("InputField").Text;
                    InputBox.Close();
                };
                InputBox.ShowDialog(); if (CurrentTable.Columns.Contains(newName))
                {
                    ToastNotification.Show(this, $"{newName} already exist in the sales");
                    return;
                }
                if (newName == "")
                {
                    ToastNotification.Show(this, "No value has been set");
                    return;
                }
                col.ColumnName = newName;
                SetSalesView();
                NotSaved = true;
                break;

            case "Delete Product":
                if (SalesView.ReadOnly)
                {
                    ToastNotification.Show(this, ($"Can't delete the product because you are on viewing mode only"));
                    return;
                }
                if (SelectedProduct.Text == "Rename Agent")
                {
                    ToastNotification.Show(this, ($"Can't delete the agent field: {SelectedProduct.Text}"));
                    return;
                }
                if (!CurrentTable.Columns.Contains(SelectedProduct.Text))
                {
                    ToastNotification.Show(this, ($"Sales doesn't contain this product: {SelectedProduct.Text}"));
                    return;
                }
                if (MessageBoxEx.Show($"Are you sure you want to delete: {SelectedProduct.Text} ?", "Delete Column", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    CurrentTable?.DeleteColumns(SelectedProduct.Text);
                    SetSalesView();
                    NotSaved = true;
                }
                break;

            case "Show Sales Range":
                if (CurrentTable == null)
                {
                    ToastNotification.Show(this, "You have not selected a manager");
                    return;
                }
                StatusLabel.Text = $"{GetSalesDateRange()}";
                break;

            case "Rename Agent":
                if (SalesView.CurrentCell == null)
                {
                    return;
                }
                var selectedAgent = SalesView.CurrentCell.Value.ToString();
                if (selectedAgent == "Total Sales")
                {
                    return;
                }
                if (MessageBoxEx.Show($"Do you want to rename the selected agent : {selectedAgent}", "Rename Agent", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    var newAgentName = "";
                    var AgentBox     = new MetroForm();
                    AgentBox.Height          = 150;
                    AgentBox.Width           = 250;
                    AgentBox.StartPosition   = FormStartPosition.CenterScreen;
                    AgentBox.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                    AgentBox.MaximizeBox     = false;
                    AgentBox.Controls.Add(new LabelX {
                        AutoSize = true, Name = "ForgotPass", Text = $"Enter New Name for {SelectedProduct.Text} : {selectedAgent}", Location = new Point(10, 10)
                    });
                    AgentBox.Controls.Add(new TextBoxX {
                        Size = new Size(200, 100), AutoSize = true, Name = "InputField", Location = new Point(10, 30)
                    });
                    AgentBox.Controls.Add(new ButtonX {
                        AutoSize = true, Name = "Submit", Text = "Submit", Location = new Point(10, 60)
                    });
                    AgentBox.Text = "Rename Agent";
                    AgentBox.GetControl <ButtonX>("Submit").Click += (_, ee) =>
                    {
                        newAgentName = AgentBox.GetControl <TextBoxX>("InputField").Text;
                        AgentBox.Close();
                    };
                    AgentBox.ShowDialog();
                    if (CurrentTable.Rows.Contains(newAgentName))
                    {
                        ToastNotification.Show(this, $"{newAgentName} already exist in the sales agent list");
                        return;
                    }
                    if (newAgentName == "")
                    {
                        ToastNotification.Show(this, "No value has been set");
                        return;
                    }
                    SalesView.CurrentCell.Value = newAgentName;
                    ToastNotification.Show(this, $"Renamed {selectedAgent} to {newAgentName}");
                    SetSalesView();
                    NotSaved = true;
                }
                break;

            case "Show Managers Sales":
                if (CurrentAdmin == "")
                {
                    return;
                }
                SetSalesDataSet(CurrentAdmin, this);
                MainStatusPanel.Visible = false;
                break;

                /*  case "Print":
                 *    var salesReport = new CrystalSalesReport();
                 *    var salesReportViewer = new CrystalReportViewer();
                 *    salesReport.Database.Tables[0].SetDataSource();
                 *    salesReport.Refresh();
                 *    salesReportViewer.Parent = this;
                 *    salesReportViewer.Dock = DockStyle.Fill;
                 *    salesReportViewer.ReportSource = salesReport;
                 *    salesReportViewer.Refresh();
                 *    salesReportViewer.RefreshReport();
                 *    salesReportViewer.Show();
                 *    break; */
            }
        }
示例#17
0
        public static LaunchPad ShowDialog(string pad, MetroFramework.Controls.MetroTile btn)
        {
            MetroForm prompt = new MetroForm()
            {
                Width       = 500,
                Height      = 180,
                Text        = pad,
                MaximizeBox = false
            };

            MetroFramework.Controls.MetroTextBox timerVal = new MetroFramework.Controls.MetroTextBox();
            timerVal.Location = new System.Drawing.Point(130, 100);
            timerVal.Size     = new System.Drawing.Size(25, 20);
            timerVal.Text     = "0";

            // timer slider
            MetroFramework.Controls.MetroTrackBar timerSlider = new MetroFramework.Controls.MetroTrackBar();
            timerSlider.Minimum       = 0;
            timerSlider.Maximum       = 60;
            timerSlider.BackColor     = System.Drawing.Color.Transparent;
            timerSlider.Location      = new System.Drawing.Point(28, 80);
            timerSlider.Name          = "pad_timer";
            timerSlider.Size          = new System.Drawing.Size(237, 23);
            timerSlider.TabIndex      = 4;
            timerSlider.Text          = "metroTrackBar1";
            timerSlider.Value         = 0;
            timerSlider.ValueChanged += (sender, e) => {
                timerVal.Text = ((MetroFramework.Controls.MetroTrackBar)sender).Value.ToString();
            };



            // enable btn
            MetroFramework.Controls.MetroButton enableBtn = new MetroFramework.Controls.MetroButton()
            {
                Text = "Enable", Left = 350, Width = 100, Top = 100, DialogResult = DialogResult.OK
            };

            // disable btn
            MetroFramework.Controls.MetroButton disableBtn = new MetroFramework.Controls.MetroButton()
            {
                Text = "Disable", Left = 350, Width = 100, Top = 125, DialogResult = DialogResult.Cancel
            };

            enableBtn.Click  += (sender, e) => { prompt.Close(); };
            disableBtn.Click += (sender, e) => { prompt.Close(); };
            prompt.Controls.Add(timerSlider);
            prompt.Controls.Add(timerVal);
            prompt.Controls.Add(enableBtn);
            prompt.Controls.Add(disableBtn);
            prompt.AcceptButton = enableBtn;

            if (prompt.ShowDialog() == DialogResult.OK)
            {
                return(new LaunchPad(pad, timerVal.Text));
            }
            else
            {
                return(null);
            }

            //return prompt.ShowDialog() == DialogResult.OK ? "" : "";
        }
示例#18
0
        public static string MultipleInstallation(string Description, string Title, Dictionary <string, string> installs)
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1));
            MetroForm metroForm = new MetroForm();

            metroForm.ShadowType      = MetroFormShadowType.AeroShadow;
            metroForm.Width           = 280;
            metroForm.Height          = 135;
            metroForm.FormBorderStyle = FormBorderStyle.None;
            metroForm.Resizable       = false;
            metroForm.Icon            = (Icon)componentResourceManager.GetObject("notifyIcon1.Icon");
            metroForm.ControlBox      = false;
            metroForm.Theme           = MetroThemeStyle.Dark;
            metroForm.DisplayHeader   = false;
            metroForm.TopMost         = true;
            metroForm.Text            = Title;
            metroForm.StartPosition   = FormStartPosition.CenterScreen;
            MetroForm  prompt = metroForm;
            MetroLabel value  = new MetroLabel
            {
                Left      = 5,
                Top       = 20,
                Text      = Description,
                Width     = 270,
                Height    = 40,
                TextAlign = ContentAlignment.MiddleCenter,
                Theme     = MetroThemeStyle.Dark
            };
            MetroComboBox metroComboBox = new MetroComboBox
            {
                Left    = 5,
                Top     = 70,
                Width   = 270,
                Theme   = MetroThemeStyle.Dark,
                ImeMode = ImeMode.NoControl
            };
            MetroButton metroButton = new MetroButton
            {
                Text         = "Ok",
                Left         = 5,
                Width        = 100,
                Top          = 100,
                DialogResult = DialogResult.OK,
                Theme        = MetroThemeStyle.Dark
            };

            metroButton.Click += delegate
            {
                prompt.Close();
            };
            metroButton.TabStop = false;
            metroComboBox.Items.Add("Choose Default Installation");
            if (installs.ContainsKey("NA/EU") && installs["NA/EU"].ToString().Length > 1)
            {
                metroComboBox.Items.Add("NA/EU");
            }
            if (installs.ContainsKey("Taiwan") && installs["Taiwan"].ToString().Length > 1)
            {
                metroComboBox.Items.Add("Taiwan");
            }
            if (installs.ContainsKey("Japanese") && installs["Japanese"].ToString().Length > 1)
            {
                metroComboBox.Items.Add("Japanese");
            }
            if (installs.ContainsKey("Korean") && installs["Korean"].ToString().Length > 1)
            {
                metroComboBox.Items.Add("Korean");
            }
            if (installs.ContainsKey("Korean Test") && installs["Korean Test"].ToString().Length > 1)
            {
                metroComboBox.Items.Add("Korean Test");
            }
            metroComboBox.TabStop       = false;
            metroComboBox.SelectedIndex = 0;
            prompt.Controls.Add(metroComboBox);
            prompt.Controls.Add(metroButton);
            prompt.Controls.Add(value);
            prompt.AcceptButton = metroButton;
            prompt.Style        = ColorSet;
            prompt.ShowDialog();
            if (metroComboBox.SelectedItem.ToString() == "Choose Default Installation")
            {
                metroComboBox.SelectedIndex = 1;
            }
            return(installs[metroComboBox.SelectedItem.ToString()]);
        }
示例#19
0
        public static string MultipleLang(string Description, string Title, Dictionary <int, string> languages)
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1));
            MetroForm metroForm = new MetroForm();

            metroForm.ShadowType      = MetroFormShadowType.AeroShadow;
            metroForm.Width           = 280;
            metroForm.Height          = 135;
            metroForm.FormBorderStyle = FormBorderStyle.None;
            metroForm.Resizable       = false;
            metroForm.Icon            = (Icon)componentResourceManager.GetObject("notifyIcon1.Icon");
            metroForm.ControlBox      = false;
            metroForm.Theme           = MetroThemeStyle.Dark;
            metroForm.DisplayHeader   = false;
            metroForm.TopMost         = true;
            metroForm.Text            = Title;
            metroForm.StartPosition   = FormStartPosition.CenterScreen;
            MetroForm  prompt = metroForm;
            MetroLabel value  = new MetroLabel
            {
                Left      = 5,
                Top       = 20,
                Text      = Description,
                Width     = 270,
                Height    = 40,
                TextAlign = ContentAlignment.MiddleCenter,
                Theme     = MetroThemeStyle.Dark
            };
            MetroComboBox metroComboBox = new MetroComboBox
            {
                Left    = 5,
                Top     = 70,
                Width   = 270,
                Theme   = MetroThemeStyle.Dark,
                ImeMode = ImeMode.NoControl
            };
            MetroButton metroButton = new MetroButton
            {
                Text         = "Ok",
                Left         = 5,
                Width        = 100,
                Top          = 100,
                DialogResult = DialogResult.OK,
                Theme        = MetroThemeStyle.Dark
            };

            metroButton.Click += delegate
            {
                prompt.Close();
            };
            metroButton.TabStop = false;
            metroComboBox.Text  = "Choose Game Language";
            metroComboBox.Items.Add("Choose Game Language");
            metroComboBox.SelectedIndex = 0;
            metroComboBox.TabStop       = false;
            for (int i = 0; languages.Count > i; i++)
            {
                metroComboBox.Items.Add(languages[i]);
            }
            prompt.Controls.Add(metroComboBox);
            prompt.Controls.Add(metroButton);
            prompt.Controls.Add(value);
            prompt.AcceptButton = metroButton;
            prompt.Style        = ColorSet;
            prompt.ShowDialog();
            if (metroComboBox.SelectedItem.ToString() == "Choose Game Language")
            {
                metroComboBox.SelectedIndex = 1;
            }
            return(metroComboBox.SelectedItem.ToString());
        }
示例#20
0
 private void metroButton1_Click(object sender, EventArgs e)
 {
     SymbolsForm.ShowDialog();
 }