Пример #1
0
        public Tuple <int, bool, DialogResult, string> ShowDialog(List <ProjectDocument> projects)
        {
            bool         IsNewProject      = true;
            DialogResult result            = DialogResult.None;
            var          newProjectTextBox = new TextBox()
            {
                Height = 20, Width = 150, Font = DefaultFont
            };

            form = new DialogForm(new FormInfo("Projects", 485, 600));
            using (form)
            {
                var layout = new FlowLayoutPanel()
                {
                    Dock = DockStyle.Fill, FlowDirection = FlowDirection.TopDown, WrapContents = false
                };
                var newProjectLayout = new FlowLayoutPanel()
                {
                    FlowDirection = FlowDirection.LeftToRight, WrapContents = false, Width = 330
                };
                var newProjectLabel = new Label()
                {
                    Text = "Project Name", Height = 20, Width = 80, Font = DefaultFont, TextAlign = ContentAlignment.MiddleCenter
                };

                var newProjectButton = new Button()
                {
                    Text = "Go", Height = 20, Font = DefaultFont
                };
                newProjectButton.Click += (sender, e) =>
                {
                    if (newProjectTextBox.Text != string.Empty)
                    {
                        form.DialogResult = DialogResult.OK;
                        form.Close();
                    }
                    else
                    {
                        MessageBox.Show("please enter a name for the project");
                    }
                };

                newProjectLayout.Controls.Add(newProjectLabel);
                newProjectLayout.Controls.Add(newProjectTextBox);
                newProjectLayout.Controls.Add(newProjectButton);
                layout.Controls.Add(newProjectLayout);
                layout.Controls.Add(BuildExistingProjectLayout(projects));

                form.Controls.Add(layout);
                result = form.ShowDialog();
            }

            return(new Tuple <int, bool, DialogResult, string>(ProjectId, IsNewProject, result, newProjectTextBox.Text));
        }
Пример #2
0
        public Tuple <ProjectResult, DialogResult> ShowDialog()
        {
            DialogResult  result;
            ProjectResult projectTypeSelected = ProjectResult.Simple;
            var           projectTypeGroupBox = new GroupBox {
                Text = "Project Type", Top = 100, Dock = DockStyle.Fill
            };
            var layoutContainer = new FlowLayoutPanel {
                Dock = DockStyle.Fill
            };
            var radioButtonSimple = new RadioButton()
            {
                Text = "Simple", Checked = true
            };
            var radioButtonComplex = new RadioButton()
            {
                Text = "Complex"
            };
            var radioButtonEmpty = new RadioButton()
            {
                Text = "Empty"
            };

            layoutContainer.Controls.Add(radioButtonSimple);
            layoutContainer.Controls.Add(radioButtonComplex);
            layoutContainer.Controls.Add(radioButtonEmpty);
            var continueButton = new Button()
            {
                Text = "Create", Anchor = AnchorStyles.Right | AnchorStyles.Bottom
            };

            layoutContainer.Controls.Add(continueButton);
            projectTypeGroupBox.Controls.Add(layoutContainer);
            using (var form = new DialogForm(new FormInfo("Create New Project", 485, 600)))
            {
                form.Controls.Add(projectTypeGroupBox);

                continueButton.Click += (sender, e) =>
                {
                    projectTypeSelected = ReturnSelectedProjectType(radioButtonSimple, radioButtonComplex, radioButtonEmpty);
                    form.DialogResult   = DialogResult.OK;
                    form.Close();
                };
                result = form.ShowDialog();
            }
            return(new Tuple <ProjectResult, DialogResult>(projectTypeSelected, result));
        }
