コード例 #1
0
        private void SettingPanel_Load(object sender, EventArgs e)
        {
            // 初始化权限界面
            int topPos = 30;
            int margin = 5;

            foreach (PrivilegeData data in privilegeManager.Privileges)
            {
                MaterialCheckBox checkedItem = new MaterialCheckBox();
                checkedItem.AutoSize        = true;
                checkedItem.Text            = data.PrivilegeText;
                checkedItem.Tag             = data;
                checkedItem.Location        = new System.Drawing.Point(margin * 2, topPos);
                checkedItem.CheckedChanged += new System.EventHandler(this.privilege_CheckedChanged);
                groupBoxPrivileges.Controls.Add(checkedItem);

                topPos += checkedItem.Size.Height + margin;
            }

            // 加载用户列表
            ArrayList users = privilegeManager.GetAllUsers();

            foreach (UserPrivilege privilege in users)
            {
                ListViewItem item = listBoxUsers.Items.Add(privilege.UserName);
                item.Tag = privilege;
            }

            if (listBoxUsers.Items.Count > 0)
            {
                listBoxUsers.Items[0].Selected = true;
                listBoxUsers.Select();
            }
        }
コード例 #2
0
        /// <summary>
        /// Cette méthode crée des contrôles de type CheckBox ou RadioButton dans un contrôle de type Panel.
        /// Elle va chercher les données dans la base de données et crée autant de contrôles (les uns en-dessous des autres)
        /// qu'il y a de lignes renvoyées par la base de données.
        /// </summary>
        /// <param name="unForm">Le formulaire concerné</param>
        /// <param name="uneConnexion">L'objet connexion à utiliser pour la connexion à la BD</param>
        /// <param name="pUneTable">Le nom de la source de données qui va fournir les données. Il s'agit en fait d'une vue de type
        /// VXXXXOn ou XXXX représente le nom de la table à partir de laquelle la vue est créée. n représente un numéro de séquence</param>
        /// <param name="pPrefixe">les noms des contrôles sont standards : NomControle_XX
        ///                                         où XX est l'ID de l'enregistrement récupéré dans la vue qui
        ///                                         sert de source de données</param>
        /// <param name="UnPanel">Panel ou GroupBox dans lequel on va créer les contrôles</param>
        /// <param name="unTypeControle">Type de contrôle à créer : CheckBox ou RadioButton</param>
        public static void CreerDesControles(Form unForm, Bdd uneConnexion, string pUneTable, string pPrefixe, ScrollableControl UnPanel, string unTypeControle)
        {
            DataTable uneTable = new DataTable();

            switch (pUneTable)
            {
            case "restauration":
                uneTable = uneConnexion.FindRestauration();
                break;

            default:
                throw new Exception("Entité Innexistante");
            }

            //// On va récupérer les statuts dans un DataTable puis on va parcourir les lignes (rows) de ce DataTable pour
            //// construire dynamiquement les boutons radio pour le statut de l'intervenant dans son atelier.
            short i = 0;

            foreach (DataRow uneLigne in uneTable.Rows)
            {
                if (unTypeControle == "CheckBox")
                {
                    MaterialCheckBox UnControle = new MaterialCheckBox();
                    AffecterControle(unForm, UnPanel, UnControle, pPrefixe, uneLigne, i++);
                }
                else if (unTypeControle == "RadioButton")
                {
                    MaterialRadioButton UnControle = new MaterialRadioButton();
                    AffecterControle(unForm, UnPanel, UnControle, pPrefixe, uneLigne, i++);
                }
                i++;
            }

            UnPanel.Height = 20 * i + 5;
        }
コード例 #3
0
        private void checkBox_CheckedChanged(object sender, EventArgs e)
        {
            checkBox1.CheckedChanged         -= checkBox_CheckedChanged;
            materialCheckBox1.CheckedChanged -= checkBox_CheckedChanged;
            materialCheckBox2.CheckedChanged -= checkBox_CheckedChanged;
            materialCheckBox3.CheckedChanged -= checkBox_CheckedChanged;
            materialCheckBox4.CheckedChanged -= checkBox_CheckedChanged;
            materialCheckBox5.CheckedChanged -= checkBox_CheckedChanged;

            foreach (Control ckb in this.Controls)
            {
                if (ckb is MaterialCheckBox)
                {
                    MaterialCheckBox cc = (MaterialCheckBox)ckb;
                    if ((MaterialCheckBox)sender == cc)
                    {
                        continue;
                    }

                    cc.Checked = false;
                }
            }

            checkBox1.CheckedChanged         += checkBox_CheckedChanged;
            materialCheckBox1.CheckedChanged += checkBox_CheckedChanged;
            materialCheckBox2.CheckedChanged += checkBox_CheckedChanged;
            materialCheckBox3.CheckedChanged += checkBox_CheckedChanged;
            materialCheckBox4.CheckedChanged += checkBox_CheckedChanged;
            materialCheckBox5.CheckedChanged += checkBox_CheckedChanged;
        }
コード例 #4
0
        private void materialListView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            if (!e.IsSelected)
            {
                return;
            }
            contenedorVariantes.Controls.Clear();
            TipoProducto tipo  = (TipoProducto)e.Item.Tag;
            var          lista = ControlProductoVariante.Instance.GetLista(tipo);

            if (lista == null)
            {
                MessageBox.Show("Revisa tu coneccion"); return;
            }

            foreach (ProductoVariante variante in lista)
            {
                MaterialCheckBox material = new MaterialCheckBox()
                {
                    Text = variante.nombre_variante,
                    Tag  = variante
                };
                contenedorVariantes.Controls.Add(material);
            }
        }
コード例 #5
0
        /// <summary>
        /// 10 Checkboxen brauchen 10 antworten im Array bei der Karte CorrectSolution vom Typ boolean
        /// </summary>
        /// <param name="count"></param>
        private void generateCheckBoxes(int count)
        {
            this.picPattern.Visible = false;
            this.chkPattern.Visible = false;
            this.lblPattern.Visible = false;

            MaterialCheckBox chk   = null;
            PictureBox       box   = null;
            MaterialLabel    label = null;

            for (int i = 0; i < count; i++)
            {
                chk          = new MaterialCheckBox();
                chk.Size     = new Size(24, 24);
                chk.Location = new Point(this.chkPattern.Location.X, this.chkPattern.Location.Y + ((this.chkPattern.Height - 5) * i));
                this.Controls.Add(chk);

                label          = new MaterialLabel();
                label.Size     = new Size(100, 24);
                label.Location = new Point(this.lblPattern.Location.X, chk.Location.Y - 1);
                label.Text     = this.checkBoxText[i];
                this.Controls.Add(label);

                box          = new PictureBox();
                box.Location = new Point(this.picPattern.Location.X, chk.Location.Y - 2);
                box.Size     = new Size(25, 25);
                box.SizeMode = PictureBoxSizeMode.StretchImage;
                this.Controls.Add(box);

                this.checkBoxCollection.Add(chk);
                this.pictureBoxCollection.Add(box);
            }
        }
