コード例 #1
0
        void InitializeComponents()
        {
            DeleteTypeButtonIndex   = 1;
            ApplyChangesButtonIndex = 0;

            this.Size = new Size(WIDTH, HEIGHT);
            Size standard = new Size(150, 20);

            Label manageTypeLabel = new Label();

            manageTypeLabel.Text     = "Manage Tag Type";
            manageTypeLabel.Font     = new Font("Microsoft Sans Serif", 14F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            manageTypeLabel.Size     = new Size(180, 25);
            manageTypeLabel.Location = new Point(xValue + 5, yValue + 5);

            Label typesLabel = new Label();

            typesLabel.Text     = "Tag Types";
            typesLabel.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            typesLabel.Size     = standard;
            typesLabel.Location = new Point(xValue + 10, yValue + 35);

            typesList          = new TTTDisplayer <TagType>();
            typesList.Font     = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            typesList.Size     = new Size(280, 200);
            typesList.Location = new Point(xValue + 10, yValue + 65);

            Label typeNameLabel = new Label();

            typeNameLabel.Text     = "Edit Type Name";
            typeNameLabel.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            typeNameLabel.Size     = standard;
            typeNameLabel.Location = new Point(xValue + 10, yValue + 255);

            TextBox newTypeName = new TextBox();

            newTypeName.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            newTypeName.Size     = standard;
            newTypeName.Location = new Point(xValue + 10, yValue + 285);

            Label newNsfwLabel = new Label();

            newNsfwLabel.Text     = "Edit NSFW";
            newNsfwLabel.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            newNsfwLabel.Size     = new Size(100, 20);
            newNsfwLabel.Location = new Point(xValue + 185, yValue + 255);

            CheckBox newNsfwCheck = new CheckBox();

            newNsfwCheck.Size     = new Size(50, 20);
            newNsfwCheck.Location = new Point(xValue + 220, yValue + 290);

            Button deleteTypeButton = new Button();

            deleteTypeButton.Text      = "Delete Tag";
            deleteTypeButton.ForeColor = Color.Red;
            deleteTypeButton.Font      = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            deleteTypeButton.Size      = new Size(120, 40);
            deleteTypeButton.Location  = new Point(xValue + 25, yValue + 325);

            Button applyChangesButton = new Button();

            applyChangesButton.Text     = "Apply Changes";
            applyChangesButton.Font     = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            applyChangesButton.Size     = new Size(120, 40);
            applyChangesButton.Location = new Point(xValue + 160, yValue + 325);


            this.Controls.Add(manageTypeLabel);
            this.Controls.Add(typesLabel);
            this.Controls.Add(typesList);
            this.Controls.Add(typeNameLabel);
            this.Controls.Add(newTypeName);
            this.Controls.Add(newNsfwLabel);
            this.Controls.Add(newNsfwCheck);
            this.Controls.Add(deleteTypeButton);
            this.Controls.Add(applyChangesButton);

            this.Location = new Point(xValue, yValue);

            deleteTypeButton.BringToFront();
            applyChangesButton.BringToFront();

            typesList.SelectedIndexChanged += new EventHandler(typesList_Changed);
            void typesList_Changed(object sender, EventArgs e)
            {
                if (typesList.SelectedIndex != -1)
                {
                    newTypeName.Text     = types[typesList.SelectedIndex].getName();
                    newNsfwCheck.Checked = types[typesList.SelectedIndex].getNsfw();
                }
            }

            deleteTypeButton.Click += new EventHandler(deleteTypeButton_Click);
            void deleteTypeButton_Click(object sender, EventArgs e)
            {
                DialogResult dr = MessageBox.Show("Are you sure you want to delete this type", "Confirmation", MessageBoxButtons.YesNo);

                if (dr == DialogResult.Yes)
                {
                    if (typesList.SelectedIndex != -1)
                    {
                        types.RemoveAt(typesList.SelectedIndex);

                        typesList.ClearSelected();
                        newTypeName.Text     = "";
                        newNsfwCheck.Checked = false;
                    }
                }
            }

            applyChangesButton.Click += new EventHandler(applyChangesButton_Click);
            void applyChangesButton_Click(object sender, EventArgs e)
            {
                DialogResult dr = MessageBox.Show("Are you sure you want to edit this type", "Confirmation", MessageBoxButtons.YesNo);

                if (dr == DialogResult.Yes)
                {
                    if (typesList.SelectedIndex != -1)
                    {
                        TagType tt = new TagType(newTypeName.Text, newNsfwCheck.Checked);
                        types[typesList.SelectedIndex] = tt;

                        typesList.ClearSelected();
                        newTypeName.Text     = "";
                        newNsfwCheck.Checked = false;
                    }
                }
            }
        }
コード例 #2
0
        void InitializeComponents()
        {
            CreatedFilter = null;
            ButtonIndex   = 0;

            this.Size = new Size(WIDTH, HEIGHT);

            //makin all the graphical stuff, labels, buttons n whatnot
            Label addFilterLabel = new Label();

            addFilterLabel.Text     = "Add Tag/Tag Type Filter";
            addFilterLabel.Font     = new Font("Microsoft Sans Serif", 14F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            addFilterLabel.Size     = new Size(180, 25);
            addFilterLabel.Location = new Point(xValue + 5, yValue + 5);

            Label chooseLabel = new Label();

            chooseLabel.Text     = "Choose";
            chooseLabel.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            chooseLabel.Size     = new Size(70, 25);
            chooseLabel.Location = new Point(xValue + 10, yValue + 40);

            TTTChooser chooser = new TTTChooser();

            chooser.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            chooser.Location = new Point(xValue + 90, yValue + 35);

            //tDisplay
            tDisplay.Location = new Point(xValue + 10, yValue + 65);
            tDisplay.Size     = new Size(200, 200);

            //ttDisplay
            ttDisplay.Location = new Point(xValue + 10, yValue + 65);
            ttDisplay.Size     = new Size(200, 200);

            CheckBox includeBox = new CheckBox();

            includeBox.Text     = "Include";
            includeBox.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            includeBox.Size     = new Size(100, 20);
            includeBox.Location = new Point(xValue + 10, yValue + 270);
            includeBox.Checked  = true;

            Button createFilterButton = new Button();

            createFilterButton.Name     = "createFilterButton";
            createFilterButton.Text     = "Create filter";
            createFilterButton.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            createFilterButton.Size     = new Size(150, 30);
            createFilterButton.Location = new Point(xValue + 35, yValue + 300);

            //adding them to form
            this.Controls.Add(addFilterLabel);
            this.Controls.Add(chooseLabel);
            this.Controls.Add(chooser);
            this.Controls.Add(tDisplay);
            this.Controls.Add(ttDisplay);
            this.Controls.Add(includeBox);
            this.Controls.Add(createFilterButton);

            this.Location = new Point(xValue, yValue);

            //this sets the Tag display as the default display, when you first enter the screen
            ttDisplay.SendToBack();
            createFilterButton.BringToFront();


            //this is the event handler that checks if the user has selected on the TTTChooser
            chooser.SelectedIndexChanged += new EventHandler(chooserChanged);
            void chooserChanged(object sender, EventArgs e)
            {
                //if the type is true(Tag) displays tags
                if (chooser.getTypeBool())
                {
                    ttDisplay.SendToBack();
                    tDisplay.ClearSelected(); //this just unselects things from the display when you unselect it
                }
                //if the type is false(TagType) displays tag types
                if (!chooser.getTypeBool())
                {
                    tDisplay.SendToBack();
                    ttDisplay.ClearSelected();
                }
            }

            createFilterButton.Click += new EventHandler(createFilterButton_Click);
            void createFilterButton_Click(object sender, EventArgs e)
            {
                if (chooser.getTypeBool())
                {
                    if (tDisplay.SelectedIndex != -1)
                    {
                        Filter f = new Filter(tDisplay.getSelected(), includeBox.Checked);
                        CreatedFilter = f;
                        tDisplay.ClearSelected();
                    }
                    else
                    {
                        MessageBox.Show("Ape u didnt select a tag", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    if (ttDisplay.SelectedIndex != -1)
                    {
                        Filter f = new Filter(ttDisplay.getSelected(), includeBox.Checked);
                        CreatedFilter = f;
                        ttDisplay.ClearSelected();
                    }
                    else
                    {
                        MessageBox.Show("Ape u didnt select a tag type", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }
コード例 #3
0
        void InitializeComponents()
        {
            DeleteTagButtonIndex    = 1;
            ApplyChangesButtonIndex = 0;

            this.Size = new Size(WIDTH, HEIGHT);
            Size standard = new Size(150, 20);

            Label manageTagsLabel = new Label();

            manageTagsLabel.Text     = "Manage Tags";
            manageTagsLabel.Font     = new Font("Microsoft Sans Serif", 14F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            manageTagsLabel.Size     = new Size(150, 25);
            manageTagsLabel.Location = new Point(xValue + 5, yValue + 5);

            Label tagsLabel = new Label();

            tagsLabel.Text     = "Tags";
            tagsLabel.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            tagsLabel.Size     = standard;
            tagsLabel.Location = new Point(xValue + 10, yValue + 35);

            tagsList.Font     = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            tagsList.Size     = new Size(280, 200);
            tagsList.Location = new Point(xValue + 10, yValue + 65);

            Label tagNameLabel = new Label();

            tagNameLabel.Text     = "Edit Tag Name";
            tagNameLabel.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            tagNameLabel.Size     = standard;
            tagNameLabel.Location = new Point(xValue + 10, yValue + 255);

            TextBox newTagName = new TextBox();

            newTagName.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            newTagName.Size     = standard;
            newTagName.Location = new Point(xValue + 10, yValue + 285);

            Label newTagType = new Label();

            newTagType.Text     = "New Tag Type";
            newTagType.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            newTagType.Size     = standard;
            newTagType.Location = new Point(xValue + 10, yValue + 315);

            ComboBox tagTypeCombo = new ComboBox();

            tagTypeCombo.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            tagTypeCombo.Width    = 150;
            tagTypeCombo.Location = new Point(xValue + 10, yValue + 345);

            Label editColorLabel = new Label();

            editColorLabel.Text     = "Edit Color";
            editColorLabel.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            editColorLabel.Size     = new Size(80, 20);
            editColorLabel.Location = new Point(xValue + 190, yValue + 255);

            ColorPicker newTagColor = new ColorPicker();

            newTagColor.Font     = new Font("Microsoft Sans Serif", 9.5F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            newTagColor.Width    = 40;
            newTagColor.Location = new Point(xValue + 205, yValue + 285);

            Label newNsfw = new Label();

            newNsfw.Text     = "Edit NSFW";
            newNsfw.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            newNsfw.Size     = new Size(100, 20);
            newNsfw.Location = new Point(xValue + 185, yValue + 315);

            CheckBox newNsfwCheck = new CheckBox();

            newNsfwCheck.Size     = new Size(50, 20);
            newNsfwCheck.Location = new Point(xValue + 220, yValue + 350);

            Button deleteTagButton = new Button();

            deleteTagButton.Text      = "Delete Tag";
            deleteTagButton.ForeColor = Color.Red;
            deleteTagButton.Font      = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            deleteTagButton.Size      = new Size(120, 40);
            deleteTagButton.Location  = new Point(xValue + 25, yValue + 385);

            Button applyChangesButton = new Button();

            applyChangesButton.Text     = "Apply Changes";
            applyChangesButton.Font     = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            applyChangesButton.Size     = new Size(120, 40);
            applyChangesButton.Location = new Point(xValue + 160, yValue + 385);

            this.Controls.Add(manageTagsLabel);
            this.Controls.Add(tagsLabel);
            this.Controls.Add(tagsList);
            this.Controls.Add(tagNameLabel);
            this.Controls.Add(newTagName);
            this.Controls.Add(newTagType);
            this.Controls.Add(tagTypeCombo);
            this.Controls.Add(editColorLabel);
            this.Controls.Add(newTagColor);
            this.Controls.Add(newNsfw);
            this.Controls.Add(newNsfwCheck);
            this.Controls.Add(deleteTagButton);
            this.Controls.Add(applyChangesButton);

            this.Location = new Point(xValue, yValue);

            deleteTagButton.BringToFront();
            applyChangesButton.BringToFront();

            deleteTagButton.Click += new EventHandler(deleteTagButton_Click);
            void deleteTagButton_Click(object sender, EventArgs e)
            {
                DialogResult dr = MessageBox.Show("Are you sure you want to delete this tag", "Confirmation", MessageBoxButtons.YesNo);

                if (dr == DialogResult.Yes)
                {
                    if (tagsList.SelectedIndex != -1)
                    {
                        tags.RemoveAt(tagsList.SelectedIndex);

                        tagsList.ClearSelected();
                        newTagName.Text      = "";
                        newNsfwCheck.Checked = false;
                    }
                }
            }

            applyChangesButton.Click += new EventHandler(applyChangesButton_Click);
            void applyChangesButton_Click(object sender, EventArgs e)
            {
                DialogResult dr = MessageBox.Show("Are you sure you want to edit this tag", "Confirmation", MessageBoxButtons.YesNo);

                if (dr == DialogResult.Yes)
                {
                    if (tagsList.SelectedIndex != -1)
                    {
                        if (tagTypeCombo.SelectedIndex != -1)
                        {
                            Tag t = new Tag(newTagName.Text, newTagColor.getColor(), types[tagTypeCombo.SelectedIndex], newNsfwCheck.Checked);
                        }
                    }
                }
            }
        }