Пример #3
0
        public Tuple <string, string, int, DialogResult, string> ShowDialog()
        {
            string       type = "Idea";
            MetroTextBox name = new MetroTextBox()
            {
                Width = 460, Height = 20, TabIndex = 0, TabStop = true, Multiline = false, Text = ""
            };
            MetroTextBox description = new MetroTextBox()
            {
                Width = 460, Height = 350, TabIndex = 0, TabStop = true, Multiline = true, Text = ""
            };
            var numericUpDown = new NumericUpDown()
            {
                Width = 50, Height = 20, TabIndex = 0, TabStop = true
            };
            var result = DialogResult;

            using (var form = new DialogForm(new FormInfo("Add Card", 485, 600)))
            {
                MetroLabel nameLabel = new MetroLabel()
                {
                    Height = 20, Text = "Card Name"
                };

                name.Left = 4;

                description.Left = 4;

                MetroLabel descriptionLabel = new MetroLabel()
                {
                    Text = "Card Description", Width = 110
                };
                MetroButton confirmation = new MetroButton()
                {
                    Text = "Save", TabIndex = 1, TabStop = true
                };
                MetroButton close = new MetroButton()
                {
                    Text = "close", TabIndex = 1, TabStop = true
                };
                confirmation.Click += (sender, e) =>
                {
                    form.DialogResult = DialogResult.OK;
                    form.Close();
                };
                close.Click += (sender, e) =>
                {
                    form.DialogResult = DialogResult.Cancel;
                    form.Close();
                };

                var propertiesLayout = new FlowLayoutPanel();
                propertiesLayout.Size          = new System.Drawing.Size(485, 30);
                propertiesLayout.FlowDirection = FlowDirection.LeftToRight;
                var pointsLabel = new MetroLabel()
                {
                    Text = "Points"
                };

                propertiesLayout.Controls.Add(pointsLabel);
                propertiesLayout.Controls.Add(numericUpDown);
                //TODO - > add card type controls
                var typesLabel = new Label()
                {
                    Text = "Card Type"
                };
                var typeDropDown = new ComboBox();

                propertiesLayout.Controls.Add(typesLabel);
                propertiesLayout.Controls.Add(typeDropDown);
                typeDropDown.Items.Add("Idea");
                typeDropDown.Items.Add("Requirement");
                typeDropDown.Items.Add("Bug");
                typeDropDown.Items.Add("External Requirement");
                typeDropDown.FlatStyle             = FlatStyle.Flat;
                typeDropDown.DropDownStyle         = ComboBoxStyle.DropDownList;
                typeDropDown.SelectedIndexChanged += (sender, e) =>
                {
                    type = (string)((ComboBox)(sender)).SelectedItem;
                };


                var flowLayoutVertical = new FlowLayoutPanel();

                flowLayoutVertical.FlowDirection = FlowDirection.TopDown;
                flowLayoutVertical.Location      = new System.Drawing.Point(0, 60);
                flowLayoutVertical.Size          = new System.Drawing.Size(485, 600);
                flowLayoutVertical.Controls.Add(nameLabel);
                flowLayoutVertical.Controls.Add(name);
                flowLayoutVertical.Controls.Add(descriptionLabel);
                flowLayoutVertical.Controls.Add(description);
                flowLayoutVertical.Controls.Add(propertiesLayout);
                var buttonLayoutPanel = new FlowLayoutPanel
                {
                    FlowDirection = FlowDirection.RightToLeft,
                    Top           = 420,
                    Left          = 4,
                    Width         = 460
                };
                buttonLayoutPanel.Controls.Add(close);
                buttonLayoutPanel.Controls.Add(confirmation);
                flowLayoutVertical.Controls.Add(buttonLayoutPanel);
                form.Controls.Add(flowLayoutVertical);
                //TODO build form
                form.FormBorderStyle = FormBorderStyle.FixedDialog;
                form.StartPosition   = FormStartPosition.CenterScreen;
                form.ControlBox      = false;
                result = form.ShowDialog();
            }

            return(new Tuple <string, string, int, DialogResult, string>(name.Text, description.Text, Decimal.ToInt32(d: numericUpDown.Value), result, type));
        }
Пример #4
0
        public void ShowDialog(string cardName, string cardDescription, int cardPoints, int cardId, CardTypes cardType)
        {
            Label cardTypeLabel = new Label()
            {
                Text = cardType.ToString(), Width = 200
            };
            MetroLabel name = new MetroLabel()
            {
                Width = 460, Height = 20, TabIndex = 0, TabStop = true, Text = cardName
            };
            MetroTextBox description = new MetroTextBox()
            {
                Width = 460, Height = 350, TabIndex = 0, TabStop = true, Text = cardDescription, ReadOnly = true, Multiline = true
            };
            var numericUpDown = new MetroLabel()
            {
                Width = 50, Height = 20, TabIndex = 0, TabStop = true, Text = cardPoints.ToString()
            };
            var result = DialogResult;

            using (var form = new DialogForm(new FormInfo("View Card", 485, 600)))
            {
                MetroLabel nameLabel = new MetroLabel()
                {
                    Height = 20, Text = "Card Name"
                };

                name.Left = 4;

                description.Left = 4;

                MetroLabel descriptionLabel = new MetroLabel()
                {
                    Text = "Card Description", Width = 110
                };

                MetroButton close = new MetroButton()
                {
                    Text = "close", TabIndex = 1, TabStop = true
                };
                ;
                close.Click += (sender, e) =>
                {
                    form.DialogResult = DialogResult.OK;
                    form.Close();
                };

                var propertiesLayout = new FlowLayoutPanel();
                propertiesLayout.Size          = new System.Drawing.Size(485, 30);
                propertiesLayout.FlowDirection = FlowDirection.LeftToRight;
                var pointsLabel = new MetroLabel()
                {
                    Text = "Points"
                };

                propertiesLayout.Controls.Add(pointsLabel);
                propertiesLayout.Controls.Add(numericUpDown);
                propertiesLayout.Controls.Add(cardTypeLabel);


                var flowLayoutVertical = new FlowLayoutPanel();

                flowLayoutVertical.FlowDirection = FlowDirection.TopDown;
                flowLayoutVertical.Location      = new System.Drawing.Point(0, 60);
                flowLayoutVertical.Size          = new System.Drawing.Size(485, 600);
                flowLayoutVertical.Controls.Add(nameLabel);
                flowLayoutVertical.Controls.Add(name);
                flowLayoutVertical.Controls.Add(descriptionLabel);
                flowLayoutVertical.Controls.Add(description);
                flowLayoutVertical.Controls.Add(propertiesLayout);
                var buttonLayoutPanel = new FlowLayoutPanel
                {
                    FlowDirection = FlowDirection.RightToLeft,
                    Top           = 420,
                    Left          = 4,
                    Width         = 460
                };
                buttonLayoutPanel.Controls.Add(close);
                flowLayoutVertical.Controls.Add(buttonLayoutPanel);
                form.Controls.Add(flowLayoutVertical);
                //TODO build form
                form.FormBorderStyle = FormBorderStyle.FixedDialog;
                form.StartPosition   = FormStartPosition.CenterScreen;
                form.ControlBox      = false;
                result = form.ShowDialog();
            }
        }