コード例 #6
0
ファイル: DungeonForm.cs プロジェクト: xDarkyne/DesoLib
        private void CheckBoxChanged(object sender, System.EventArgs e)
        {
            MaterialCheckBox checkBox = ((MaterialCheckBox)sender);

            switch (checkBox.Text)
            {
            case "Hardmode":
                CurrentDungeon.HardmodeDone = checkBox.Checked;
                break;

            case "Speedrun":
                CurrentDungeon.SpeedrunDone = checkBox.Checked;
                break;

            case "No Death":
                CurrentDungeon.NodeathDone = checkBox.Checked;
                break;

            case "Veteran":
                CurrentDungeon.DoneOnVet = checkBox.Checked;
                break;

            default:
                break;
            }

            UpdateDungeonData();
        }
コード例 #7
0
        protected override AppCompatCheckBox CreatePlatformView()
        {
            var platformCheckBox = new MaterialCheckBox(Context)
            {
                SoundEffectsEnabled = false
            };

            platformCheckBox.SetClipToOutline(true);
            return(platformCheckBox);
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: pierdziadek/OptifineProxy
        private void cbStartup_CheckedChanged(object sender, EventArgs e)
        {
            MaterialCheckBox cb = (MaterialCheckBox)sender;

            if (cb.Checked)
            {
                Startup.add();
            }
            else
            {
                Startup.remove();
            }
        }
コード例 #9
0
ファイル: FrmMain.cs プロジェクト: Gustavo-Kuze/Chocolatra
        /// <summary>
        /// Deletes all controls from panelListBoxContainer and than add a new checkbox for each
        /// package saved on the packages file
        /// </summary>
        private void RefreshList()
        {
            panelListBoxContainer.Controls.Clear();
            PackagesManagement pm = new PackagesManagement();
            var packages          = pm.load();

            foreach (var pack in packages)
            {
                MaterialCheckBox chkNew = new MaterialCheckBox();
                chkNew.Text = pack;
                FixChkSize(chkNew);
                AddCheckBox(chkNew);
            }
        }
コード例 #10
0
        private void materialRaisedButton5_Click_1(object sender, EventArgs e)
        {
            //			 >> RESET MENU PILIHAN <<
            listPesan.Items.Clear();
            foreach (Control ctrl in groupBox1.Controls)
            {
                MaterialCheckBox hapus = (MaterialCheckBox)ctrl;
                hapus.Checked = false;
            }
            foreach (Control ctrl in groupBox2.Controls)
            {
                ListView reset = (ListView)ctrl;
                reset.Items.Clear();
            }
            lblSubt.Text      = "-";
            lblPpn.Text       = "-";
            lblTotal.Text     = "-";
            lblKembalian.Text = "-";

            txtTambah.Clear();
            softech98.resetJmenu();
        }
コード例 #11
0
        private void ChkbxObligacion_CheckedChanged(object sender, EventArgs e)
        {
            MaterialCheckBox check = sender as MaterialCheckBox;
            byte             estado;

            if (check.Checked)
            {
                estado = 1;
            }
            else
            {
                estado = 0;
            }

            //SE GUARDA UN NUEVO REGISTRO SI EL CHECK ES MARCADO
            new RegistroObligacion().modificarRegistroObligacion(new RegistroObligacion()
            {
                iIdDetalleObligacion = int.Parse(check.Name),
                iIdCliente           = Cliente.iIdCliente,
                btEstado             = estado
            });
        }
コード例 #12
0
        void Add(int _index, Subject _subject)
        {
            MaterialTextBox textField = new MaterialTextBox();

            textField.ReadOnly     = true;
            textField.Location     = new Point(15, 30 + _index * 80);
            textField.Width        = 395;
            textField.Tag          = _subject.ID;
            textField.Hint         = _subject.Name;
            textField.Click       += new EventHandler(txtRunnerTeacher_Click);
            textField.TextChanged += TextField_TextChanged;
            MaterialTextBox textField2 = new MaterialTextBox();

            textField2.ReadOnly     = true;
            textField2.Location     = new Point(15, 30 + _index * 80);
            textField2.Width        = 395;
            textField2.Tag          = _subject.ID;
            textField2.Hint         = _subject.Name;
            textField2.Click       += new EventHandler(txtRunnerTeacher_Click);
            textField2.TextChanged += TextField_TextChanged;
            MaterialCheckBox checkBox = new MaterialCheckBox();

            checkBox.Location        = new Point(425, 45 + _index * 80);
            checkBox.Text            = "Khóa bảng điểm";
            checkBox.Tag             = _subject.ID;
            checkBox.CheckedColor    = Color.FromArgb(47, 144, 176);
            checkBox.CheckedChanged += CheckBox_CheckedChanged;
            MaterialCheckBox checkBox2 = new MaterialCheckBox();

            checkBox2.Location     = new Point(425, 45 + _index * 80);
            checkBox2.Text         = "Khóa bảng điểm";
            checkBox2.Tag          = _subject.ID;
            checkBox2.CheckedColor = Color.FromArgb(47, 144, 176);
            tbpgSem1.Controls.Add(textField);
            tbpgSem1.Controls.Add(checkBox);
            tbpgSem2.Controls.Add(textField2);
            tbpgSem2.Controls.Add(checkBox2);
        }
コード例 #13
0
ファイル: FrmMain.cs プロジェクト: Gustavo-Kuze/Chocolatra
        /// <summary>
        /// Insert the passed MaterialCheckBox inside panelListBoxContainer after the last one. If there aren't any controls in panelListBoxContainer, The checkbox gets added at 10 pixels from the top of the panel.
        /// </summary>
        /// <param name="checkBox">A new MaterialCheckBox to add to the panel</param>
        private void AddCheckBox(MaterialCheckBox checkBox)
        {
            if (panelListBoxContainer.Controls.Count > 0)
            {
                foreach (Control item in panelListBoxContainer.Controls)
                {
                    if (item.Text == checkBox.Text)
                    {
                        return;
                    }
                }

                Point lastCtrlPos = panelListBoxContainer.Controls[panelListBoxContainer.Controls.Count - 1].Location;
                checkBox.Location = new Point(lastCtrlPos.X, lastCtrlPos.Y + checkBox.Height + 10);

                panelListBoxContainer.Controls.Add(checkBox);
            }
            else
            {
                checkBox.Location = new Point(10, 10);
                panelListBoxContainer.Controls.Add(checkBox);
            }
        }
コード例 #14
0
        private void showProducts()
        {
            this.backgroundProductImageUploader.CancelAsync();
            clearTable();

            int row = productItems.Count;

            List <ProductModel> filteredProducts = new List <ProductModel>();

            //In case when there are no
            if (string.IsNullOrEmpty(productsGridOptions.searchProductName))
            {
                try
                {
                    filteredProducts = productProvider.GetProducts(
                        productsPerPageCount,
                        productsGridOptions.PageNumber,
                        productsGridOptions.SortColumnName,
                        productsGridOptions.SortOrder,
                        productsGridOptions.FilterProductTypeId).ToList();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, Resources.ErrorMessage);
                    return;
                }
            }
            else
            {
                this.productsGridOptions.PageNumber    = 1;
                this.leftSideProductListButton.Enabled = false;

                try
                {
                    filteredProducts = productProvider.SearchProductByName(
                        productsGridOptions.searchProductName).ToList();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, Resources.ErrorMessage);
                    return;
                }
            }

            if (filteredProducts.Count == 0)
            {
                this.noMoreProductMessageLabel.Visible  = true;
                this.rightSideProductListButton.Enabled = false;
                return;
            }

            this.noMoreProductMessageLabel.Visible  = false;
            this.rightSideProductListButton.Enabled = true;

            foreach (var product in filteredProducts)
            {
                MaterialCheckBox productCheckBox = new MaterialCheckBox();
                productCheckBox.Anchor = AnchorStyles.Bottom & AnchorStyles.None;

                this.productTableRowLabels = new Control[tableColumnCount];

                foreach (var selectedProduct in selectedProducts)
                {
                    if (selectedProduct.Id == product.Id)
                    {
                        productCheckBox.Checked = true;
                    }
                }

                this.productTableRowLabels[0] = productCheckBox;
                int initialTableDataColIndex = 2;

                for (int i = initialTableDataColIndex; i < productTableRowLabels.Length; i++)
                {
                    this.productTableRowLabels[i]          = new Label();
                    this.productTableRowLabels[i].AutoSize = true;
                    this.productTableRowLabels[i].Anchor   = AnchorStyles.None;
                    this.productTableRowLabels[i].Font     = commonFont;
                    this.productTableView.Controls.Add(productTableRowLabels[i], i, row);
                }

                var productItem = new ProductItem(product);
                productItems.Add(productItem);

                //Each time will be selecting an item in front of the Check box
                productCheckBox.CheckedChanged += (sender, e) =>
                {
                    var chackBox = (MaterialCheckBox)sender;
                    if (chackBox.Checked)
                    {
                        if (selectedProducts.Count == 0)
                        {
                            selectedProductsListBox.Items.RemoveAt(0);
                        }

                        this.selectedProductsListBox.Items.Insert(0, productItem.ProductModel.Name);
                        this.selectedProducts.Add(productItem.ProductModel);
                    }
                    else
                    {
                        this.selectedProducts.RemoveAll((p) => (p.Id == productItem.ProductModel.Id));
                        this.selectedProductsListBox.Items.Remove(productItem.ProductModel.Name);

                        if (selectedProducts.Count == 0)
                        {
                            this.selectedProductsListBox.Items.Insert(0, Resources.NoProductsYetMessage);
                        }
                    }

                    changePlan(productItem);
                };

                this.productTableView.Controls.Add(productCheckBox, 0, row);
                this.productTableView.Controls.Add(productTableRowLabels[0], 0, row);

                var deleteIconLabel = new Label();
                var editIconLabel   = new Label();

                editIconLabel.Anchor   = AnchorStyles.Left;
                deleteIconLabel.Anchor = AnchorStyles.Left;

                deleteIconLabel.Width = 25;

                deleteIconLabel.Image = Resources.DeleteIcon;
                editIconLabel.Image   = Resources.EditIcon;

                deleteIconLabel.Click += (sender, e) =>
                {
                    deleteProduct(productItem.ProductModel);
                };

                editIconLabel.Click += (sender, e) =>
                {
                    setProductToUpdate(productItem);
                };

                this.productTableView.Controls.Add(editIconLabel, 7, row);
                this.productTableView.Controls.Add(deleteIconLabel, 8, row);

                //Configure Label element, so that there could put the picture there
                productItem.PictureLabel          = new Label();
                productItem.PictureLabel.AutoSize = true;
                productItem.PictureLabel.Font     = new Font("Microsoft Sans Serif", 50F);
                productItem.PictureLabel.Text     = string.Format("{0,4}", string.Empty);
                productItem.PictureLabel.Anchor   = AnchorStyles.None;
                this.productTableView.Controls.Add(productItem.PictureLabel, 1, row);

                //Set the text values of Label content in the correct order
                this.productTableRowLabels[2].Text = product.Name;
                this.productTableRowLabels[3].Text = product.ProductTypeModel.Name;
                this.productTableRowLabels[4].Text = product.Proteins.ToString();
                this.productTableRowLabels[5].Text = product.Fats.ToString();
                this.productTableRowLabels[6].Text = product.Carbohydrates.ToString();
                row++;

                this.productTableView.Refresh();
            }
        }
コード例 #15
0
        private async void Otchot_Load(object sender, EventArgs e)
        {
            OthDiv = new MaterialDivider
            {
                Location = new Point(-1, 168),
                Size     = new Size(565, 11)
            };
            this.Controls.Add(OthDiv);

            allCheck = new MaterialCheckBox
            {
                Text     = "Выбрать все",
                Location = new Point(257, 193),
                AutoSize = true
            };
            allCheck.CheckedChanged += new EventHandler(allcheck_CheckedChanged);
            this.Controls.Add(allCheck);

            WordChek = new MaterialCheckBox
            {
                Text     = "",
                Location = new Point(185, 113),
                AutoSize = true
            };
            this.Controls.Add(WordChek);

            ExcelChek = new MaterialCheckBox
            {
                Text     = "",
                Location = new Point(311, 113),
                AutoSize = true
            };
            this.Controls.Add(ExcelChek);

            PdfChek = new MaterialCheckBox
            {
                Text     = "",
                Location = new Point(434, 113),
                AutoSize = true
            };
            this.Controls.Add(PdfChek);

            Bitmap Word = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\Word.png");

            WordImage = new PictureBox
            {
                Location              = new Point(214, 88),
                Size                  = new Size(77, 67),
                BackgroundImage       = Word,
                BackgroundImageLayout = ImageLayout.Zoom
            };
            WordImage.Click += new EventHandler(WordImage_Click);
            this.Controls.Add(WordImage);

            Bitmap Excel = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\Excel.png");

            ExcelImage = new PictureBox
            {
                Location              = new Point(340, 88),
                Size                  = new Size(77, 67),
                BackgroundImage       = Excel,
                BackgroundImageLayout = ImageLayout.Zoom
            };
            ExcelImage.Click += new EventHandler(ExcelImage_Click);
            this.Controls.Add(ExcelImage);

            Bitmap Pdf = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\pdf.png");

            PdfImage = new PictureBox
            {
                Location              = new Point(463, 88),
                Size                  = new Size(77, 67),
                BackgroundImage       = Pdf,
                BackgroundImageLayout = ImageLayout.Zoom
            };
            PdfImage.Click += new EventHandler(PdfImage_Click);
            this.Controls.Add(PdfImage);

            vibvers = new MaterialLabel
            {
                Location = new Point(23, 105),
                Text     = "Выбор формата " +
                           "документа",
                AutoSize = true
            };
            this.Controls.Add(vibvers);

            vibkrit = new MaterialLabel
            {
                Location = new Point(22, 197),
                Text     = "Выбор критерий для отчета",
                AutoSize = true
            };
            this.Controls.Add(vibkrit);

            BackBtn = new MaterialRaisedButton
            {
                Text     = "Отмена",
                Location = new Point(276, 393)
            };
            BackBtn.Click += new EventHandler(BackBtn_Click);
            this.Controls.Add(BackBtn);

            CompleteBtn = new MaterialRaisedButton
            {
                Text     = "Сформировать отчет",
                Location = new Point(359, 393)
            };
            CompleteBtn.Click += new EventHandler(CompleteBtn_Click);
            this.Controls.Add(CompleteBtn);

            string connectionString = @"Data Source = DESKTOP-EPNEITS; Initial Catalog = " + Program.server + "; Integrated Security = True";

            sqlConnection = new SqlConnection(connectionString);

            await sqlConnection.OpenAsync();

            DB.LoadDataCritery();
            SqlConnection connect = new SqlConnection(connectionString);
            string        podkl   = "SELECT * FROM critery";
            SqlCommand    com     = new SqlCommand(podkl, connect);

            connect.Open();
            SqlDataReader read = com.ExecuteReader();

            tabl.Load(read);

            int name = 26;
            int nume = 236;

            for (int i = 0; i < tabl.Rows.Count; i++)
            {
                MaterialCheckBox bt = new MaterialCheckBox();
                bt.Text     = tabl.Rows[i][1].ToString();
                bt.AutoSize = true;
                bt.Name     = tabl.Rows[i][1].ToString();
                bt.Location = new Point(name, nume);
                Controls.Add(bt);
                nume                 = nume + 30;
                this.Height          = nume + 45;
                BackBtn.Location     = new Point(276, nume + 5);
                CompleteBtn.Location = new Point(359, nume + 5);
                checkBoxes.Add(bt);
            }

            this.vibvers.MaximumSize = new Size(200, 100);
        }
コード例 #16
0
ファイル: EULADialog.cs プロジェクト: nexywexy/PlatinumClient
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(EULADialog));

            this.richTextBox1   = new RichTextBox();
            this.materialLabel1 = new MaterialLabel();
            this.pictureBox1    = new PictureBox();
            this.btnContinue    = new MaterialRaisedButton();
            this.cbxAgree       = new MaterialCheckBox();
            ((ISupportInitialize)this.pictureBox1).BeginInit();
            base.SuspendLayout();
            this.richTextBox1.Anchor                 = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.richTextBox1.BackColor              = Color.White;
            this.richTextBox1.BorderStyle            = BorderStyle.None;
            this.richTextBox1.Font                   = new Font("Microsoft Sans Serif", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.richTextBox1.Location               = new Point(12, 0x6d);
            this.richTextBox1.Name                   = "richTextBox1";
            this.richTextBox1.ReadOnly               = true;
            this.richTextBox1.Size                   = new Size(0x281, 0x145);
            this.richTextBox1.TabIndex               = 0;
            this.richTextBox1.Text                   = manager.GetString("richTextBox1.Text");
            this.materialLabel1.AutoSize             = true;
            this.materialLabel1.BackColor            = Color.Transparent;
            this.materialLabel1.Depth                = 0;
            this.materialLabel1.Font                 = new Font("Roboto", 11f);
            this.materialLabel1.ForeColor            = Color.FromArgb(0xde, 0, 0, 0);
            this.materialLabel1.Location             = new Point(12, 0x4e);
            this.materialLabel1.MouseState           = MouseState.HOVER;
            this.materialLabel1.Name                 = "materialLabel1";
            this.materialLabel1.Size                 = new Size(0x1e5, 0x13);
            this.materialLabel1.TabIndex             = 1;
            this.materialLabel1.Text                 = "You must agree to the Platinum Cheats Service Agreement to continue.";
            this.pictureBox1.Anchor                  = AnchorStyles.Right | AnchorStyles.Top;
            this.pictureBox1.BackColor               = Color.Transparent;
            this.pictureBox1.Image                   = Resources.platinumcheats_wide_compressed_white;
            this.pictureBox1.Location                = new Point(0x1e5, 0x1b);
            this.pictureBox1.Name                    = "pictureBox1";
            this.pictureBox1.Size                    = new Size(0xa8, 0x20);
            this.pictureBox1.SizeMode                = PictureBoxSizeMode.Zoom;
            this.pictureBox1.TabIndex                = 2;
            this.pictureBox1.TabStop                 = false;
            this.btnContinue.Anchor                  = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btnContinue.Depth                   = 0;
            this.btnContinue.Enabled                 = false;
            this.btnContinue.Location                = new Point(0x1d7, 440);
            this.btnContinue.MouseState              = MouseState.HOVER;
            this.btnContinue.Name                    = "btnContinue";
            this.btnContinue.Primary                 = true;
            this.btnContinue.Size                    = new Size(0xb6, 0x27);
            this.btnContinue.TabIndex                = 4;
            this.btnContinue.Text                    = "Continue";
            this.btnContinue.UseVisualStyleBackColor = true;
            this.btnContinue.Click                  += new EventHandler(this.btnContinue_Click);
            this.cbxAgree.Anchor                  = AnchorStyles.Left | AnchorStyles.Bottom;
            this.cbxAgree.AutoSize                = true;
            this.cbxAgree.Depth                   = 0;
            this.cbxAgree.Font                    = new Font("Roboto", 10f);
            this.cbxAgree.Location                = new Point(9, 0x1bd);
            this.cbxAgree.Margin                  = new Padding(0);
            this.cbxAgree.MouseLocation           = new Point(-1, -1);
            this.cbxAgree.MouseState              = MouseState.HOVER;
            this.cbxAgree.Name                    = "cbxAgree";
            this.cbxAgree.Ripple                  = true;
            this.cbxAgree.Size                    = new Size(0x1ad, 30);
            this.cbxAgree.TabIndex                = 5;
            this.cbxAgree.Text                    = "I have read and agree to the Platinum Cheats Service Agreement.";
            this.cbxAgree.UseVisualStyleBackColor = true;
            this.cbxAgree.CheckedChanged         += new EventHandler(this.cbxAgree_CheckedChanged);
            base.AutoScaleDimensions              = new SizeF(6f, 13f);
            base.AutoScaleMode                    = AutoScaleMode.Font;
            base.ClientSize = new Size(0x299, 0x1eb);
            base.Controls.Add(this.cbxAgree);
            base.Controls.Add(this.btnContinue);
            base.Controls.Add(this.pictureBox1);
            base.Controls.Add(this.materialLabel1);
            base.Controls.Add(this.richTextBox1);
            base.MaximizeBox   = false;
            base.MinimizeBox   = false;
            base.Name          = "EULADialog";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text          = "Service Agreement";
            base.TopMost       = true;
            base.Load         += new EventHandler(this.EULADialog_Load);
            ((ISupportInitialize)this.pictureBox1).EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
コード例 #17
0
ファイル: FrmMain.cs プロジェクト: Gustavo-Kuze/Chocolatra
 /// <summary>
 /// Sets the size of the passed checkbox to fill the parent control horizontally and changes Its anchor to left + top + right.
 /// </summary>
 /// <param name="chk"></param>
 private void FixChkSize(MaterialCheckBox chk)
 {
     chk.AutoSize = false;
     chk.Anchor   = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
     chk.Size     = new Size(panelListBoxContainer.Size.Width - 50, chk.Size.Height);
 }
コード例 #18
0
        public static void AgreeCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            MaterialCheckBox checkBox = (MaterialCheckBox)sender;

            Main.NextButton.Enabled = checkBox.Checked;
        }
コード例 #19
0
        private void GenerateLivelyWidgetUIElements()
        {
            if (WidgetData.liveyPropertiesData.Count == 0)
            {
                //nothing here
                AddUIElement(new MaterialLabel()
                {
                    Text      = "1+1=1",
                    TextAlign = ContentAlignment.BottomLeft,
                    AutoSize  = true,
                    ForeColor = Color.FromArgb(200, 200, 200),
                    Font      = new Font("Segoe UI", 10, FontStyle.Regular)
                });
                return;
            }

            dynamic obj = null;

            foreach (var item in WidgetData.liveyPropertiesData)
            {
                string uiElementType = item.Value["type"].ToString();
                if (uiElementType.Equals("slider", StringComparison.OrdinalIgnoreCase))
                {
                    var tb = new TrackBar
                    {
                        Name          = item.Key,
                        Minimum       = (int)item.Value["min"],
                        Maximum       = (int)item.Value["max"],
                        TickFrequency = (int)item.Value["tick"],
                        Value         = (int)item.Value["value"]
                    };
                    tb.Scroll += Trackbar_Scroll;
                    obj        = tb;
                }
                else if (uiElementType.Equals("textbox", StringComparison.OrdinalIgnoreCase))
                {
                    var tb = new TextBox
                    {
                        Name     = item.Key,
                        Text     = item.Value["value"].ToString(),
                        AutoSize = true
                    };
                    tb.TextChanged += Textbox_TextChanged;
                    obj             = tb;
                }
                else if (uiElementType.Equals("button", StringComparison.OrdinalIgnoreCase))
                {
                    var btn = new Button
                    {
                        BackColor = Color.FromArgb(65, 65, 65),
                        ForeColor = Color.FromArgb(200, 200, 200),
                        Name      = item.Key,
                        Text      = item.Value["value"].ToString()
                    };
                    btn.Click += Button_Click;
                    obj        = btn;
                }
                else if (uiElementType.Equals("color", StringComparison.OrdinalIgnoreCase))
                {
                    var pb = new PictureBox
                    {
                        Name      = item.Key,
                        BackColor = ColorTranslator.FromHtml(item.Value["value"].ToString())
                    };
                    pb.Click += PictureBox_Clicked;
                    obj       = pb;
                }
                else if (uiElementType.Equals("checkbox", StringComparison.OrdinalIgnoreCase))
                {
                    var chk = new MaterialCheckBox
                    {
                        Name      = item.Key,
                        Text      = item.Value["text"].ToString(),
                        Checked   = (bool)item.Value["value"],
                        BackColor = Color.FromArgb(37, 37, 37),
                        ForeColor = Color.FromArgb(200, 200, 200),
                        Font      = new Font("Segoe UI", 10, FontStyle.Regular)
                    };
                    //chk.Text.
                    chk.CheckedChanged += Checkbox_CheckedChanged;
                    obj = chk;
                }
                else if (uiElementType.Equals("dropdown", StringComparison.OrdinalIgnoreCase))
                {
                    var cmbBox = new ComboBox
                    {
                        Name          = item.Key,
                        DropDownStyle = ComboBoxStyle.DropDownList,
                        Font          = new Font("Segoe UI", 10, FontStyle.Regular),
                    };
                    //JSON Array
                    foreach (var dropItem in item.Value["items"])
                    {
                        cmbBox.Items.Add(dropItem);
                    }
                    cmbBox.SelectedIndex = (int)item.Value["value"];
                    //cmbBox.Font = new Font("Segoe UI", 10, FontStyle.Regular);
                    cmbBox.SelectedValueChanged += CmbBox_SelectedValueChanged;
                    obj = cmbBox;
                }
                else if (uiElementType.Equals("folderDropdown", StringComparison.OrdinalIgnoreCase))
                {
                    var cmbBox = new ComboBox
                    {
                        Name          = item.Key,
                        DropDownStyle = ComboBoxStyle.DropDownList,
                        Font          = new Font("Segoe UI", 10, FontStyle.Regular),
                    };

                    //todo: rewrite, use folderdropdownclass objects instead.
                    //filter syntax: "*.jpg|*.png"
                    var files = GetFileNames(Path.Combine(Path.GetDirectoryName(Form1.htmlPath), item.Value["folder"].ToString()),
                                             item.Value["filter"].ToString(),
                                             SearchOption.TopDirectoryOnly);
                    cmbBox.Items.AddRange(files);
                    cmbBox.SelectedIndex         = Array.FindIndex(files, x => x.Contains(item.Value["value"].ToString())); //returns -1 if not found, none selected.
                    cmbBox.SelectedValueChanged += FolderCmbBox_SelectedValueChanged;
                    obj = cmbBox;
                }
                else if (uiElementType.Equals("label", StringComparison.OrdinalIgnoreCase))
                {
                    var label = new MaterialLabel
                    {
                        Name      = item.Key,
                        Text      = item.Value["value"].ToString(),
                        TextAlign = ContentAlignment.MiddleLeft,
                        //AutoSize = true,
                        ForeColor = Color.FromArgb(200, 200, 200),
                        Font      = new Font("Segoe UI", 10, FontStyle.Regular)
                    };
                    obj = label;
                }
                else
                {
                    continue;
                }

                //Title
                if (item.Value["text"] != null &&
                    !uiElementType.Equals("checkbox", StringComparison.OrdinalIgnoreCase) &&
                    !uiElementType.Equals("label", StringComparison.OrdinalIgnoreCase))
                {
                    AddUIElement(new MaterialLabel()
                    {
                        Text      = item.Value["text"].ToString(),
                        TextAlign = ContentAlignment.BottomLeft,
                        //AutoSize = true,
                        ForeColor = Color.FromArgb(200, 200, 200),
                        Font      = new Font("Segoe UI", 10, FontStyle.Regular)
                    });
                }
                AddUIElement(obj);
                //label with trackbar value
                if (uiElementType.Equals("slider", StringComparison.OrdinalIgnoreCase))
                {
                    AddUIElement(new MaterialLabel
                    {
                        Text      = item.Value["value"].ToString(),
                        TextAlign = ContentAlignment.MiddleRight,
                        //AutoSize = true,
                        ForeColor = Color.FromArgb(200, 200, 200),
                        Font      = new Font("Segoe UI", 10, FontStyle.Regular)
                    });
                }
            }

            if (!Form1.livelyPropertyRestoreDisabled)
            {
                //restore-default btn.
                var defaultBtn = new Button
                {
                    BackColor = Color.FromArgb(65, 65, 65),
                    ForeColor = Color.FromArgb(200, 200, 200),
                    Name      = "defaultBtn",
                    Text      = "Restore Default"
                };
                defaultBtn.Click += DefaultBtn_Click;
                AddUIElement(defaultBtn);
            }
        }
コード例 #20
0
        private void Log_Form_Load(object sender, EventArgs e)
        {
            Bitmap Logo = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\logo_log.png");

            LogoImg = new PictureBox
            {
                Location              = new Point(9, 72),
                Size                  = new Size(43, 40),
                BackgroundImage       = Logo,
                BackgroundImageLayout = ImageLayout.Zoom
            };
            this.Controls.Add(LogoImg);

            Bitmap Pass = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\pass_logo.png");

            PassImg = new PictureBox
            {
                Location              = new Point(9, 124),
                Size                  = new Size(43, 38),
                BackgroundImage       = Pass,
                BackgroundImageLayout = ImageLayout.Zoom
            };
            this.Controls.Add(PassImg);

            Bitmap Down = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\down.png");

            DownImg = new PictureBox
            {
                Location              = new Point(82, 227),
                Size                  = new Size(78, 25),
                BackgroundImage       = Down,
                BackgroundImageLayout = ImageLayout.Zoom
            };
            DownImg.Click += new EventHandler(DownImg_Click);
            this.Controls.Add(DownImg);

            Bitmap Up = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\up.png");

            UpImg = new PictureBox
            {
                Location              = new Point(82, 227),
                Size                  = new Size(78, 25),
                BackgroundImage       = Up,
                BackgroundImageLayout = ImageLayout.Zoom
            };
            UpImg.Click += new EventHandler(UpImg_Click);

            Bitmap Server = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\server.png");

            ServerImg = new PictureBox
            {
                Location              = new Point(9, 299),
                Size                  = new Size(43, 38),
                BackgroundImage       = Server,
                BackgroundImageLayout = ImageLayout.Zoom
            };

            Bitmap Char = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\eyes.png");

            CharImg = new PictureBox
            {
                Location              = new Point(196, 132),
                Size                  = new Size(43, 38),
                BackgroundImage       = Char,
                BackgroundImageLayout = ImageLayout.Zoom
            };
            this.Controls.Add(CharImg);
            CharImg.Click += new EventHandler(CharImg_Click);

            Bitmap CharHide = new Bitmap(@"D:\Флешка\4 курс\Программа работа\Rating_sotr\hide.png");

            CharHideImg = new PictureBox
            {
                Location              = new Point(196, 132),
                Size                  = new Size(43, 38),
                BackgroundImage       = CharHide,
                BackgroundImageLayout = ImageLayout.Zoom
            };
            CharHideImg.Click += new EventHandler(CharHideImg_Click);

            AuthBtn = new MaterialRaisedButton
            {
                Text     = "ВХОД",
                Location = new Point(150, 186)
            };
            AuthBtn.Click += new EventHandler(AuthBtn_Click);
            this.Controls.Add(AuthBtn);

            SelectServerLbl = new MaterialLabel
            {
                Location = new Point(56, 274),
                Text     = "Выбор базы данных",
                AutoSize = true
            };

            ServerComBox = new ComboBox()
            {
                Location = new Point(56, 316),
                Size     = new Size(182, 21),
            };

            RememberChBox = new MaterialCheckBox
            {
                Text     = "Запомнить",
                Location = new Point(9, 190),
                Checked  = true
            };
            this.Controls.Add(RememberChBox);

            LogoTextBox = new MaterialSingleLineTextField
            {
                Hint     = "Логин",
                Location = new Point(56, 81),
                Size     = new Size(140, 23)
            };
            this.Controls.Add(LogoTextBox);

            PassTextBox = new MaterialSingleLineTextField
            {
                Hint         = "Пароль",
                Location     = new Point(56, 132),
                Size         = new Size(140, 23),
                PasswordChar = '*'
            };
            this.Controls.Add(PassTextBox);

            try
            {
                RegistryKey currentUserKey = Registry.CurrentUser;
                RegistryKey helloKey       = currentUserKey.OpenSubKey("HelloKey", true);
                string      login          = helloKey.GetValue("login").ToString();
                string      password       = helloKey.GetValue("password").ToString();
                LogoTextBox.Text = login;
                PassTextBox.Text = password;
                helloKey.Close();
            }
            catch
            {
            }

            using (SqlConnection sqlConn = new SqlConnection(@"Server=DESKTOP-EPNEITS;Integrated Security=SSPI"))
            {
                sqlConn.Open();

                SqlCommand sqlCmd = new SqlCommand();
                sqlCmd.Connection  = sqlConn;
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.CommandText = "sp_helpdb";

                SqlDataAdapter da = new SqlDataAdapter(sqlCmd);
                DataSet        ds = new DataSet();
                da.Fill(ds);

                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    ServerComBox.Items.Add(row["name"].ToString());
                }

                ServerComBox.Text = ServerComBox.Items[3].ToString();
            }
            Height = 260;
        }
コード例 #21
0
 private void InitializeComponent()
 {
     this.pictureBox2  = new PictureBox();
     this.panel2       = new Panel();
     this.lblTelemetry = new Label();
     this.cbxTelemetry = new MaterialCheckBox();
     this.btnApply     = new MaterialRaisedButton();
     ((ISupportInitialize)this.pictureBox2).BeginInit();
     this.panel2.SuspendLayout();
     base.SuspendLayout();
     this.pictureBox2.Anchor    = AnchorStyles.Right | AnchorStyles.Top;
     this.pictureBox2.BackColor = Color.Transparent;
     this.pictureBox2.Image     = Resources.platinumcheats_wide_compressed_white;
     this.pictureBox2.Location  = new Point(0x15a, 0x1c);
     this.pictureBox2.Name      = "pictureBox2";
     this.pictureBox2.Size      = new Size(0xa8, 0x20);
     this.pictureBox2.SizeMode  = PictureBoxSizeMode.Zoom;
     this.pictureBox2.TabIndex  = 6;
     this.pictureBox2.TabStop   = false;
     this.panel2.Anchor         = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
     this.panel2.Controls.Add(this.lblTelemetry);
     this.panel2.Controls.Add(this.cbxTelemetry);
     this.panel2.Controls.Add(this.btnApply);
     this.panel2.Location                      = new Point(-1, 0x40);
     this.panel2.Name                          = "panel2";
     this.panel2.Size                          = new Size(0x20f, 0x85);
     this.panel2.TabIndex                      = 0x11;
     this.lblTelemetry.BackColor               = SystemColors.Control;
     this.lblTelemetry.Font                    = new Font("Roboto Lt", 9.75f);
     this.lblTelemetry.Location                = new Point(0x21, 0x26);
     this.lblTelemetry.Name                    = "lblTelemetry";
     this.lblTelemetry.Size                    = new Size(0x1dc, 30);
     this.lblTelemetry.TabIndex                = 0x13;
     this.lblTelemetry.Text                    = "Crash and error reports will be automatically uploaded to Platinum Cheats. Use only if instructed to by Customer Service.";
     this.cbxTelemetry.AutoSize                = true;
     this.cbxTelemetry.BackColor               = Color.White;
     this.cbxTelemetry.Depth                   = 0;
     this.cbxTelemetry.Font                    = new Font("Roboto", 10f);
     this.cbxTelemetry.Location                = new Point(6, 10);
     this.cbxTelemetry.Margin                  = new Padding(0);
     this.cbxTelemetry.MouseLocation           = new Point(-1, -1);
     this.cbxTelemetry.MouseState              = MouseState.HOVER;
     this.cbxTelemetry.Name                    = "cbxTelemetry";
     this.cbxTelemetry.Ripple                  = true;
     this.cbxTelemetry.Size                    = new Size(0xc9, 30);
     this.cbxTelemetry.TabIndex                = 0x12;
     this.cbxTelemetry.Text                    = "Enable debugging telemetry";
     this.cbxTelemetry.UseVisualStyleBackColor = false;
     this.cbxTelemetry.CheckedChanged         += new EventHandler(this.cbxTelemetry_CheckedChanged);
     this.btnApply.Anchor                      = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
     this.btnApply.Depth                       = 0;
     this.btnApply.Location                    = new Point(13, 0x57);
     this.btnApply.MouseState                  = MouseState.HOVER;
     this.btnApply.Name                        = "btnApply";
     this.btnApply.Primary                     = true;
     this.btnApply.Size                        = new Size(0x1f6, 0x20);
     this.btnApply.TabIndex                    = 0x11;
     this.btnApply.Text                        = "Apply";
     this.btnApply.UseVisualStyleBackColor     = true;
     this.btnApply.Click                      += new EventHandler(this.btnApply_Click);
     base.AutoScaleDimensions                  = new SizeF(6f, 13f);
     base.AutoScaleMode                        = AutoScaleMode.Font;
     base.ClientSize = new Size(0x20e, 0xc3);
     base.Controls.Add(this.panel2);
     base.Controls.Add(this.pictureBox2);
     base.MaximizeBox   = false;
     base.MinimizeBox   = false;
     base.Name          = "SettingsDialog";
     base.StartPosition = FormStartPosition.CenterScreen;
     this.Text          = "Settings";
     base.Load         += new EventHandler(this.SettingsDialog_Load);
     base.Controls.SetChildIndex(this.pictureBox2, 0);
     base.Controls.SetChildIndex(this.panel2, 0);
     ((ISupportInitialize)this.pictureBox2).EndInit();
     this.panel2.ResumeLayout(false);
     this.panel2.PerformLayout();
     base.ResumeLayout(false);
 }
コード例 #22
0
ファイル: Form1.cs プロジェクト: pierdziadek/OptifineProxy
        public Form1()
        {
            InitializeComponent();

            MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;

            materialSkinManager.ColorScheme = new ColorScheme(
                Primary.Blue600, Primary.Blue700,
                Primary.Blue700, Accent.LightBlue400,
                TextShade.WHITE
                );

            tbResourcesDirectory.Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\Capes Resources";

            for (int i = 0; i < tbNicknameColumn.Length; i++)
            {
                tbNicknameColumn[i]                       = new MaterialSingleLineTextField();
                tbNicknameColumn[i].BackColor             = SystemColors.Control;
                tbNicknameColumn[i].Depth                 = 0;
                tbNicknameColumn[i].Dock                  = DockStyle.Fill;
                tbNicknameColumn[i].Hint                  = "";
                tbNicknameColumn[i].Location              = new Point(276, 50);
                tbNicknameColumn[i].MouseState            = MouseState.HOVER;
                tbNicknameColumn[i].Name                  = "tbNicknameColumn" + i;
                tbNicknameColumn[i].PasswordChar          = '\0';
                tbNicknameColumn[i].SelectedText          = "";
                tbNicknameColumn[i].SelectionLength       = 0;
                tbNicknameColumn[i].SelectionStart        = 0;
                tbNicknameColumn[i].Size                  = new Size(50, 23);
                tbNicknameColumn[i].TabIndex              = 6;
                tbNicknameColumn[i].Text                  = "";
                tbNicknameColumn[i].UseSystemPasswordChar = false;

                tbCapeColumn[i]                       = new MaterialSingleLineTextField();
                tbCapeColumn[i].BackColor             = SystemColors.Control;
                tbCapeColumn[i].Depth                 = 0;
                tbCapeColumn[i].Dock                  = DockStyle.Fill;
                tbCapeColumn[i].Hint                  = "";
                tbCapeColumn[i].Location              = new Point(276, 50);
                tbCapeColumn[i].MouseState            = MouseState.HOVER;
                tbCapeColumn[i].Name                  = "tbCapeColumn" + i;
                tbCapeColumn[i].PasswordChar          = '\0';
                tbCapeColumn[i].SelectedText          = "";
                tbCapeColumn[i].SelectionLength       = 0;
                tbCapeColumn[i].SelectionStart        = 0;
                tbCapeColumn[i].Size                  = new Size(50, 23);
                tbCapeColumn[i].TabIndex              = 6;
                tbCapeColumn[i].Text                  = "";
                tbCapeColumn[i].UseSystemPasswordChar = false;

                cbEnabledColumn[i]                         = new MaterialCheckBox();
                cbEnabledColumn[i].AutoSize                = true;
                cbEnabledColumn[i].Depth                   = 0;
                cbEnabledColumn[i].Font                    = new Font("Roboto", 10F);
                cbEnabledColumn[i].Location                = new Point(113, 130);
                cbEnabledColumn[i].Margin                  = new Padding(0);
                cbEnabledColumn[i].MouseLocation           = new Point(-1, -1);
                cbEnabledColumn[i].MouseState              = MouseState.HOVER;
                cbEnabledColumn[i].Name                    = "cbEnabledColumn" + i;
                cbEnabledColumn[i].Ripple                  = true;
                cbEnabledColumn[i].Size                    = new Size(150, 30);
                cbEnabledColumn[i].TabIndex                = 6;
                cbEnabledColumn[i].Text                    = "";
                cbEnabledColumn[i].UseVisualStyleBackColor = true;

                tableCapes.Controls.Add(cbEnabledColumn[i], 0, i + 1);
                tableCapes.Controls.Add(tbNicknameColumn[i], 1, i + 1);
                tableCapes.Controls.Add(tbCapeColumn[i], 2, i + 1);
            }

            cbEnabledColumn[0].Checked = true;
            tbNicknameColumn[0].Text   = "pierdziadek";
            tbCapeColumn[0].Text       = "2016";
            cbStartup.Checked          = Startup.isStartupItem();
            if (Program.args.Length > 0 && Program.args[0] == "-minimized")
            {
                Hide();
                WindowState   = FormWindowState.Minimized;
                ShowInTaskbar = false;
            }
        }
コード例 #23
0
        public static async Task DownloadItem(string fileTitle, string format, string quality, long bitrate, string savePath, MaterialListView downloadQueueMaterialListView, bool isAudio, MaterialCheckBox deleteDoneCheckBox)
        {
            ListViewItem _file = new DownloadItem(fileTitle, format, savePath, isAudio).NewItem();

            ExtensionMethods.SynchronizedInvoke(downloadQueueMaterialListView, () => downloadQueueMaterialListView.Items.Add(_file));

            int _listViewItems = downloadQueueMaterialListView.Items.Count - 1;

            var _mediaStreamInfoSet = await _client.GetVideoMediaStreamInfosAsync(_id);

            if (isAudio == false)
            {
                DownloadVideo(_mediaStreamInfoSet, fileTitle, downloadQueueMaterialListView, format, quality, _listViewItems, savePath, deleteDoneCheckBox);
            }
            else
            {
                DownloadAudio(_mediaStreamInfoSet, fileTitle, downloadQueueMaterialListView, format, bitrate, _listViewItems, savePath, deleteDoneCheckBox);
            }
        }
コード例 #24
0
        static async void DownloadVideo(MediaStreamInfoSet mediaStreamInfoSet, string title, MaterialListView downloadQueueMaterialListView, string format, string quality, int _listViewItems, string savePath, MaterialCheckBox deleteDoneCheckBox)
        {
            var _audioStreamInfo  = mediaStreamInfoSet.Audio.OrderByDescending(a => a.Bitrate).First();
            var _videoStreamInfo  = mediaStreamInfoSet.Video.Where(v => v.Container.ToString() == format && v.VideoQualityLabel == quality).First();
            var _mediaStreamInfos = new MediaStreamInfo[] { _audioStreamInfo, _videoStreamInfo };

            IProgress <double> progress = new Progress <double>(p =>
            {
                ExtensionMethods.SynchronizedInvoke(downloadQueueMaterialListView, () => downloadQueueMaterialListView.Items[_listViewItems].SubItems[4].Text = (p * 100).ToString("0.00") + "%");
                if (p * 100 == 100)
                {
                    ExtensionMethods.SynchronizedInvoke(downloadQueueMaterialListView, () => downloadQueueMaterialListView.Items[_listViewItems].SubItems[4].Text = "Done!");
                    DatabaseOperations.AddNewRecord(Settings.Default.Guid, title, format, savePath);

                    if (deleteDoneCheckBox.Checked == true)
                    {
                        Thread.Sleep(2000);
                        ExtensionMethods.SynchronizedInvoke(downloadQueueMaterialListView, () => downloadQueueMaterialListView.Items[_listViewItems].Remove());
                    }
                }
            });

            await Task.Run(() => _converter.DownloadAndProcessMediaStreamsAsync(_mediaStreamInfos, savePath + "." + format, format, progress));
        }
コード例 #25
0
        public void getAddonsFlowPanel(DoubleBufferFlowPanel flowpanel_detectedAddons, string folderToLook, ContextMenuStrip contextMenu)
        {
            try
            {
                flowpanel_detectedAddons.Controls.Clear();
                int count = 0;

                DirectoryInfo   addonDir = new DirectoryInfo(folderToLook);
                DirectoryInfo[] subDirs  = addonDir.GetDirectories();

                foreach (DirectoryInfo dir in addonDir.GetDirectories())
                {
                    if (dir.Name.StartsWith("@"))
                    {
                        MaterialCheckBox addonItem = new MaterialCheckBox
                        {
                            Text             = dir.Name,
                            AutoSize         = true,
                            ContextMenuStrip = contextMenu
                        };
                        flowpanel_detectedAddons.Controls.Add(addonItem);
                        count++;
                    }
                    else
                    {
                        continue;
                    }
                }

                if (count == 0)
                {
                    Label error = new Label()
                    {
                        AutoSize  = true,
                        ForeColor = Color.DimGray,
                        Font      = customFonts.getFont(Properties.Fonts.Lato_Regular, 11F, FontStyle.Regular),
                        Text      = "No addons found at:"
                    };

                    Label dir = new Label()
                    {
                        AutoSize  = true,
                        ForeColor = Color.DimGray,
                        Font      = customFonts.getFont(Properties.Fonts.ClearSans_Thin, 9.25F, FontStyle.Regular),
                        Margin    = new Padding(10, 0, 0, 0),
                        Text      = "⮡  " + folderToLook
                    };

                    flowpanel_detectedAddons.Controls.Add(error);
                    flowpanel_detectedAddons.Controls.Add(dir);
                }
            }
            catch
            {
                Label error = new Label()
                {
                    AutoSize  = true,
                    ForeColor = Color.DimGray,
                    Font      = customFonts.getFont(Properties.Fonts.Lato_Regular, 11F, FontStyle.Regular),
                    Text      = "Optional Addons folder not defined!"
                };

                flowpanel_detectedAddons.Controls.Add(error);
            }
        }
コード例 #26
0
        static async void DownloadAudio(MediaStreamInfoSet mediaStreamInfoSet, string title, MaterialListView downloadQueueMaterialListView, string format, long bitrate, int _listViewItems, string savePath, MaterialCheckBox deleteDoneCheckBox)
        {
            var _audioStreamInfo = mediaStreamInfoSet.Audio.OrderByDescending(a => a.Bitrate / 1024 == bitrate).First();

            IProgress <double> progress = new Progress <double>(p =>
            {
                ExtensionMethods.SynchronizedInvoke(downloadQueueMaterialListView, () => downloadQueueMaterialListView.Items[_listViewItems].SubItems[4].Text = (p * 100).ToString("0.00") + "%");

                if (p * 100 == 100)
                {
                    ExtensionMethods.SynchronizedInvoke(downloadQueueMaterialListView, () => downloadQueueMaterialListView.Items[_listViewItems].SubItems[4].Text = "Done!");
                    DatabaseOperations.AddNewRecord(Settings.Default.Guid, title, format, savePath);

                    if (deleteDoneCheckBox.Checked == true)
                    {
                        Thread.Sleep(2000);
                        ExtensionMethods.SynchronizedInvoke(downloadQueueMaterialListView, () => downloadQueueMaterialListView.Items[_listViewItems].Remove());
                    }
                }
            });

            await Task.Run(() => _client.DownloadMediaStreamAsync(_audioStreamInfo, savePath + ".mp3", progress));
        }