/// <summary>
 /// Adds the control item.
 /// </summary>
 /// <param name="item">The item.</param>
 public void AddControl(Control item)
 {
     if (item != null)
     {
         try
         {
             Controls?.Add(item);
         }
         catch (Exception ex)
         {
             Fail(ex);
         }
     }
 }
Exemplo n.º 2
0
        void VezerlokLetrehozasa()
        {
            try
            {
                Width = 800;
                CenterToScreen();
                Text = "New food form";

                label1 = new Label()
                {
                    Left      = 20,
                    Top       = 20,
                    Text      = "Type of food:",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Parent    = this
                };

                comboBox1 = new ComboBox()
                {
                    DataSource    = null,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                    Left          = label1.Right + 20,
                    Top           = label1.Top,
                    AutoSize      = true,
                    Parent        = this
                };

                label2 = new Label()
                {
                    Left      = label1.Left,
                    Top       = label1.Bottom + 15,
                    Text      = "Name:",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Parent    = this
                };

                textBox1 = new TextBox()
                {
                    Top       = label2.Top,
                    Left      = comboBox1.Left,
                    Height    = 20,
                    Width     = 200,
                    AutoSize  = true,
                    Font      = new Font(FontFamily.GenericSansSerif, 12),
                    ForeColor = Color.Indigo,
                    Parent    = this
                };

                label3 = new Label()
                {
                    Left      = label1.Left,
                    Top       = label2.Bottom + 15,
                    Text      = "Joy:",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Parent    = this
                };

                numericUpDown1 = new NumericUpDown()
                {
                    Left     = label3.Right + 15,
                    Top      = label3.Top,
                    Maximum  = Konstans.maxOrom,
                    Minimum  = 0,
                    AutoSize = true,
                    Parent   = this
                };

                label4 = new Label()
                {
                    Left      = label1.Left,
                    Top       = label3.Bottom + 15,
                    Text      = "Unit price:",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Parent    = this
                };

                numericUpDown2 = new NumericUpDown()
                {
                    Left     = label4.Right + 15,
                    Top      = label4.Top,
                    Maximum  = Konstans.maxElkolthetoPenz,
                    Minimum  = 0,
                    AutoSize = true,
                    Parent   = this
                };

                comboBox2 = new ComboBox()
                {
                    DataSource    = null,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                    Left          = numericUpDown2.Right + 15,
                    Top           = label4.Top,
                    AutoSize      = true,
                    Parent        = this
                };

                label5 = new Label()
                {
                    Left      = label1.Left,
                    Top       = label4.Bottom + 15,
                    Text      = "Unit mass:",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Parent    = this
                };

                numericUpDown3 = new NumericUpDown()
                {
                    Left          = label5.Right + 15,
                    Top           = label5.Top,
                    Maximum       = (decimal)Konstans.maxMennyiseg,
                    Minimum       = 0,
                    DecimalPlaces = 2,
                    AutoSize      = true,
                    Parent        = this
                };

                comboBox3 = new ComboBox()
                {
                    DataSource    = null,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                    Left          = numericUpDown3.Right + 15,
                    Top           = label5.Top,
                    AutoSize      = true,
                    Parent        = this
                };

                label6 = new Label()
                {
                    Left      = label1.Left,
                    Top       = label5.Bottom + 15,
                    Text      = "Unit liquid measure:",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Visible   = false,
                    Parent    = this
                };

                numericUpDown4 = new NumericUpDown()
                {
                    Left          = label6.Right + 15,
                    Top           = label6.Top,
                    Maximum       = (decimal)Konstans.maxMennyiseg,
                    Minimum       = 0,
                    DecimalPlaces = 1,
                    AutoSize      = true,
                    Visible       = false,
                    Parent        = this
                };

                comboBox4 = new ComboBox()
                {
                    DataSource    = null,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                    Left          = numericUpDown4.Right + 15,
                    Top           = label6.Top,
                    AutoSize      = true,
                    Visible       = false,
                    Parent        = this
                };

                checkBox1 = new CheckBox()
                {
                    Left      = label1.Left,
                    Top       = label6.Bottom + 15,
                    Checked   = false,
                    Text      = "Consumption of only unit multiple?",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.DarkMagenta,
                    AutoSize  = true,
                    Parent    = this
                };

                label7 = new Label()
                {
                    Left = label1.Left,
                    Top  = checkBox1.Bottom + 15,
                    Text =
                        "Minimum consumption:",                         // vagy nem eszünk az élelmiszerből, vagy legalább ennyit fogyasztunk belőle
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Parent    = this
                };

                numericUpDown5 = new NumericUpDown()
                {
                    Left          = label7.Right + 15,
                    Top           = label7.Top,
                    Maximum       = (decimal)Konstans.maxMennyiseg,
                    Minimum       = 0,
                    DecimalPlaces = 1,
                    AutoSize      = true,
                    Parent        = this
                };

                label8 = new Label()
                {
                    Left      = numericUpDown5.Right + 15,
                    Top       = label7.Top,
                    Text      = "",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Parent    = this
                };

                checkBox2 = new CheckBox()
                {
                    Left      = label1.Left,
                    Top       = label7.Bottom + 15,
                    Checked   = false,
                    Text      = "See maximum consumption? This:",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.DarkMagenta,
                    AutoSize  = true,
                    Parent    = this
                };

                numericUpDown6 = new NumericUpDown()
                {
                    Left          = checkBox2.Right + 15,
                    Top           = checkBox2.Top,
                    Maximum       = (decimal)Konstans.maxMennyiseg,
                    Minimum       = 0,
                    DecimalPlaces = 1,
                    AutoSize      = true,
                    Parent        = this
                };

                label9 = new Label()
                {
                    Left      = numericUpDown6.Right + 15,
                    Top       = checkBox2.Top,
                    Text      = "",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Parent    = this
                };


                label10 = new Label()
                {
                    Left      = label1.Left,
                    Top       = checkBox2.Bottom + 15,
                    Text      = "Orders (menus) max. number",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Visible   = false,
                    Parent    = this
                };

                numericUpDown7 = new NumericUpDown()
                {
                    Left     = label10.Right + 15,
                    Top      = label10.Top,
                    Maximum  = (decimal)Konstans.maxMenu,
                    Minimum  = 0,
                    Value    = 1,
                    AutoSize = true,
                    Visible  = false,
                    Parent   = this
                };

                checkBox3 = new CheckBox()
                {
                    Left      = label1.Left,
                    Top       = label10.Bottom + 15,
                    Checked   = false,
                    Text      = "Consumption at breakfast?",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.DarkMagenta,
                    AutoSize  = true,
                    Parent    = this
                };

                checkBox4 = new CheckBox()
                {
                    Left      = label1.Left,
                    Top       = checkBox3.Bottom + 15,
                    Checked   = false,
                    Text      = "Consumption at lunch?",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.DarkMagenta,
                    AutoSize  = true,
                    Parent    = this
                };

                checkBox5 = new CheckBox()
                {
                    Left      = label1.Left,
                    Top       = checkBox4.Bottom + 15,
                    Checked   = false,
                    Text      = "Consumption at dinner?",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.DarkMagenta,
                    AutoSize  = true,
                    Parent    = this
                };

                checkBox6 = new CheckBox()
                {
                    Left      = label1.Left,
                    Top       = checkBox5.Bottom + 15,
                    Checked   = false,
                    Text      = "See variety?",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.DarkMagenta,
                    AutoSize  = true,
                    Parent    = this
                };

                checkBox7 = new CheckBox()
                {
                    Left      = label1.Left,
                    Top       = checkBox6.Bottom + 15,
                    Checked   = true,
                    Text      = "Usable?",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.DarkMagenta,
                    AutoSize  = true,
                    Parent    = this
                };

                label11 = new Label()
                {
                    Left      = label1.Left,
                    Top       = checkBox7.Bottom + 15,
                    Text      = "Nutrients (for one unit of food):",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Parent    = this
                };

                int i;
                int bal = label11.Left;
                int fel = label11.Bottom + 15;

                labelek   = new List <Label>();
                labelek2  = new List <Label>();
                szamlalok = new List <NumericUpDown>();

                foreach (Tapanyag item in tapanyagok)
                {
                    Label label = new Label()
                    {
                        Left      = bal,
                        Top       = fel,
                        Text      = item.Megnevezes + ":",
                        Font      = new Font(FontFamily.GenericSansSerif, 10),
                        ForeColor = Color.Brown,
                        AutoSize  = true,
                        Parent    = this
                    };
                    labelek.Add(label);

                    NumericUpDown num = new NumericUpDown()
                    {
                        Left          = label.Right + 5,
                        Top           = fel,
                        Maximum       = (decimal)Konstans.maxMennyiseg,
                        Minimum       = 0,
                        DecimalPlaces = 2,
                        AutoSize      = true,
                        Parent        = this
                    };
                    szamlalok.Add(num);

                    label = new Label()
                    {
                        Left      = num.Right + 15,
                        Top       = fel,
                        Text      = item.Mertek.Megnevezes,
                        Font      = new Font(FontFamily.GenericSansSerif, 10),
                        ForeColor = Color.Brown,
                        AutoSize  = true,
                        Parent    = this
                    };
                    labelek2.Add(label);
                    fel = label.Bottom + 15;
                }

                checkBox8 = new CheckBox()
                {
                    Left      = comboBox4.Right + 60,
                    Top       = label1.Top,
                    Checked   = false,
                    Text      = "Request price calculation",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.DarkMagenta,
                    AutoSize  = true,
                    Visible   = false,
                    Parent    = this
                };

                bal = checkBox8.Left;
                int fel2 = checkBox8.Bottom + 15;

                label12 = new Label()
                {
                    Left      = bal,
                    Top       = fel2,
                    Text      = "Used foods (for one unit):",
                    Font      = new Font(FontFamily.GenericSansSerif, 10),
                    ForeColor = Color.Brown,
                    AutoSize  = true,
                    Visible   = false,
                    Parent    = this
                };
                fel2 = label12.Bottom + 15;

                List <Elelmiszer> elelmiszerek2 = new List <Elelmiszer>();
                foreach (Elelmiszer item in elelmiszerek)
                {
                    if (item is Ital)
                    {
                        elelmiszerek2.Add((Ital)item);
                    }
                }

                foreach (Elelmiszer item in elelmiszerek)
                {
                    if (item is Etel)
                    {
                        elelmiszerek2.Add((Etel)item);
                    }
                }

                int size = elelmiszerek2.Count;
                labelek3   = new List <Label>();
                szamlalok3 = new List <NumericUpDown>();
                labelek4   = new List <Label>();

                for (i = 0; i < size; i++)
                {
                    Label label = new Label()
                    {
                        Left      = bal,
                        Top       = fel2,
                        Text      = elelmiszerek2[i].Megnevezes + ":",
                        Font      = new Font(FontFamily.GenericSansSerif, 10),
                        ForeColor = Color.Brown,
                        AutoSize  = true,
                        Visible   = false,
                        Parent    = this
                    };
                    labelek3.Add(label);

                    NumericUpDown num = new NumericUpDown()
                    {
                        Left          = bal + 100,
                        Top           = fel2,
                        Maximum       = (decimal)Konstans.maxMennyiseg,
                        Minimum       = 0,
                        DecimalPlaces = 2,
                        AutoSize      = true,
                        Visible       = false,
                        Parent        = this
                    };
                    szamlalok3.Add(num);

                    string merteknev = null;
                    if (elelmiszerek2[i] is Etel)
                    {
                        merteknev = (elelmiszerek2[i] as Etel).TomegMertek.Megnevezes;
                    }
                    else
                    {
                        merteknev = (elelmiszerek2[i] as Ital).Urmertek.Megnevezes;
                    }

                    label = new Label()
                    {
                        Left      = num.Right + 5,
                        Top       = fel2,
                        Text      = merteknev,
                        Font      = new Font(FontFamily.GenericSansSerif, 10),
                        ForeColor = Color.Brown,
                        AutoSize  = true,
                        Visible   = false,
                        Parent    = this
                    };
                    labelek4.Add(label);
                    fel2 = label.Bottom + 5;
                }


                button1 = new Button()
                {
                    Left         = label1.Left,
                    Top          = fel + 15,
                    Width        = Width - 60,
                    Text         = "OK",
                    Font         = new Font(FontFamily.GenericSansSerif, 12),
                    ForeColor    = Color.DarkGreen,
                    DialogResult = DialogResult.OK,
                    AutoSize     = true,
                    Parent       = this
                };

                button2 = new Button()
                {
                    Left         = button1.Left,
                    Top          = button1.Bottom + 10,
                    Width        = button1.Width,
                    Text         = "Cancel",
                    Font         = new Font(FontFamily.GenericSansSerif, 12),
                    ForeColor    = Color.DarkGreen,
                    DialogResult = DialogResult.Cancel,
                    AutoSize     = true,
                    Parent       = this
                };

                numericUpDown2.DecimalPlaces = penznemek[0].TizedesekSzama;

                comboBox1.DataSource    = null;
                comboBox1.DataSource    = Enum.GetValues(typeof(ElelmiszerTipus));
                comboBox1.SelectedIndex = 0;

                comboBox2.Items.Clear();
                comboBox2.Items.AddRange(penznemek.Select(p => p.Megnevezes).ToArray());
                comboBox2.SelectedIndex = 0;

                comboBox3.Items.Clear();
                comboBox3.Items.AddRange(mertekegysegek.Where(x => x.Mertek == MertekegysegFajta.weight).Select(m => m.Megnevezes)
                                         .ToArray());
                comboBox3.SelectedIndex = 0;

                comboBox4.Items.Clear();
                comboBox4.Items.AddRange(mertekegysegek.Where(x => x.Mertek == MertekegysegFajta.liquidmeasure)
                                         .Select(m => m.Megnevezes).ToArray());
                comboBox4.SelectedIndex = 0;

                label8.Text = comboBox3.SelectedItem.ToString();
                label9.Text = comboBox3.SelectedItem.ToString();

                checkBox3.Checked = true;
                checkBox4.Checked = true;
                checkBox5.Checked = true;
                checkBox7.Checked = true;

                Button btn = new Button();
                Height       = button2.Bottom + 45;
                btn.Text     = "Scrolled Button";
                btn.Size     = new Size(10, 10);
                btn.Location = new Point(this.Size.Width - 50, this.Size.Height - 50);
                Controls.Add(btn);
                AutoScroll = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
 public void RegisterControl(IControl control)
 {
     Controls.Add(control);
     control.IsDirtyChanged += Control_IsDirtyChanged;
 }
Exemplo n.º 4
0
        public void addItems(UploadItemVO obj)
        {
            uploadDetail.uploading_FileCountLabel.Text = "正在上传" + uploadHelper.voList.Count + "个文档";
            Panel gb1 = new Panel();

            gb1.Width  = 260;
            gb1.Height = 40;
            gb1.Left   = 38;
            PictureBox filePic = new PictureBox();

            //filePic.Image = Image.FromFile(@"../../Resources/images/word.png");
            //filePic.Image = global::GovDocSearch.Properties.Resources.word_24;
            filePic.Image  = UploadHelper.getImage(obj.fileExtension);
            filePic.Width  = 40;
            filePic.Height = 40;
            Label fileName = new Label();

            fileName.Text  = obj.fileName;
            fileName.Width = 200;
            fileName.Left  = 50;
            Label fileSize = new Label();

            fileSize.Font = new Font("微软雅黑", 9, fileName.Font.Style);
            fileSize.Text = Helper.ByteConvertGBMBKB(obj.fileSize);
            fileSize.Top  = 25;
            fileSize.Left = 51;
            gb1.Controls.Add(filePic);
            gb1.Controls.Add(fileName);
            gb1.Controls.Add(fileSize);
            Controls.Add(gb1);


            //Controls.Add(timeLabel);

            ProgressBar pbar = new ProgressBar();

            pbar.Top = 6;
            //pbar.BackColor = Color.Gray;
            pbar.ForeColor = Color.Blue;
            pbar.Width     = 150;
            pbar.Left      = 300;
            pbar.Maximum   = comps.vo.maximum;
            pbar.Minimum   = comps.vo.minimum;
            Controls.Add(pbar);

            Label labelProgressBar = new Label();

            labelProgressBar.Top   = 6;
            labelProgressBar.Width = 65;
            //labelProgressBar.BackColor = Color.Transparent;
            labelProgressBar.ForeColor = Color.Red;
            labelProgressBar.Left      = 470;
            //labelProgressBar.Visible = false;
            //labelProgressBar.Text = comps.vo.minimum.ToString() + "%";
            Controls.Add(labelProgressBar);

            Label fileStatus    = new Label();
            Label fileStatusTip = new Label();

            //fileStatus.Font = new Font("微软雅黑",9);
            fileStatus.Text       = "上传中";
            fileStatus.Width      = 150;
            fileStatus.Top        = 6;
            fileStatus.Left       = 547;
            fileStatusTip.Font    = new Font("微软雅黑", 9);
            fileStatusTip.Visible = false;
            fileStatusTip.Text    = "";
            fileStatusTip.Width   = 170;
            fileStatusTip.Top     = 20;
            fileStatusTip.Left    = 542;
            Controls.Add(fileStatus);
            Controls.Add(fileStatusTip);
            FlowLayoutPanel gb2 = new FlowLayoutPanel();

            //TableLayoutPanel gb2 = new TableLayoutPanel();
            //gb2.ColumnCount = 3;
            //gb2.RowCount = 1;
            gb2.Top   = 5;
            gb2.Left  = 715;
            gb2.Width = 60;
            //gb2.Width = 72;
            //gb2.Height = 24;
            //foreach (ColumnStyle cs in gb2.ColumnStyles)
            //{
            //    cs.Width = 24;
            //}
            PictureBox start = new PictureBox();

            start.Width  = 18;
            start.Height = 18;
            //start.Image = Image.FromFile(@"../../Resources/images/start.png");
            start.Image       = global::GovDocSearch.Properties.Resources.start;
            start.Cursor      = Cursors.Hand;
            start.MouseClick += OnStartMouseClick;
            start.Visible     = false;
            ToolTip startTip = new ToolTip();

            startTip.SetToolTip(start, "开始上传");
            PictureBox pause = new PictureBox();

            pause.Width  = 18;
            pause.Height = 18;
            //pause.Image = Image.FromFile(@"../../Resources/images/pause.png");
            pause.Image  = global::GovDocSearch.Properties.Resources.pause;
            pause.Cursor = Cursors.Hand;
            ToolTip pauseTip = new ToolTip();

            pauseTip.SetToolTip(pause, "暂停上传");
            pause.MouseClick += OnPauseMouseClick;
            PictureBox del = new PictureBox();

            del.Width  = 18;
            del.Height = 18;
            //del.Image = Image.FromFile(@"../../Resources/images/del.png");
            del.Image  = global::GovDocSearch.Properties.Resources.del;
            del.Cursor = Cursors.Hand;
            ToolTip delTip = new ToolTip();

            delTip.SetToolTip(del, "删除");
            del.MouseClick += OnDelMouseClick;
            gb2.Controls.Add(start);
            gb2.Controls.Add(pause);
            gb2.Controls.Add(del);
            //gb2.Controls.Add(start, 0, 0);
            //gb2.Controls.Add(pause, 1, 0);
            //gb2.Controls.Add(del, 2, 0);
            Controls.Add(gb2);

            comps.progressBar      = pbar;
            comps.fileStatus       = fileStatus;
            comps.fileStatusTip    = fileStatusTip;
            comps.btnPanel         = gb2;
            comps.start            = start;
            comps.pause            = pause;
            comps.del              = del; //
            comps.labelProgressBar = labelProgressBar;
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     valuesLv_       = new System.Windows.Forms.ListView();
     popupMenu_      = new System.Windows.Forms.ContextMenuStrip();
     graphMi_        = new System.Windows.Forms.ToolStripMenuItem();
     dataMi_         = new System.Windows.Forms.ToolStripMenuItem();
     separator01_    = new System.Windows.Forms.ToolStripMenuItem();
     addMi_          = new System.Windows.Forms.ToolStripMenuItem();
     copyMi_         = new System.Windows.Forms.ToolStripMenuItem();
     editMi_         = new System.Windows.Forms.ToolStripMenuItem();
     removeMi_       = new System.Windows.Forms.ToolStripMenuItem();
     separator02_    = new System.Windows.Forms.ToolStripMenuItem();
     importValuesMi_ = new System.Windows.Forms.ToolStripMenuItem();
     mainPn_         = new System.Windows.Forms.Panel();
     plotPn_         = new System.Windows.Forms.Panel();
     plotCtrl_       = new scpl.Windows.PlotSurface2D();
     mainPn_.SuspendLayout();
     plotPn_.SuspendLayout();
     SuspendLayout();
     //
     // ValuesLV
     //
     valuesLv_.ContextMenuStrip = popupMenu_;
     valuesLv_.Dock             = System.Windows.Forms.DockStyle.Fill;
     valuesLv_.FullRowSelect    = true;
     valuesLv_.Location         = new System.Drawing.Point(0, 0);
     valuesLv_.Name             = "valuesLv_";
     valuesLv_.Size             = new System.Drawing.Size(544, 360);
     valuesLv_.TabIndex         = 1;
     valuesLv_.View             = System.Windows.Forms.View.Details;
     valuesLv_.MouseDown       += new System.Windows.Forms.MouseEventHandler(ValuesLV_MouseDown);
     valuesLv_.DoubleClick     += new System.EventHandler(EditMI_Click);
     //
     // PopupMenu
     //
     popupMenu_.Items.AddRange(new System.Windows.Forms.ToolStripMenuItem[] {
         graphMi_,
         dataMi_,
         separator01_,
         addMi_,
         copyMi_,
         editMi_,
         removeMi_,
         separator02_,
         importValuesMi_
     });
     //
     // GraphMI
     //
     graphMi_.ImageIndex = 0;
     //this.GraphMI.RadioCheck = true;
     graphMi_.Text   = "Graph";
     graphMi_.Click += new System.EventHandler(GraphMI_Click);
     //
     // DataMI
     //
     dataMi_.Checked    = true;
     dataMi_.ImageIndex = 1;
     //this.DataMI.RadioCheck = true;
     dataMi_.Text   = "Data";
     dataMi_.Click += new System.EventHandler(DataMI_Click);
     //
     // Separator01
     //
     separator01_.ImageIndex = 2;
     separator01_.Text       = "-";
     //
     // AddMI
     //
     addMi_.ImageIndex = 3;
     addMi_.Text       = "Add...";
     addMi_.Click     += new System.EventHandler(AddMI_Click);
     //
     // CopyMI
     //
     copyMi_.ImageIndex = 4;
     copyMi_.Text       = "Copy...";
     copyMi_.Click     += new System.EventHandler(CopyMI_Click);
     //
     // EditMI
     //
     editMi_.ImageIndex = 5;
     editMi_.Text       = "Edit...";
     editMi_.Click     += new System.EventHandler(EditMI_Click);
     //
     // RemoveMI
     //
     removeMi_.ImageIndex = 6;
     removeMi_.Text       = "Remove";
     removeMi_.Click     += new System.EventHandler(RemoveMI_Click);
     //
     // Separator02
     //
     separator02_.ImageIndex = 7;
     separator02_.Text       = "-";
     //
     // ImportValuesMI
     //
     importValuesMi_.ImageIndex = 8;
     importValuesMi_.Text       = "Import Values...";
     importValuesMi_.Click     += new System.EventHandler(ImportValuesMI_Click);
     //
     // MainPN
     //
     mainPn_.Controls.Add(valuesLv_);
     mainPn_.Controls.Add(plotPn_);
     mainPn_.Dock     = System.Windows.Forms.DockStyle.Fill;
     mainPn_.Location = new System.Drawing.Point(0, 0);
     mainPn_.Name     = "mainPn_";
     mainPn_.Size     = new System.Drawing.Size(544, 360);
     mainPn_.TabIndex = 2;
     //
     // PlotPN
     //
     plotPn_.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     plotPn_.Controls.Add(plotCtrl_);
     plotPn_.Dock     = System.Windows.Forms.DockStyle.Fill;
     plotPn_.Location = new System.Drawing.Point(0, 0);
     plotPn_.Name     = "plotPn_";
     plotPn_.Size     = new System.Drawing.Size(544, 360);
     plotPn_.TabIndex = 3;
     //
     // PlotCTRL
     //
     plotCtrl_.AllowSelection   = false;
     plotCtrl_.BackColor        = System.Drawing.SystemColors.ControlLightLight;
     plotCtrl_.ContextMenuStrip = popupMenu_;
     plotCtrl_.Dock             = System.Windows.Forms.DockStyle.Fill;
     plotCtrl_.HorizontalEdgeLegendPlacement = scpl.Legend.Placement.Inside;
     plotCtrl_.LegendBorderStyle             = scpl.Legend.BorderType.Shadow;
     plotCtrl_.LegendXOffset = 10F;
     plotCtrl_.LegendYOffset = 1F;
     plotCtrl_.Location      = new System.Drawing.Point(0, 0);
     plotCtrl_.Name          = "plotCtrl_";
     plotCtrl_.Padding       = 10;
     plotCtrl_.PlotBackColor = System.Drawing.Color.White;
     plotCtrl_.ShowLegend    = false;
     plotCtrl_.Size          = new System.Drawing.Size(540, 356);
     plotCtrl_.TabIndex      = 2;
     plotCtrl_.Title         = "";
     plotCtrl_.TitleFont     = new System.Drawing.Font("Arial", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
     plotCtrl_.VerticalEdgeLegendPlacement = scpl.Legend.Placement.Outside;
     plotCtrl_.XAxis1 = null;
     plotCtrl_.XAxis2 = null;
     plotCtrl_.YAxis1 = null;
     plotCtrl_.YAxis2 = null;
     //
     // ItemValuesCtrl
     //
     Controls.Add(mainPn_);
     Name = "ItemValuesCtrl";
     Size = new System.Drawing.Size(544, 360);
     mainPn_.ResumeLayout(false);
     plotPn_.ResumeLayout(false);
     ResumeLayout(false);
 }
Exemplo n.º 6
0
        private void AppOnPreLoad()
        {
            //初始化函数

            //初始化桥
            mainNativeBridge = new MainNativeBridge(this);
            mainNativeBridge.exitCallBack = AppExit;
            mainNativeBridge.terminateImporantWarnCallBack = TermintateImporantProcess;
            mainNativeBridge.coreWndProc = (WNDPROC)Marshal.GetDelegateForFunctionPointer(MAppSetCallBack(IntPtr.Zero, 0), typeof(WNDPROC));
            mainNativeBridge.InitCallbacks();

            _isNativeBridgeLoaded = true;

            MainSettings = new MainSettings(this);

            //加载设置和所有页的代码
            AppLoadPages();
            AppLoadSettings();
            AppLoadAllMenuStyles();

            //标题
            SetConfig("LastWindowTitle", "AppSetting", Text);
            Text = GetConfig("Title", "AppSetting", "任务管理器");
            if (Text == "")
            {
                Text = LanuageFBuffers.Str_AppTitle;
            }

            new System.Threading.Thread(mainPagePerf.PerfInitTray).Start();

            //系统位数
#if _X64_
            Log("64 Bit OS ");
            Is64OS = true;
#else
            Is64OS = MIs64BitOS();
            Log(Is64OS ? "64 Bit OS but 32 bit app " : "32 Bit OS");
#endif
            IsAdmin = MIsRunasAdmin();

            //判断是否支持通用应用(win8 以上)
            SysVer.Get();
            if (!SysVer.IsWin8Upper())
            {
                tabControlMain.TabPages.Remove(tabPageUWPCtl);
            }
            else
            {
                M_UWP_Init();
            }

            //提升权限
            if (!MGetPrivileges())
            {
                TaskDialog.Show(LanuageMgr.GetStr("FailedGetPrivileges"), LanuageFBuffers.Str_AppTitle, "", TaskDialogButton.OK, TaskDialogIcon.Warning);
            }

            //tab 头 的自定义
            TaskMgrTabHeader tabHeader = new TaskMgrTabHeader(tabControlMain);
            Controls.Add(tabHeader);
            tabHeader.Dock   = DockStyle.Top;
            tabHeader.Height = 27;
            tabHeader.BringToFront();
            tabHeader.Font = tabControlMain.Font;
            if (IsSimpleView)
            {
                tabHeader.Visible = false;
            }

            //Shell Icon
            IntPtr shellIconPtr   = MGetShieldIcon2();
            Icon   shellIcon      = Icon.FromHandle(shellIconPtr);
            Bitmap shellIcoBtimap = MainUtils.IconToBitmap(shellIcon, 16, 16);

            check_showAllProcess.Image     = shellIcoBtimap;
            linkRebootAsAdmin.Image        = shellIcoBtimap;
            linkRestartAsAdminDriver.Image = shellIcoBtimap;

            DestroyIcon(shellIconPtr);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Prepares the Layout.. rendering all the necessary controls
        /// </summary>
        private void PrepareLayout(string layoutPath)
        {
            // Create a start record for this layout
            _stat            = new Stat();
            _stat.type       = StatType.Layout;
            _stat.scheduleID = _scheduleId;
            _stat.layoutID   = _layoutId;
            _stat.fromDate   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            // Get this layouts XML
            XmlDocument layoutXml = new XmlDocument();
            DateTime    layoutModifiedTime;

            // Default or not
            if (layoutPath == ApplicationSettings.Default.LibraryPath + @"\Default.xml" || String.IsNullOrEmpty(layoutPath))
            {
                throw new Exception("Default layout");
            }
            else
            {
                try
                {
                    // try to open the layout file
                    using (FileStream fs = File.Open(layoutPath, FileMode.Open, FileAccess.Read, FileShare.Write))
                    {
                        using (XmlReader reader = XmlReader.Create(fs))
                        {
                            layoutXml.Load(reader);

                            reader.Close();
                        }
                        fs.Close();
                    }

                    layoutModifiedTime = File.GetLastWriteTime(layoutPath);
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(string.Format("Could not find the layout file {0}: {1}", layoutPath, ex.Message));
                    throw;
                }
            }

            // Attributes of the main layout node
            XmlNode layoutNode = layoutXml.SelectSingleNode("/layout");

            XmlAttributeCollection layoutAttributes = layoutNode.Attributes;

            // Set the background and size of the form
            _layoutWidth  = int.Parse(layoutAttributes["width"].Value, CultureInfo.InvariantCulture);
            _layoutHeight = int.Parse(layoutAttributes["height"].Value, CultureInfo.InvariantCulture);


            // Scaling factor, will be applied to all regions
            _scaleFactor = Math.Min(_clientSize.Width / _layoutWidth, _clientSize.Height / _layoutHeight);

            // Want to be able to center this shiv - therefore work out which one of these is going to have left overs
            int backgroundWidth  = (int)(_layoutWidth * _scaleFactor);
            int backgroundHeight = (int)(_layoutHeight * _scaleFactor);

            double leftOverX;
            double leftOverY;

            try
            {
                leftOverX = Math.Abs(_clientSize.Width - backgroundWidth);
                leftOverY = Math.Abs(_clientSize.Height - backgroundHeight);

                if (leftOverX != 0)
                {
                    leftOverX = leftOverX / 2;
                }
                if (leftOverY != 0)
                {
                    leftOverY = leftOverY / 2;
                }
            }
            catch
            {
                leftOverX = 0;
                leftOverY = 0;
            }

            // New region and region options objects
            _regions = new Collection <Region>();
            RegionOptions options = new RegionOptions();

            options.LayoutModifiedDate = layoutModifiedTime;

            // Deal with the color
            try
            {
                if (layoutAttributes["bgcolor"].Value != "")
                {
                    this.BackColor          = ColorTranslator.FromHtml(layoutAttributes["bgcolor"].Value);
                    options.backgroundColor = layoutAttributes["bgcolor"].Value;
                }
            }
            catch
            {
                this.BackColor          = Color.Black; // Default black
                options.backgroundColor = "#000000";
            }

            // Get the background
            try
            {
                if (layoutAttributes["background"] != null && !string.IsNullOrEmpty(layoutAttributes["background"].Value))
                {
                    string bgFilePath = ApplicationSettings.Default.LibraryPath + @"\backgrounds\" + backgroundWidth + "x" + backgroundHeight + "_" + layoutAttributes["background"].Value;

                    // Create a correctly sized background image in the temp folder
                    if (!File.Exists(bgFilePath))
                    {
                        GenerateBackgroundImage(layoutAttributes["background"].Value, backgroundWidth, backgroundHeight, bgFilePath);
                    }

                    BackgroundImage         = new Bitmap(bgFilePath);
                    options.backgroundImage = bgFilePath;
                }
                else
                {
                    // Assume there is no background image
                    BackgroundImage         = null;
                    options.backgroundImage = "";
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(new LogMessage("MainForm - PrepareLayout", "Unable to set background: " + ex.Message), LogType.Error.ToString());

                // Assume there is no background image
                this.BackgroundImage    = null;
                options.backgroundImage = "";
            }

            // Get the regions
            XmlNodeList listRegions = layoutXml.SelectNodes("/layout/region");
            XmlNodeList listMedia   = layoutXml.SelectNodes("/layout/region/media");

            // Check to see if there are any regions on this layout.
            if (listRegions.Count == 0 || listMedia.Count == 0)
            {
                Trace.WriteLine(new LogMessage("PrepareLayout",
                                               string.Format("A layout with {0} regions and {1} media has been detected.", listRegions.Count.ToString(), listMedia.Count.ToString())),
                                LogType.Info.ToString());

                if (_schedule.ActiveLayouts == 1)
                {
                    Trace.WriteLine(new LogMessage("PrepareLayout", "Only 1 layout scheduled and it has nothing to show."), LogType.Info.ToString());

                    throw new Exception("Only 1 layout schduled and it has nothing to show");
                }
                else
                {
                    Trace.WriteLine(new LogMessage("PrepareLayout",
                                                   string.Format(string.Format("An empty layout detected, will show for {0} seconds.", ApplicationSettings.Default.EmptyLayoutDuration.ToString()))), LogType.Info.ToString());

                    // Put a small dummy region in place, with a small dummy media node - which expires in 10 seconds.
                    XmlDocument dummyXml = new XmlDocument();
                    dummyXml.LoadXml(string.Format("<region id='blah' width='1' height='1' top='1' left='1'><media id='blah' type='text' duration='{0}'><raw><text></text></raw></media></region>",
                                                   ApplicationSettings.Default.EmptyLayoutDuration.ToString()));

                    // Replace the list of regions (they mean nothing as they are empty)
                    listRegions = dummyXml.SelectNodes("/region");
                }
            }

            foreach (XmlNode region in listRegions)
            {
                // Is there any media
                if (region.ChildNodes.Count == 0)
                {
                    Debug.WriteLine("A region with no media detected");
                    continue;
                }

                //each region
                XmlAttributeCollection nodeAttibutes = region.Attributes;

                options.scheduleId  = _scheduleId;
                options.layoutId    = _layoutId;
                options.regionId    = nodeAttibutes["id"].Value.ToString();
                options.width       = (int)(Convert.ToDouble(nodeAttibutes["width"].Value, CultureInfo.InvariantCulture) * _scaleFactor);
                options.height      = (int)(Convert.ToDouble(nodeAttibutes["height"].Value, CultureInfo.InvariantCulture) * _scaleFactor);
                options.left        = (int)(Convert.ToDouble(nodeAttibutes["left"].Value, CultureInfo.InvariantCulture) * _scaleFactor);
                options.top         = (int)(Convert.ToDouble(nodeAttibutes["top"].Value, CultureInfo.InvariantCulture) * _scaleFactor);
                options.scaleFactor = _scaleFactor;

                // Store the original width and original height for scaling
                options.originalWidth  = (int)Convert.ToDouble(nodeAttibutes["width"].Value, CultureInfo.InvariantCulture);
                options.originalHeight = (int)Convert.ToDouble(nodeAttibutes["height"].Value, CultureInfo.InvariantCulture);

                // Set the backgrounds (used for Web content offsets)
                options.backgroundLeft = options.left * -1;
                options.backgroundTop  = options.top * -1;

                // Account for scaling
                options.left = options.left + (int)leftOverX;
                options.top  = options.top + (int)leftOverY;

                // All the media nodes for this region / layout combination
                options.mediaNodes = region.SelectNodes("media");

                Region temp = new Region(ref _statLog, ref _cacheManager);
                temp.DurationElapsedEvent += new Region.DurationElapsedDelegate(temp_DurationElapsedEvent);

                Debug.WriteLine("Created new region", "MainForm - Prepare Layout");

                // Dont be fooled, this innocent little statement kicks everything off
                temp.regionOptions = options;

                _regions.Add(temp);
                Controls.Add(temp);

                Debug.WriteLine("Adding region", "MainForm - Prepare Layout");
            }

            // Null stuff
            listRegions = null;
            listMedia   = null;
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     cancelBtn_            = new System.Windows.Forms.Button();
     buttonsPn_            = new System.Windows.Forms.Panel();
     okBtn_                = new System.Windows.Forms.Button();
     mainPn_               = new System.Windows.Forms.Panel();
     timestampCtrl_        = new System.Windows.Forms.DateTimePicker();
     timestampLb_          = new System.Windows.Forms.Label();
     timestampSpecifiedCb_ = new System.Windows.Forms.CheckBox();
     buttonsPn_.SuspendLayout();
     mainPn_.SuspendLayout();
     SuspendLayout();
     //
     // CancelBTN
     //
     cancelBtn_.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     cancelBtn_.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     cancelBtn_.Location     = new System.Drawing.Point(168, 8);
     cancelBtn_.Name         = "cancelBtn_";
     cancelBtn_.TabIndex     = 0;
     cancelBtn_.Text         = "Cancel";
     //
     // ButtonsPN
     //
     buttonsPn_.Controls.Add(okBtn_);
     buttonsPn_.Controls.Add(cancelBtn_);
     buttonsPn_.Dock     = System.Windows.Forms.DockStyle.Bottom;
     buttonsPn_.Location = new System.Drawing.Point(0, 26);
     buttonsPn_.Name     = "buttonsPn_";
     buttonsPn_.Size     = new System.Drawing.Size(248, 36);
     buttonsPn_.TabIndex = 0;
     //
     // OkBTN
     //
     okBtn_.DialogResult = System.Windows.Forms.DialogResult.OK;
     okBtn_.Location     = new System.Drawing.Point(4, 8);
     okBtn_.Name         = "okBtn_";
     okBtn_.TabIndex     = 0;
     okBtn_.Text         = "OK";
     //
     // MainPN
     //
     mainPn_.Controls.Add(timestampSpecifiedCb_);
     mainPn_.Controls.Add(timestampCtrl_);
     mainPn_.Controls.Add(timestampLb_);
     mainPn_.Dock              = System.Windows.Forms.DockStyle.Fill;
     mainPn_.DockPadding.Left  = 4;
     mainPn_.DockPadding.Right = 4;
     mainPn_.DockPadding.Top   = 4;
     mainPn_.Location          = new System.Drawing.Point(0, 0);
     mainPn_.Name              = "mainPn_";
     mainPn_.Size              = new System.Drawing.Size(248, 26);
     mainPn_.TabIndex          = 33;
     //
     // TimestampCTRL
     //
     timestampCtrl_.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                   | System.Windows.Forms.AnchorStyles.Right)));
     timestampCtrl_.CustomFormat = "yyyy-MM-dd HH:mm:ss";
     timestampCtrl_.Enabled      = false;
     timestampCtrl_.Format       = System.Windows.Forms.DateTimePickerFormat.Custom;
     timestampCtrl_.Location     = new System.Drawing.Point(72, 4);
     timestampCtrl_.Name         = "timestampCtrl_";
     timestampCtrl_.Size         = new System.Drawing.Size(152, 20);
     timestampCtrl_.TabIndex     = 40;
     //
     // TimestampLB
     //
     timestampLb_.Location  = new System.Drawing.Point(4, 4);
     timestampLb_.Name      = "timestampLb_";
     timestampLb_.Size      = new System.Drawing.Size(68, 23);
     timestampLb_.TabIndex  = 39;
     timestampLb_.Text      = "Timestamp";
     timestampLb_.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     //
     // TimestampSpecifiedCB
     //
     timestampSpecifiedCb_.Anchor          = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     timestampSpecifiedCb_.Location        = new System.Drawing.Point(228, 3);
     timestampSpecifiedCb_.Name            = "timestampSpecifiedCb_";
     timestampSpecifiedCb_.Size            = new System.Drawing.Size(16, 24);
     timestampSpecifiedCb_.TabIndex        = 41;
     timestampSpecifiedCb_.CheckedChanged += new System.EventHandler(TimestampSpecifiedCB_CheckedChanged);
     //
     // TimestampEditDlg
     //
     AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     ClientSize        = new System.Drawing.Size(248, 62);
     Controls.Add(mainPn_);
     Controls.Add(buttonsPn_);
     Name          = "TimestampEditDlg";
     StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
     Text          = "Edit Timestamp";
     buttonsPn_.ResumeLayout(false);
     mainPn_.ResumeLayout(false);
     ResumeLayout(false);
 }
Exemplo n.º 9
0
        public Form1()
        {
            InitializeComponent();
            versionImage.InitialImage = Resources.circle;
            AddFont(Resources.SFProDisplay);
            var version = FriendlyName().Replace("Microsoft ", "");

            versionTitle.Text = version;
            OSNum             = version.Replace("Windows ", "").Replace(" Home", "").Replace(" Pro", "").Replace(" Pro for Workstations", "").Replace(" Education", "").Replace(" Pro Education", "").Replace(" Enterprise", "").Replace(" ", "");
            var closeImage = new PictureBox()
            {
                BackColor = Color.Transparent, Image = Resources.close
            };
            var minimiseImage = new PictureBox()
            {
                BackColor = Color.Transparent, Image = Resources.minimize
            };

            windowControls.Renderer = new ButtonRenderer();
            closeButton             = windowControls.Items.Add(closeImage.Image);
            minimiseButton          = windowControls.Items.Add(minimiseImage.Image);
            breakSpace                   = windowControls.Items.Add(" ");
            overviewMenu                 = windowControls.Items.Add("Overview");
            displayMenu                  = windowControls.Items.Add("Displays");
            storageMenu                  = windowControls.Items.Add("Storage");
            overviewMenu.TextAlign       = ContentAlignment.MiddleCenter;
            displayMenu.TextAlign        = ContentAlignment.MiddleCenter;
            storageMenu.TextAlign        = ContentAlignment.MiddleCenter;
            overviewMenu.BackgroundImage = Resources.selected;
            displayMenu.BackgroundImage  = Resources.unselected;
            storageMenu.BackgroundImage  = Resources.unselected;
            overviewMenu.AutoToolTip     = false;
            displayMenu.AutoToolTip      = false;
            storageMenu.AutoToolTip      = false;
            for (int i = 0; i < Convert.ToInt32(windowControls.Width / 10); i++)
            {
                breakSpace.Text += " ";
            }
            breakSpace.AutoToolTip = false;
            breakSpace.MouseDown  += BreakSpace_MouseDown;
            overviewMenu.Font      = new Font(pfc.Families[0], 11, FontStyle.Regular);
            displayMenu.Font       = new Font(pfc.Families[0], 11, FontStyle.Regular);
            storageMenu.Font       = new Font(pfc.Families[0], 11, FontStyle.Regular);
            verNum.Font            = new Font(pfc.Families[0], 11, FontStyle.Regular);
            verNum.Location        = new Point(versionTitle.Location.X + 3, versionTitle.Location.Y + versionTitle.Height - 3);
            verNum.Text            = "Version " + Environment.OSVersion.Version + " (" + Environment.OSVersion.Platform + ")";
            model.Font             = new Font(pfc.Families[0], 11, FontStyle.Regular);
            model.Location         = new Point(verNum.Location.X, verNum.Location.Y + verNum.Height * 2 - 3);
            model.Text             = modelName();
            processorName.Font     = new Font(pfc.Families[0], 11, FontStyle.Regular);
            processorName.Location = new Point(model.Location.X, model.Location.Y + model.Height);
            var cpu = processor().Replace("Intel(R) Core(TM)", "Intel Core");

            processorName.Text = "Processor: " + cpu;
            memory.Font        = new Font(pfc.Families[0], 11, FontStyle.Regular);
            memory.Location    = new Point(processorName.Location.X, processorName.Location.Y + processorName.Height);
            memory.Text        = ram();
            sdLabel.Font       = new Font(pfc.Families[0], 11, FontStyle.Regular);
            sdLabel.Location   = new Point(memory.Location.X, memory.Location.Y + memory.Height);
            sdLabel.Text       = "Startup Disk: " + startupDisk();
            graphics.Font      = new Font(pfc.Families[0], 11, FontStyle.Regular);
            graphics.Location  = new Point(sdLabel.Location.X, sdLabel.Location.Y + sdLabel.Height);
            graphics.Text      = "Graphics: " + gpu();
            serial.Font        = new Font(pfc.Families[0], 11, FontStyle.Regular);
            serial.Location    = new Point(graphics.Location.X, graphics.Location.Y + graphics.Height);
            serial.Text        = "Serial Number: " + serialnum();
            sysReport          = new Button()
            {
                Text = "System Report...", Font = new Font(pfc.Families[0], 9, FontStyle.Regular), AutoSize = true, BackColor = Color.Transparent
            };
            softwareUpdate = new Button()
            {
                Text = "Software Update...", Font = new Font(pfc.Families[0], 9, FontStyle.Regular), AutoSize = true, BackColor = Color.Transparent
            };
            sysReport.Location                   = new Point(serial.Location.X - (softwareUpdate.Width - sysReport.Width), serial.Location.Y + serial.Height * 2);
            softwareUpdate.Location              = new Point(serial.Location.X + (softwareUpdate.Width + sysReport.Width), serial.Location.Y + serial.Height * 2);
            sysReport.FlatStyle                  = FlatStyle.System;
            softwareUpdate.FlatStyle             = FlatStyle.System;
            sysReport.BackgroundImage            = Resources.unselected;
            sysReport.BackgroundImageLayout      = ImageLayout.Stretch;
            softwareUpdate.BackgroundImage       = Resources.unselected;
            softwareUpdate.BackgroundImageLayout = ImageLayout.Stretch;
            Controls.Add(sysReport);
            Controls.Add(softwareUpdate);
            displayImg = new PictureBox()
            {
                Image = Resources.Apple_Thunderbolt_Display, BackColor = Color.Transparent, SizeMode = PictureBoxSizeMode.StretchImage, Visible = false, Size = new Size(Resources.Apple_Thunderbolt_Display.Width / 3, Resources.Apple_Thunderbolt_Display.Height / 3)
            };
            displaySize = new Label()
            {
                Text = resolution(), Font = new Font(pfc.Families[0], 11, FontStyle.Regular), BackColor = Color.Transparent, AutoSize = true, Visible = false
            };
            displayAdapter = new Label()
            {
                Text = graphics.Text.Replace("Graphics: ", ""), Font = new Font(pfc.Families[0], 11, FontStyle.Regular), BackColor = Color.Transparent, AutoSize = true, Visible = false
            };
            displaySettings = new Button()
            {
                Text = "Displays Preferences", Font = new Font(pfc.Families[0], 11), BackColor = Color.Transparent, AutoSize = true, Visible = false
            };
            displaySettings.Click      += DisplaySettings_Click;
            displaySettings.MouseEnter += DisplaySettings_MouseEnter;
            displaySettings.MouseLeave += DisplaySettings_MouseLeave;
            var chartArea = new ChartArea("Drives");

            chart.ChartAreas.Add(chartArea);
            chart.Dock    = DockStyle.Bottom;
            chart.Visible = false;
            diskUsage();
            Controls.Add(chart);
            Controls.Add(displayImg);
            Controls.Add(displaySize);
            Controls.Add(displayAdapter);
            Controls.Add(displaySettings);
            sysReport.Click           += SysReport_Click;
            sysReport.MouseEnter      += SysReport_MouseEnter;
            sysReport.MouseLeave      += SysReport_MouseLeave;
            softwareUpdate.Click      += SoftwareUpdate_Click;
            softwareUpdate.MouseEnter += SoftwareUpdate_MouseEnter;
            softwareUpdate.MouseLeave += SoftwareUpdate_MouseLeave;
            closeButton.MouseEnter    += CloseButton_MouseEnter;
            closeButton.MouseLeave    += CloseButton_MouseLeave;
            closeButton.Click         += CloseButton_Click;
            minimiseButton.MouseEnter += MinimiseButton_MouseEnter;
            minimiseButton.MouseLeave += MinimiseButton_MouseLeave;
            minimiseButton.Click      += MinimiseButton_Click;
            overviewMenu.MouseEnter   += OverviewMenu_MouseEnter;
            overviewMenu.MouseLeave   += OverviewMenu_MouseLeave;
            overviewMenu.Click        += OverviewMenu_Click;
            displayMenu.MouseEnter    += DisplayMenu_MouseEnter;
            displayMenu.MouseLeave    += DisplayMenu_MouseLeave;
            displayMenu.Click         += DisplayMenu_Click;
            storageMenu.MouseEnter    += StorageMenu_MouseEnter;
            storageMenu.MouseLeave    += StorageMenu_MouseLeave;
            storageMenu.Click         += StorageMenu_Click;
            if (OSNum == "10")
            {
                versionImage.Image = Resources.win10;
            }
            else if (OSNum == "8" || OSNum == "8.1")
            {
                versionImage.Image = Resources.win8;
            }
            else if (OSNum == "7")
            {
                versionImage.Image = Resources.win7;
            }
            versionImage.Size = new Size(versionImage.Image.Width / 2, versionImage.Image.Height / 2);
        }
Exemplo n.º 10
0
 public BaseForm()
 {
     button1.Name = "button1";
     Controls.Add(button1);
 }
        public MyGuiScreenOptionsAudio()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, size: new Vector2(1030f, 650f) / MyGuiConstants.GUI_OPTIMAL_SIZE)
        {
            EnabledBackgroundFade = true;

            AddCaption(MyCommonTexts.ScreenCaptionAudioOptions);

            var   topLeft      = m_size.Value * -0.5f;
            var   topCenter    = m_size.Value * new Vector2(0f, -0.5f);
            var   bottomCenter = m_size.Value * (MyPerGameSettings.VoiceChatEnabled ? new Vector2(0f, 0.7f) : new Vector2(0f, 0.6f));
            float startHeight  = MyPerGameSettings.VoiceChatEnabled? 150f : 170f;

            Vector2 controlsOriginLeft  = topLeft + new Vector2(110f, startHeight) / MyGuiConstants.GUI_OPTIMAL_SIZE;
            Vector2 controlsOriginRight = topCenter + new Vector2(-25f, startHeight) / MyGuiConstants.GUI_OPTIMAL_SIZE;
            Vector2 controlsDelta       = new Vector2(0f, 60f) / MyGuiConstants.GUI_OPTIMAL_SIZE;

            //  Game Volume
            Controls.Add(new MyGuiControlLabel(
                             position: controlsOriginLeft + 0 * controlsDelta,
                             text: MyTexts.GetString(MyCommonTexts.GameVolume),
                             originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_gameVolumeSlider = new MyGuiControlSlider(
                position: controlsOriginRight + 0 * controlsDelta,
                minValue: MyAudioConstants.GAME_MASTER_VOLUME_MIN,
                maxValue: MyAudioConstants.GAME_MASTER_VOLUME_MAX,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                defaultValue: MySandboxGame.Config.GameVolume);
            m_gameVolumeSlider.ValueChanged = OnGameVolumeChange;
            Controls.Add(m_gameVolumeSlider);

            //  Music Volume
            Controls.Add(new MyGuiControlLabel(
                             position: controlsOriginLeft + 1 * controlsDelta,
                             text: MyTexts.GetString(MyCommonTexts.MusicVolume),
                             originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_musicVolumeSlider = new MyGuiControlSlider(
                position: controlsOriginRight + 1 * controlsDelta,
                minValue: MyAudioConstants.MUSIC_MASTER_VOLUME_MIN,
                maxValue: MyAudioConstants.MUSIC_MASTER_VOLUME_MAX,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                defaultValue: MySandboxGame.Config.MusicVolume);
            m_musicVolumeSlider.ValueChanged = OnMusicVolumeChange;
            Controls.Add(m_musicVolumeSlider);

            Controls.Add(new MyGuiControlLabel(
                             position: controlsOriginLeft + 2 * controlsDelta,
                             text: MyTexts.GetString(MyCommonTexts.HudWarnings),
                             originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_hudWarnings = new MyGuiControlCheckbox(
                position: controlsOriginRight + 2 * controlsDelta,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_hudWarnings.IsCheckedChanged = HudWarningsChecked;
            Controls.Add(m_hudWarnings);

            Controls.Add(new MyGuiControlLabel(
                             position: controlsOriginLeft + 3 * controlsDelta,
                             text: MyTexts.GetString(MyCommonTexts.MuteWhenNotInFocus),
                             originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_enableMuteWhenNotInFocus = new MyGuiControlCheckbox(
                position: controlsOriginRight + 3 * controlsDelta,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_enableMuteWhenNotInFocus.IsCheckedChanged = EnableMuteWhenNotInFocusChecked;
            Controls.Add(m_enableMuteWhenNotInFocus);

            int perGameControls = 4;

            m_enableDynamicMusic = new MyGuiControlCheckbox(
                position: controlsOriginRight + perGameControls * controlsDelta,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_enableDynamicMusic.IsCheckedChanged = EnableDynamicMusicChecked;
            if (MyPerGameSettings.UseMusicController)
            {
                Controls.Add(new MyGuiControlLabel(
                                 position: controlsOriginLeft + perGameControls * controlsDelta,
                                 text: MyTexts.GetString(MyCommonTexts.AudioSettings_UseMusicController),
                                 originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_enableDynamicMusic);
                perGameControls++;
            }

            m_shipSoundsAreBasedOnSpeed = new MyGuiControlCheckbox(
                position: controlsOriginRight + perGameControls * controlsDelta,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_shipSoundsAreBasedOnSpeed.IsCheckedChanged = ShipSoundsAreBasedOnSpeedChecked;
            if (MyPerGameSettings.EnableShipSoundSystem)
            {
                Controls.Add(new MyGuiControlLabel(
                                 position: controlsOriginLeft + perGameControls * controlsDelta,
                                 text: MyTexts.GetString(MyCommonTexts.AudioSettings_ShipSoundsBasedOnSpeed),
                                 originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_shipSoundsAreBasedOnSpeed);
                perGameControls++;
            }

            m_enableReverb = new MyGuiControlCheckbox(
                position: controlsOriginRight + perGameControls * controlsDelta,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_enableReverb.IsCheckedChanged = EnableReverbChecked;
            if (MyPerGameSettings.UseReverbEffect)
            {
                Controls.Add(new MyGuiControlLabel(
                                 position: controlsOriginLeft + perGameControls * controlsDelta,
                                 text: MyTexts.GetString(MyCommonTexts.AudioSettings_EnableReverb),
                                 originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_enableReverb);
                perGameControls++;
            }

            // Voice chat checkbox
            m_enableVoiceChat = new MyGuiControlCheckbox(
                position: controlsOriginRight + perGameControls * controlsDelta,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_enableVoiceChat.IsCheckedChanged = VoiceChatChecked;
            if (MyPerGameSettings.VoiceChatEnabled)
            {
                Controls.Add(new MyGuiControlLabel(
                                 position: controlsOriginLeft + perGameControls * controlsDelta,
                                 text: MyTexts.GetString(MyCommonTexts.EnableVoiceChat),
                                 originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_enableVoiceChat);
                perGameControls++;
            }

            // voice chat volume
            m_voiceChatVolumeSlider = new MyGuiControlSlider(
                position: controlsOriginRight + perGameControls * controlsDelta,
                minValue: MyAudioConstants.VOICE_CHAT_VOLUME_MIN,
                maxValue: MyAudioConstants.VOICE_CHAT_VOLUME_MAX,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                defaultValue: MySandboxGame.Config.VoiceChatVolume);
            m_voiceChatVolumeSlider.ValueChanged = OnVoiceChatVolumeChange;
            if (MyPerGameSettings.VoiceChatEnabled)
            {
                // label for voice chat
                Controls.Add(new MyGuiControlLabel(
                                 position: controlsOriginLeft + perGameControls * controlsDelta,
                                 text: MyTexts.GetString(MyCommonTexts.VoiceChatVolume),
                                 originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_voiceChatVolumeSlider);
                perGameControls++;
            }


            //  Buttons OK and CANCEL

            var m_okButton = new MyGuiControlButton(
                position: bottomCenter + new Vector2(-75f, perGameControls < 6 ? -130f : -90f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                size: MyGuiConstants.OK_BUTTON_SIZE,
                text: MyTexts.Get(MyCommonTexts.Ok),
                onButtonClick: OnOkClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);

            Controls.Add(m_okButton);

            var m_cancelButton = new MyGuiControlButton(
                position: bottomCenter + new Vector2(75f, perGameControls < 6 ? -130f : -90f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                size: MyGuiConstants.OK_BUTTON_SIZE,
                text: MyTexts.Get(MyCommonTexts.Cancel),
                onButtonClick: OnCancelClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);

            Controls.Add(m_cancelButton);


            //  Update controls with values from config file
            UpdateFromConfig(m_settingsOld);
            UpdateFromConfig(m_settingsNew);
            UpdateControls(m_settingsOld);

            CloseButtonEnabled = true;
            CloseButtonOffset  = MakeXAndYEqual(new Vector2(-0.006f, 0.006f));

            m_gameAudioPausedWhenOpen = MyAudio.Static.GameSoundIsPaused;
            if (m_gameAudioPausedWhenOpen)
            {
                MyAudio.Static.ResumeGameSounds();
            }
        }
Exemplo n.º 12
0
 protected override void CreateChildControls()
 {
     Controls.Clear();
     Controls.Add(TextHyperlinkControl);
 }
        protected override void CreateChildControls()
        {
            if (SPContext.Current.FormContext.FormMode == SPControlMode.Display)
            {
                Controls.Add(new LiteralControl("<div class=\"wet-boew-multimedia\">"));
                Controls.Add(new LiteralControl("<video width=\"" + width + "\" height=\"" + height + "\" poster=\"" + altimage + "\" title=\"" + Title + "\">"));

                if (VideoUrlWebM != string.Empty)
                {
                    Controls.Add(new LiteralControl("<source src=\"" + VideoUrlWebM + "\" type=\"video/webm\" />"));
                }

                if (VideoUrlMP4 != string.Empty)
                {
                    Controls.Add(new LiteralControl("<source src=\"" + VideoUrlMP4 + "\" type=\"video/mp4\" />"));
                }

                if (subUrl.Length > 2)
                {
                    Controls.Add(new LiteralControl("<track kind=\"captions\" data-type=\"application/ttml+xml\" src=\"" + subUrl + "\"></track>"));
                }
                Controls.Add(new LiteralControl("</video>"));
                Controls.Add(new LiteralControl("</div>"));
            }
            else // SPContext.Current.FormContext.FormMode = SPControlMode.Edit
            {
                editPanel       = new Panel();
                editPanel.Width = Unit.Pixel(460);
                editPanel.Controls.Add(new LiteralControl("WebPart Configuration"));
                editPanel.Controls.Add(new LiteralControl("<br/>Video's Title<br/>"));
                titleTxt = new TextBox();
                if (!string.IsNullOrEmpty(Title))
                {
                    titleTxt.Text = Title;
                }
                editPanel.Controls.Add(titleTxt);

                editPanel.Controls.Add(new LiteralControl("<br />"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the MP4 video url<br/>"));
                videourl = new TextBox();
                if (!string.IsNullOrEmpty(VideoUrlMP4))
                {
                    videourl.Text = VideoUrlMP4;
                }
                editPanel.Controls.Add(videourl);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the WebM video url<br/>"));
                videourlwebm = new TextBox();
                if (!string.IsNullOrEmpty(VideoUrlWebM))
                {
                    videourlwebm.Text = VideoUrlWebM;
                }
                editPanel.Controls.Add(videourlwebm);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the subtitle url<br/>"));
                suburl = new TextBox();
                if (!string.IsNullOrEmpty(subUrl))
                {
                    suburl.Text = subUrl;
                }
                editPanel.Controls.Add(suburl);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the width<br/>"));
                txtwidth = new TextBox();
                if (!string.IsNullOrEmpty(width))
                {
                    txtwidth.Text = width;
                }
                editPanel.Controls.Add(txtwidth);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the height<br/>"));
                txtheight = new TextBox();
                if (!string.IsNullOrEmpty(height))
                {
                    txtheight.Text = height;
                }
                editPanel.Controls.Add(txtheight);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                editPanel.Controls.Add(new LiteralControl("<br/>Please define the alternate image (no playback fallback) url<br/>"));
                txtaltimg = new TextBox();
                if (!string.IsNullOrEmpty(altimage))
                {
                    txtaltimg.Text = altimage;
                }
                editPanel.Controls.Add(txtaltimg);

                editPanel.Controls.Add(new LiteralControl("<br/>"));
                submit        = new Button();
                submit.Text   = "Save";
                submit.Click += new EventHandler(submit_Click);
                editPanel.Controls.Add(submit);
                Controls.Add(editPanel);
            }
        }
Exemplo n.º 14
0
        void SetUpMonthAndYear(DateTime _dt)
        {
            connection.Open();

            OleDbCommand command = new OleDbCommand();

            command.Connection = connection;

            string query = @"SELECT * FROM NewPettyCash WHERE year(DatePetty) = year(@_dt) AND month(DatePetty) = month(@_dt) ORDER BY DatePetty DESC";

            command.Parameters.AddWithValue("@_dt", _dt);

            command.CommandText = query;

            reader = command.ExecuteReader();

            lbl_latest.Visible = false;
            DateTime dtTodayCompare  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0);
            DateTime dtPickedCompare = new DateTime(_dt.Year, _dt.Month, _dt.Day, 12, 0, 0);

            if (dtTodayCompare.Year == dtPickedCompare.Year && dtTodayCompare.Month == dtPickedCompare.Month)
            {
                lbl_latest.Visible = true;
            }

            iInitialPanelLocationY = pnl_template.Location.Y;

            string sFinalAmount = "";

            bool bPettyCashThisMonth = false;

            while (reader.Read())
            {
                m_bIsReimburse = (bool)reader["IsReimburse"];

                pnl          = new Panel();
                pnl.Location = new Point(pnl_template.Location.X, iInitialPanelLocationY);
                pnl.Name     = "F";

                pnl.Size = pnl_template.Size;

                if (!m_bIsReimburse)
                {
                    pnl.BackColor = pnl_template.BackColor;
                }
                else
                {
                    pnl.BackColor = Color.LightGreen;
                }

                pnl.BorderStyle = pnl_template.BorderStyle;

                foreach (Control p in pnl_template.Controls)
                {
                    // Handles all the button controls
                    if (p.GetType() == typeof(Button))
                    {
                        //ControlButtons(p);
                    }
                    // Handles all the Label Controlls
                    if (p.GetType() == typeof(Label))
                    {
                        ControlLabels(p);
                    }
                }

                Controls.Add(pnl);

                iInitialPanelLocationY += 60;

                if (!bFinalOnlyOnce)
                {
                    sFinalAmount = reader["PettyRunningTotal"].ToString();

                    bFinalOnlyOnce = true;
                }

                bPettyCashThisMonth = true;
            }

            if (!bPettyCashThisMonth)
            {
                lbl_latest.Visible = false;
            }

            connection.Close();

            if (!bUpdateOnce)
            {
                float fFinalAmount = 0.0f;
                float.TryParse(sFinalAmount, out fFinalAmount);

                if (fFinalAmount == 0.0f)
                {
                    connection.Open();

                    OleDbCommand commands = new OleDbCommand();

                    commands.Connection = connection;

                    string q = @"SELECT * FROM NewPettyCash ORDER BY DatePetty DESC";

                    commands.CommandText = q;

                    reader = commands.ExecuteReader();

                    while (reader.Read())
                    {
                        float.TryParse(reader["PettyRunningTotal"].ToString(), out fFinalAmount);

                        break;
                    }

                    connection.Close();
                }

                lbl_remain.Text = "$" + fFinalAmount.ToString("0.00");

                bUpdateOnce = true;
            }
        }
        protected override void InitializeComponent()
        {
            base.InitializeComponent();
            SuspendLayout();
            userControlAnalysisSeries = new UserControlAnalysisSeries
            {
                Dock     = DockStyle.Fill,
                Location = new System.Drawing.Point(3, 3),
                Name     = "userControlAnalysisSeries",
                Size     = new System.Drawing.Size(1301, 809),
                TabIndex = 0
            };
            userControlDiagnosticTestRecord = new UserControlDiagnosticTestRecord
            {
                Dock        = DockStyle.Fill,
                BackColor   = System.Drawing.Color.Transparent,
                Location    = new System.Drawing.Point(3, 3),
                MinimumSize = new System.Drawing.Size(530, 200),
                Name        = "userControlDiagnosticTestRecord",
                Size        = new System.Drawing.Size(1301, 809),
                TabIndex    = 0
            };
            userControlDiagnosticTestRecord.Initialize(new DiagnosticTestRecordService());
            userControlGranuleUX = new UserControlGranuleUX
            {
                BackColor = System.Drawing.Color.Transparent,
                Dock      = DockStyle.Fill,
                Location  = new System.Drawing.Point(0, 0),
                Name      = "userControlGranuleUX",
                Size      = new System.Drawing.Size(659, 809),
                TabIndex  = 0
            };
            userControlGranuleUX.Initialize(new GranuleUXService());
            userControlGranuleFT = new UserControlGranuleFT
            {
                BackColor = System.Drawing.Color.Transparent,
                Dock      = DockStyle.Fill,
                Location  = new System.Drawing.Point(0, 0),
                Name      = "userControlGranuleFT",
                Size      = new System.Drawing.Size(638, 809),
                TabIndex  = 0
            };
            userControlGranuleFT.Initialize(new GranuleFTService());
            userControlGranuleEntropy = new UserControlGranuleEntropy
            {
                BackColor = System.Drawing.Color.Transparent,
                Dock      = DockStyle.Fill,
                Location  = new System.Drawing.Point(0, 0),
                Name      = "userControlGranuleEntropy",
                Size      = new System.Drawing.Size(614, 815),
                TabIndex  = 0
            };
            userControlGranuleEntropy.Initialize(new GranuleEntropyService());
            userControlGranuleFuzzy = new UserControlGranuleFuzzy
            {
                BackColor = System.Drawing.Color.Transparent,
                Dock      = DockStyle.Fill,
                Location  = new System.Drawing.Point(0, 0),
                Name      = "userControlGranuleFuzzy",
                Size      = new System.Drawing.Size(689, 815),
                TabIndex  = 0
            };
            userControlGranuleFuzzy.Initialize(new GranuleFuzzyService());
            splitContainerUXFT = new SplitContainer
            {
                Dock             = DockStyle.Fill,
                Location         = new System.Drawing.Point(3, 3),
                Name             = "splitContainerUXFT",
                Size             = new System.Drawing.Size(1301, 809),
                SplitterDistance = 659,
                TabIndex         = 0
            };
            ((System.ComponentModel.ISupportInitialize)(splitContainerUXFT)).BeginInit();
            splitContainerUXFT.Panel1.SuspendLayout();
            splitContainerUXFT.Panel2.SuspendLayout();
            splitContainerUXFT.SuspendLayout();
            splitContainerUXFT.Panel1.Controls.Add(userControlGranuleUX);
            splitContainerUXFT.Panel2.Controls.Add(userControlGranuleFT);
            splitContainerEF = new SplitContainer
            {
                Dock             = DockStyle.Fill,
                Location         = new System.Drawing.Point(0, 0),
                Name             = "splitContainerEF",
                Size             = new System.Drawing.Size(1307, 815),
                SplitterDistance = 614,
                TabIndex         = 0
            };
            ((System.ComponentModel.ISupportInitialize)(splitContainerEF)).BeginInit();
            splitContainerEF.Panel1.SuspendLayout();
            splitContainerEF.Panel2.SuspendLayout();
            splitContainerEF.SuspendLayout();
            splitContainerEF.Panel1.Controls.Add(userControlGranuleEntropy);
            splitContainerEF.Panel2.Controls.Add(userControlGranuleFuzzy);
            tabPageLoadSeries = new TabPage
            {
                Location = new System.Drawing.Point(4, 22),
                Name     = "tabPageLoadSeries",
                Padding  = new Padding(3),
                Size     = new System.Drawing.Size(1307, 815),
                TabIndex = 4,
                Text     = "Обработка ряда",
                UseVisualStyleBackColor = true
            };
            tabPageLoadSeries.SuspendLayout();
            tabPageLoadSeries.Controls.Add(userControlAnalysisSeries);
            tabPageRecords = new TabPage
            {
                Location = new System.Drawing.Point(4, 22),
                Name     = "tabPageRecords",
                Padding  = new Padding(3),
                Size     = new System.Drawing.Size(1307, 815),
                TabIndex = 7,
                Text     = "Записи",
                UseVisualStyleBackColor = true
            };
            tabPageRecords.SuspendLayout();
            tabPageRecords.Controls.Add(userControlDiagnosticTestRecord);
            tabPageGranuleFTUXs = new TabPage
            {
                Location = new System.Drawing.Point(4, 22),
                Name     = "tabPageGranuleFTUXs",
                Padding  = new Padding(3),
                Size     = new System.Drawing.Size(1307, 815),
                TabIndex = 5,
                Text     = "Гранулы UX/FT",
                UseVisualStyleBackColor = true
            };
            tabPageGranuleFTUXs.SuspendLayout();
            tabPageGranuleFTUXs.Controls.Add(splitContainerUXFT);
            tabPageGranuleEF = new TabPage
            {
                Location = new System.Drawing.Point(4, 22),
                Name     = "tabPageGranuleEF",
                Size     = new System.Drawing.Size(1307, 815),
                TabIndex = 6,
                Text     = "Гранулы E/F",
                UseVisualStyleBackColor = true
            };
            tabPageGranuleEF.SuspendLayout();
            tabPageGranuleEF.Controls.Add(splitContainerEF);
            tabControl = new TabControl
            {
                Dock          = DockStyle.Fill,
                Location      = new System.Drawing.Point(0, 0),
                Name          = "tabControl",
                SelectedIndex = 0,
                Size          = new System.Drawing.Size(1315, 841),
                TabIndex      = 0
            };
            tabControl.SuspendLayout();
            tabControl.Controls.Add(tabPageLoadSeries);
            tabControl.Controls.Add(tabPageRecords);
            tabControl.Controls.Add(tabPageGranuleFTUXs);
            tabControl.Controls.Add(tabPageGranuleEF);

            buttonSave.Visible  = false;
            buttonClose.Visible = false;

            ClientSize = new System.Drawing.Size(1315, 841);
            Controls.Add(tabControl);
            Name = "FormDiagnosticTest";
            Text = "Диагностический тест";
            tabControl.ResumeLayout(false);
            tabPageLoadSeries.ResumeLayout(false);
            tabPageRecords.ResumeLayout(false);
            tabPageGranuleFTUXs.ResumeLayout(false);
            splitContainerUXFT.Panel1.ResumeLayout(false);
            splitContainerUXFT.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(splitContainerUXFT)).EndInit();
            splitContainerUXFT.ResumeLayout(false);
            tabPageGranuleEF.ResumeLayout(false);
            splitContainerEF.Panel1.ResumeLayout(false);
            splitContainerEF.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(splitContainerEF)).EndInit();
            splitContainerEF.ResumeLayout(false);
            ResumeLayout(false);
        }
Exemplo n.º 16
0
        //static Image getImage(string name)
        //{
        //    try
        //    {
        //        return Image.FromResource("Chatterino.Desktop.Assets." + name);
        //    }
        //    catch { }

        //    return null;
        //}

        // CONSTRUCTOR
        public ColumnTabPage()
        {
            AllowDrop = true;

            LayoutPreviewItem = new ColumnLayoutPreviewItem
            {
                Visible = false
            };
            LayoutPreviewItem.SetBounds(25, 25, 100, 100);
            Controls.Add(LayoutPreviewItem);

            // layout on item added/removed/bounds changed
            ColumnAdded += (s, e) =>
            {
                foreach (var w in e.Value.Widgets)
                {
                    Controls.Add(w);

                    //w.MouseUp += W_ButtonReleased;
                }

                layout();

                e.Value.WidgetAdded   += Value_WidgetAdded;
                e.Value.WidgetRemoved += Value_WidgetRemoved;
            };

            ColumnRemoved += (s, e) =>
            {
                foreach (var w in e.Value.Widgets)
                {
                    Controls.Remove(w);

                    //w.MouseUp -= W_ButtonReleased;
                }

                layout();

                e.Value.WidgetAdded   -= Value_WidgetAdded;
                e.Value.WidgetRemoved -= Value_WidgetRemoved;
            };

            SizeChanged += (s, e) =>
            {
                layout();

                Invalidate();
            };

            // Drag drop
            var lastDragPoint = new Point(10000, 10000);

            var dragColumn = -1;
            var dragRow    = -1;

            var MaxColumns = 10;
            var MaxRows    = 10;

            DragEnter += (s, e) =>
            {
                try
                {
                    var control = (ColumnLayoutDragDropContainer)e.Data.GetData(typeof(ColumnLayoutDragDropContainer));

                    if (control != null)
                    {
                        dragging = true;

                        lastDragPoint = new Point(10000, 10000);

                        e.Effect = e.AllowedEffect;
                        LayoutPreviewItem.Visible = true;
                    }
                }
                catch
                {
                }
            };
            DragLeave += (s, e) =>
            {
                if (dragging)
                {
                    dragging = false;
                    LayoutPreviewItem.Visible = false;
                }
            };
            DragDrop += (s, e) =>
            {
                if (dragging)
                {
                    dragging = false;
                    LayoutPreviewItem.Visible = false;

                    var container = (ColumnLayoutDragDropContainer)e.Data.GetData(typeof(ColumnLayoutDragDropContainer));

                    if (container != null /* && dragColumn != -1*/)
                    {
                        var control = container.Control;

                        AddWidget(control, dragColumn, dragRow);

                        //if (dragRow == -1)
                        //{
                        //    InsertColumn(dragColumn, new ChatColumn(control));
                        //}
                        //else
                        //{
                        //    ChatColumn row = Columns.ElementAt(dragColumn);
                        //    row.InsertWidget(dragRow, control);
                        //}
                    }
                }
            };

            DragOver += (s, e) =>
            {
                if (dragging)
                {
                    var mouse = PointToClient(new Point(e.X, e.Y));

                    if (lastDragPoint != mouse)
                    {
                        lastDragPoint = mouse;
                        var totalWidth = Width;

                        if (ColumnCount == 0)
                        {
                            LayoutPreviewItem.Bounds  = new Rectangle(8, 8, Width - 16, Height - 16);
                            LayoutPreviewItem.Visible = true;

                            dragColumn = -1;
                            dragRow    = -1;

                            e.Effect = DragDropEffects.Move;
                            LayoutPreviewItem.IsError = false;
                        }
                        else
                        {
                            var columnWidth = (double)totalWidth / ColumnCount;

                            dragColumn = -1;
                            dragRow    = -1;

                            // insert new column
                            for (var i = (ColumnCount >= MaxColumns ? 1 : 0); i < (ColumnCount >= MaxColumns ? ColumnCount : ColumnCount + 1); i++)
                            {
                                if (mouse.X > i * columnWidth - columnWidth / 4 &&
                                    mouse.X < i * columnWidth + columnWidth / 4)
                                {
                                    dragColumn = i;

                                    var bounds = new Rectangle((int)(i * columnWidth - columnWidth / 4), 0, (int)(columnWidth / 2), Height);

                                    if (LayoutPreviewItem.Bounds != bounds)
                                    {
                                        LayoutPreviewItem.Bounds = bounds;
                                        LayoutPreviewItem.Invalidate();
                                    }
                                    break;
                                }
                            }

                            // insert new row
                            if (dragColumn == -1)
                            {
                                for (var i = 0; i < ColumnCount; i++)
                                {
                                    if (mouse.X < (i + 1) * columnWidth)
                                    {
                                        var rows      = Columns.ElementAt(i);
                                        var rowHeight = (double)Height / rows.WidgetCount;

                                        for (var j = 0; j < rows.WidgetCount + 1; j++)
                                        {
                                            if (mouse.Y > j * rowHeight - rowHeight / 2 &&
                                                mouse.Y < j * rowHeight + rowHeight / 2)
                                            {
                                                if (rows.WidgetCount < MaxRows)
                                                {
                                                    dragColumn = i;
                                                    dragRow    = j;
                                                }

                                                var bounds = new Rectangle((int)(i * columnWidth), (int)(j * rowHeight - rowHeight / 2), (int)columnWidth, (int)(rowHeight));
                                                if (LayoutPreviewItem.Bounds != bounds)
                                                {
                                                    LayoutPreviewItem.Bounds = bounds;
                                                    LayoutPreviewItem.Invalidate();
                                                }
                                            }
                                        }
                                        break;
                                    }
                                }
                            }

                            LayoutPreviewItem.IsError = dragColumn == -1;
                            e.Effect = dragColumn == -1 ? DragDropEffects.None : DragDropEffects.Move;
                        }
                    }
                }
            };

            // Add chat control
            checkAddChatControl();

            addChatControl.Click += (s, e) =>
            {
                var chatControl = new ChatControl();

                using (var dialog = new InputDialogForm("channel name")
                {
                    Value = ""
                })
                {
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        chatControl.ChannelName = dialog.Value;
                    }
                }

                AddColumn(new ChatColumn(chatControl));
            };
        }
Exemplo n.º 17
0
        protected static readonly Vector2 MIDDLE_PART_ORIGIN = -RESERVED_SIZE / 2 + new Vector2(0, 0.17f);//you can use this to put items into right place in the middle

        public MyGuiScreenTrigger(MyTrigger trg, Vector2 size)
            : base(null, MyGuiConstants.SCREEN_BACKGROUND_COLOR, size + RESERVED_SIZE)
        {
            size += RESERVED_SIZE;
            Vector2 m_itemPos = new Vector2();

            m_itemPos.Y   = -size.Y / 2 + 0.1f;
            m_textboxName = new MyGuiControlLabel(
                position: m_itemPos,
                text: MyTexts.Get(MySpaceTexts.GuiTriggerMessage).ToString()
                );
            m_itemPos.Y += m_textboxName.Size.Y + VERTICAL_OFFSET;

            m_trigger        = trg;
            m_textboxMessage = new MyGuiControlTextbox(
                position: m_itemPos,
                defaultText: trg.Message,
                maxLength: 85);
            m_textboxName.Position = m_textboxName.Position - new Vector2(m_textboxMessage.Size.X / 2, 0);//line to the left of textbox
            Controls.Add(m_textboxName);
            Controls.Add(m_textboxMessage);

            //below middle part, position from bottom:
            m_itemPos.Y = Size.Value.Y * 0.5f - 0.3f;
            m_wwwLabel  = new MyGuiControlLabel(
                position: m_itemPos,
                text: MyTexts.Get(MySpaceTexts.GuiTriggerWwwLink).ToString()
                );
            m_itemPos.Y += m_wwwLabel.Size.Y + VERTICAL_OFFSET;
            m_wwwTextbox = new MyGuiControlTextbox(
                position: m_itemPos,
                defaultText: trg.WwwLink,
                maxLength: 300);
            m_itemPos.Y              += m_wwwTextbox.Size.Y + VERTICAL_OFFSET;
            m_wwwLabel.Position       = m_wwwLabel.Position - new Vector2(m_wwwTextbox.Size.X / 2, 0);//line to the left of textbox
            m_wwwTextbox.TextChanged += OnWwwTextChanged;
            Controls.Add(m_wwwLabel);
            Controls.Add(m_wwwTextbox);

            m_nextMisLabel = new MyGuiControlLabel(
                position: m_itemPos,
                text: MyTexts.Get(MySpaceTexts.GuiTriggerNextMission).ToString()
                );
            m_itemPos.Y     += m_wwwLabel.Size.Y + VERTICAL_OFFSET;
            m_nextMisTextbox = new MyGuiControlTextbox(
                position: m_itemPos,
                defaultText: m_trigger.NextMission,
                maxLength: 300);
            m_itemPos.Y            += m_wwwTextbox.Size.Y + VERTICAL_OFFSET;
            m_nextMisLabel.Position = m_nextMisLabel.Position - new Vector2(m_nextMisTextbox.Size.X / 2, 0);//line to the left of textbox
            m_nextMisTextbox.SetToolTip(MySpaceTexts.GuiTriggerNextMissionTooltip);
            Controls.Add(m_nextMisLabel);
            Controls.Add(m_nextMisTextbox);


            Vector2 buttonOrigin = new Vector2(0f, Size.Value.Y * 0.5f - 0.05f);
            Vector2 buttonOffset = new Vector2(0.01f, 0f);

            m_okButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Ok),
                onButtonClick: OnOkButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_okButton.Position = buttonOrigin - buttonOffset;

            m_cancelButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Cancel),
                onButtonClick: OnCancelButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            m_cancelButton.Position = buttonOrigin + buttonOffset;

            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);

            OnWwwTextChanged(m_wwwTextbox);
        }
Exemplo n.º 18
0
        // Return the client id of parent div that contains all other html controls.
        protected string GenerateHtmlInputControls()
        {
            HtmlGenericControl parent = new HtmlGenericControl("div");

            parent.Attributes.Add("class", "ajax__fileupload");
            Controls.Add(parent);

            var inputFileStyle =
                "opacity:0; -moz-opacity: 0.0; filter: alpha(opacity=0);";

            HtmlInputFile inputFile = new HtmlInputFile();

            if (!Enabled)
            {
                inputFile.Disabled = true;
            }
            inputFile.Attributes.Add("id", ClientID + "_Html5InputFile");
            inputFile.Attributes.Add("multiple", "multiple");
            inputFile.Attributes.Add("style", inputFileStyle);
            HideElement(inputFile);

            HtmlInputFile inputFileElement = new HtmlInputFile();

            if (!Enabled)
            {
                inputFileElement.Disabled = true;
            }
            inputFileElement.Attributes.Add("id", ClientID + "_InputFileElement");
            inputFileElement.Attributes.Add("name", "act-file-data");
            inputFileElement.Attributes.Add("style", inputFileStyle);
            HideElement(inputFileElement);

            HtmlGenericControl dropZone = new HtmlGenericControl("div");

            dropZone.Attributes.Add("class", "ajax__fileupload_dropzone");
            dropZone.Attributes.Add("id", ClientID + "_Html5DropZone");
            // IE 10 requested dropzone to be have actual size
            dropZone.Attributes.Add("style", "width:100%; height:60px;");
            HideElement(dropZone);
            parent.Controls.Add(dropZone);

            HtmlGenericControl fileStatusContainer = new HtmlGenericControl("div");

            fileStatusContainer.Attributes.Add("id", ClientID + "_FileStatusContainer");
            fileStatusContainer.Style[HtmlTextWriterStyle.Position] = "absolute";
            fileStatusContainer.Style["right"]       = "0";
            fileStatusContainer.Style["top"]         = "2px";
            fileStatusContainer.Style["height"]      = "20px";
            fileStatusContainer.Style["line-height"] = "20px";
            HideElement(fileStatusContainer);

            var selectFileContainer = GenerateHtmlSelectFileContainer(inputFileElement, inputFile);

            parent.Controls.Add(selectFileContainer);
            parent.Controls.Add(GenerateHtmlTopFileStatus(fileStatusContainer));

            var queueContainer = new HtmlGenericControl("div");

            queueContainer.Attributes.Add("id", ClientID + "_QueueContainer");
            queueContainer.Attributes.Add("class", "ajax__fileupload_queueContainer");
            queueContainer.Style[HtmlTextWriterStyle.MarginTop] = "28px";
            parent.Controls.Add(queueContainer);
            HideElement(queueContainer);

            var progressBar = new HtmlGenericControl("div");

            progressBar.Attributes.Add("id", ClientID + "_ProgressBar");
            progressBar.Attributes.Add("class", "ajax__fileupload_progressBar");
            progressBar.Attributes.Add("style", "width: 100%; display: none; visibility: hidden; overflow:visible;white-space:nowrap; height:20px;");

            var uploadButton = GenerateHtmlFooterContainer(progressBar);

            parent.Controls.Add(uploadButton);
            return(parent.ClientID);
        }
Exemplo n.º 19
0
        protected override void CreateChildControls()
        {
            Control control = Page.LoadControl(_ascxPath);

            Controls.Add(control);
        }
Exemplo n.º 20
0
        public InputBox(string title = "", string labeltext = "", bool isDigits = false)
        {
            StartPosition   = FormStartPosition.CenterScreen;
            MaximizeBox     = false;
            MinimizeBox     = false;
            FormBorderStyle = FormBorderStyle.Fixed3D;
            Size            = new Size(300, 150);
            Text            = title;

            _textBox = new TextBox
            {
                Size     = new Size(250, 25),
                Font     = new Font(DefaultFont, FontStyle.Regular),
                Location = new Point(20, 50),
                Text     = ""
            };

            if (isDigits)
            {
                _textBox.KeyPress += SetOnlyDigits;
            }

            Controls.Add(_textBox);

            _textBox.Show();

            _textBox.KeyPress += textBox_KeyPress;

            var label = new Label
            {
                AutoSize = false,
                Size     = new Size(250, 25)
            };

            label.Font     = new Font(label.Font, FontStyle.Regular);
            label.Location = new Point(20, 25);
            label.Text     = labeltext;

            Controls.Add(label);

            label.Show();

            var buttonOk = new Button
            {
                Size         = new Size(80, 25),
                Location     = new Point(105, 75),
                DialogResult = DialogResult.OK,
                Text         = "OK"
            };

            Controls.Add(buttonOk);

            buttonOk.Show();

            var buttonCancel = new Button
            {
                Size     = new Size(80, 25),
                Location = new Point(190, 75),
                Text     = "Cancel"
            };

            Controls.Add(buttonCancel);

            buttonCancel.Show();

            buttonCancel.Click += buttonCancel_Click;
        }
Exemplo n.º 21
0
        private void InitializeComponent()
        {
            labelComponent        = new Label();
            labelFrom             = new Label();
            labelFromAdditional   = new Label();
            labelDate             = new Label();
            labelTo               = new Label();
            labelToAdditional     = new Label();
            labelRemarks          = new Label();
            textBoxSerialNumber   = new TextBox();
            textBoxPartNumber     = new TextBox();
            textBoxFrom           = new TextBox();
            textBoxFromAdditional = new TextBox();
            textBoxDate           = new TextBox();
            textBoxTo             = new TextBox();
            textBoxToAdditional   = new TextBox();
            textBoxRemarks        = new TextBox();
            fileControl           = new AttachedFileControl()
            {
                Filter       = "Adobe PDF Files|*.pdf",
                Description1 = "This record does not contain a file proving the compliance. Enclose PDF file to prove the compliance.",
                Description2 = "Attached file proves the compliance.",
                Icon         = icons.PDFSmall
            };
            buttonOK        = new Button();
            buttonApply     = new Button();
            buttonCancel    = new Button();
            tabControl      = new TabControl();
            tabPageGeneral  = new TabPage();
            labelSeparator  = new Label();
            labelSeparator2 = new Label();
            labelSeparator3 = new Label();
            labelSeparator4 = new Label();
            //
            // tabControl
            //
            tabControl.Controls.Add(tabPageGeneral);
            tabControl.Location = new Point(Css.WindowsForm.Constants.LEFT_MARGIN, Css.WindowsForm.Constants.TOP_MARGIN);
            //
            // tabPageGeneral
            //
            tabPageGeneral.BackColor = Css.WindowsForm.Colors.TabBackColor;
            tabPageGeneral.Text      = "General";
            tabPageGeneral.Controls.Add(labelComponent);
            tabPageGeneral.Controls.Add(textBoxSerialNumber);
            tabPageGeneral.Controls.Add(textBoxPartNumber);
            tabPageGeneral.Controls.Add(labelDate);
            tabPageGeneral.Controls.Add(textBoxDate);
            tabPageGeneral.Controls.Add(labelSeparator);
            tabPageGeneral.Controls.Add(labelFrom);
            tabPageGeneral.Controls.Add(textBoxFrom);
            tabPageGeneral.Controls.Add(labelFromAdditional);
            tabPageGeneral.Controls.Add(textBoxFromAdditional);
            tabPageGeneral.Controls.Add(labelSeparator2);
            tabPageGeneral.Controls.Add(labelTo);
            tabPageGeneral.Controls.Add(textBoxTo);
            tabPageGeneral.Controls.Add(labelToAdditional);
            tabPageGeneral.Controls.Add(textBoxToAdditional);
            tabPageGeneral.Controls.Add(labelSeparator3);
            tabPageGeneral.Controls.Add(labelRemarks);
            tabPageGeneral.Controls.Add(textBoxRemarks);
            tabPageGeneral.Controls.Add(labelSeparator4);
            tabPageGeneral.Controls.Add(fileControl);
            //
            // labelComponent
            //
            labelComponent.Font      = Css.WindowsForm.Fonts.RegularFont;
            labelComponent.ForeColor = Css.WindowsForm.Colors.ForeColor;
            labelComponent.Location  = new Point(Css.WindowsForm.Constants.TAB_LEFT_MARGIN, Css.WindowsForm.Constants.TAB_TOP_MARGIN);
            labelComponent.Size      = Css.WindowsForm.Constants.DefaultLabelSize;
            labelComponent.Text      = "Component:";
            labelComponent.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxSerialNumber
            //
            textBoxSerialNumber.Font      = Css.WindowsForm.Fonts.RegularFont;
            textBoxSerialNumber.ForeColor = Css.WindowsForm.Colors.ForeColor;
            textBoxSerialNumber.Location  = new Point(labelComponent.Right, Css.WindowsForm.Constants.TAB_TOP_MARGIN);
            textBoxSerialNumber.ReadOnly  = true;
            //
            // textBoxPartNumber
            //
            textBoxPartNumber.Font      = Css.WindowsForm.Fonts.RegularFont;
            textBoxPartNumber.ForeColor = Css.WindowsForm.Colors.ForeColor;
            textBoxPartNumber.Location  = new Point(labelComponent.Right, labelComponent.Bottom + Css.WindowsForm.Constants.HEIGHT_INTERVAL);
            textBoxPartNumber.ReadOnly  = true;
            //
            // labelDate
            //
            labelDate.Font      = Css.WindowsForm.Fonts.RegularFont;
            labelDate.ForeColor = Css.WindowsForm.Colors.ForeColor;
            labelDate.Location  = new Point(Css.WindowsForm.Constants.TAB_LEFT_MARGIN, textBoxPartNumber.Bottom + Css.WindowsForm.Constants.HEIGHT_INTERVAL);
            labelDate.Size      = Css.WindowsForm.Constants.DefaultLabelSize;
            labelDate.Text      = "Date:";
            labelDate.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxDate
            //
            textBoxDate.Font      = Css.WindowsForm.Fonts.RegularFont;
            textBoxDate.ForeColor = Css.WindowsForm.Colors.ForeColor;
            textBoxDate.Location  = new Point(labelDate.Right, textBoxPartNumber.Bottom + Css.WindowsForm.Constants.HEIGHT_INTERVAL);
            textBoxDate.ReadOnly  = true;
            //
            // labelSeparator
            //
            labelSeparator.AutoSize    = false;
            labelSeparator.Location    = new Point(Css.WindowsForm.Constants.TAB_SEPARATOR_LEFT_MARGIN, textBoxDate.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            labelSeparator.Height      = 2;
            labelSeparator.BorderStyle = BorderStyle.Fixed3D;
            //
            // labelFrom
            //
            labelFrom.Font      = Css.WindowsForm.Fonts.RegularFont;
            labelFrom.ForeColor = Css.WindowsForm.Colors.ForeColor;
            labelFrom.Location  = new Point(Css.WindowsForm.Constants.TAB_LEFT_MARGIN, labelSeparator.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            labelFrom.Size      = Css.WindowsForm.Constants.DefaultLabelSize;
            labelFrom.Text      = "From:";
            labelFrom.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxFrom
            //
            textBoxFrom.Font      = Css.WindowsForm.Fonts.RegularFont;
            textBoxFrom.ForeColor = Css.WindowsForm.Colors.ForeColor;
            textBoxFrom.Location  = new Point(labelFrom.Right, labelSeparator.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            textBoxFrom.ReadOnly  = true;
            //
            // labelFromAdditional
            //
            labelFromAdditional.Font      = Css.WindowsForm.Fonts.RegularFont;
            labelFromAdditional.ForeColor = Css.WindowsForm.Colors.ForeColor;
            labelFromAdditional.Location  = new Point(Css.WindowsForm.Constants.TAB_LEFT_MARGIN, textBoxFrom.Bottom + Css.WindowsForm.Constants.HEIGHT_INTERVAL);
            labelFromAdditional.Size      = Css.WindowsForm.Constants.DefaultLabelSize;
            labelFromAdditional.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxFromAdditional
            //
            textBoxFromAdditional.Font      = Css.WindowsForm.Fonts.RegularFont;
            textBoxFromAdditional.ForeColor = Css.WindowsForm.Colors.ForeColor;
            textBoxFromAdditional.Location  = new Point(labelFromAdditional.Right, textBoxFrom.Bottom + Css.WindowsForm.Constants.HEIGHT_INTERVAL);
            textBoxFromAdditional.ReadOnly  = true;
            //
            // labelSeparator2
            //
            labelSeparator2.AutoSize    = false;
            labelSeparator2.Height      = 2;
            labelSeparator2.Location    = new Point(Css.WindowsForm.Constants.TAB_SEPARATOR_LEFT_MARGIN, textBoxFromAdditional.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            labelSeparator2.BorderStyle = BorderStyle.Fixed3D;
            //
            // labelTo
            //
            labelTo.Font      = Css.WindowsForm.Fonts.RegularFont;
            labelTo.ForeColor = Css.WindowsForm.Colors.ForeColor;
            labelTo.Location  = new Point(Css.WindowsForm.Constants.TAB_LEFT_MARGIN, labelSeparator2.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            labelTo.Size      = Css.WindowsForm.Constants.DefaultLabelSize;
            labelTo.Text      = "To:";
            labelTo.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxTo
            //
            textBoxTo.Font      = Css.WindowsForm.Fonts.RegularFont;
            textBoxTo.ForeColor = Css.WindowsForm.Colors.ForeColor;
            textBoxTo.Location  = new Point(labelTo.Right, labelSeparator2.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            textBoxTo.ReadOnly  = true;
            //
            // labelToAdditional
            //
            labelToAdditional.Font      = Css.WindowsForm.Fonts.RegularFont;
            labelToAdditional.ForeColor = Css.WindowsForm.Colors.ForeColor;
            labelToAdditional.Location  = new Point(Css.WindowsForm.Constants.TAB_LEFT_MARGIN, textBoxTo.Bottom + Css.WindowsForm.Constants.HEIGHT_INTERVAL);
            labelToAdditional.Size      = Css.WindowsForm.Constants.DefaultLabelSize;
            labelToAdditional.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxToAdditional
            //
            textBoxToAdditional.Font      = Css.WindowsForm.Fonts.RegularFont;
            textBoxToAdditional.ForeColor = Css.WindowsForm.Colors.ForeColor;
            textBoxToAdditional.Location  = new Point(labelTo.Right, textBoxTo.Bottom + Css.WindowsForm.Constants.HEIGHT_INTERVAL);
            //textBoxToAdditional.ReadOnly = true;
            //
            // labelSeparator3
            //
            labelSeparator3.AutoSize    = false;
            labelSeparator3.Height      = 2;
            labelSeparator3.BorderStyle = BorderStyle.Fixed3D;
            labelSeparator3.Location    = new Point(Css.WindowsForm.Constants.TAB_SEPARATOR_LEFT_MARGIN, textBoxToAdditional.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            //
            // labelRemarks
            //
            labelRemarks.Font      = Css.WindowsForm.Fonts.RegularFont;
            labelRemarks.ForeColor = Css.WindowsForm.Colors.ForeColor;
            labelRemarks.Location  = new Point(Css.WindowsForm.Constants.TAB_LEFT_MARGIN, labelSeparator3.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            labelRemarks.Size      = Css.WindowsForm.Constants.DefaultLabelSize;
            labelRemarks.Text      = "Remarks:";
            labelRemarks.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxRemarks
            //
            textBoxRemarks.Font      = Css.WindowsForm.Fonts.RegularFont;
            textBoxRemarks.ForeColor = Css.WindowsForm.Colors.ForeColor;
            textBoxRemarks.BackColor = Color.White;
            textBoxRemarks.Multiline = true;
            textBoxRemarks.Height    = Css.WindowsForm.Constants.BIG_TEXT_BOX_HEIGHT;
            textBoxRemarks.Location  = new Point(labelRemarks.Right, labelSeparator3.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            //
            // labelSeparator4
            //
            labelSeparator4.AutoSize    = false;
            labelSeparator4.Height      = 2;
            labelSeparator4.BorderStyle = BorderStyle.Fixed3D;
            labelSeparator4.Location    = new Point(Css.WindowsForm.Constants.TAB_SEPARATOR_LEFT_MARGIN, textBoxRemarks.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            //
            // fileControl
            //
            fileControl.Location = new Point(Css.WindowsForm.Constants.TAB_LEFT_MARGIN, labelSeparator4.Bottom + Css.WindowsForm.Constants.SEPARATOR_INTERVAL);
            //
            // buttonOK
            //
            buttonOK.Font      = Css.WindowsForm.Fonts.RegularFont;
            buttonOK.ForeColor = Css.WindowsForm.Colors.ForeColor;
            buttonOK.Size      = new Size(Css.WindowsForm.Constants.BUTTON_WIDTH, Css.WindowsForm.Constants.BUTTON_HEIGHT);
            buttonOK.Text      = "OK";
            buttonOK.Click    += ButtonOkClick;
            //
            // buttonApply
            //
            buttonApply.Font      = Css.WindowsForm.Fonts.RegularFont;
            buttonApply.ForeColor = Css.WindowsForm.Colors.ForeColor;
            buttonApply.Size      = new Size(Css.WindowsForm.Constants.BUTTON_WIDTH, Css.WindowsForm.Constants.BUTTON_HEIGHT);
            buttonApply.Text      = "Apply";
            buttonApply.Click    += ButtonApplyClick;
            //
            // buttonCancel
            //
            buttonCancel.Font      = Css.WindowsForm.Fonts.RegularFont;
            buttonCancel.ForeColor = Css.WindowsForm.Colors.ForeColor;
            buttonCancel.Size      = new Size(Css.WindowsForm.Constants.BUTTON_WIDTH, Css.WindowsForm.Constants.BUTTON_HEIGHT);
            buttonCancel.Text      = "Cancel";
            buttonCancel.Click    += ButtonCancelClick;

            Text            = "SN " + _currentComponent.SerialNumber + ". Transfer record";
            AcceptButton    = buttonOK;
            CancelButton    = buttonCancel;
            FormBorderStyle = FormBorderStyle.FixedDialog;
            MaximizeBox     = false;
            MinimizeBox     = false;
            ClientSize      = Css.WindowsForm.Constants.DefaultFormSize;
            StartPosition   = FormStartPosition.CenterScreen;
            Controls.Add(tabControl);
            Controls.Add(buttonOK);
            Controls.Add(buttonApply);
            Controls.Add(buttonCancel);
        }
Exemplo n.º 22
0
        public PassForm()
        {
            Dictionary <int, string> dictUK = new Dictionary <int, string>();

            dictUK.Add(1, "Petrov");
            dictUK.Add(2, "Ivanov");
            dictUK.Add(3, "Sidorov");
            int PF = 300;
            //InitializeComponent();
            var title = new Label()
            {
                Dock = DockStyle.Fill,
                Text = "Пропуск"
            };



            var labeltext = new Label()
            {
                Dock = DockStyle.Fill,
                Text = "Введите фамилию"
            };


            var lastname = new TextBox()
            {
                Dock = DockStyle.Fill
            };


            var receipt = new Button()
            {
                Dock = DockStyle.Fill,
                Text = "Получить"
            };

            var back = new Button()
            {
                Dock = DockStyle.Fill,
                Text = "Назад"
            };
            var table = new TableLayoutPanel();

            table.RowStyles.Clear();
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 100));
            table.Dock = DockStyle.Fill;

            table.Controls.Add(title, 0, 0);
            table.Controls.Add(labeltext, 0, 1);
            table.Controls.Add(lastname, 0, 2);
            table.Controls.Add(receipt, 0, 3);
            table.Controls.Add(back, 0, 4);
            Controls.Add(table);

            //receipt.Click += new EventHandler(this.Receipt_Click);
            back.Click += new EventHandler(this.Back_Click);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();

            this.groupPlugin     = new System.Windows.Forms.GroupBox();
            this.panelPlugin     = new System.Windows.Forms.Panel();
            this.groupPluginInfo = new System.Windows.Forms.GroupBox();
            this.linkPluginURL   = new System.Windows.Forms.LinkLabel();
            this.lblPluginInfo   = new System.Windows.Forms.Label();
            this.lstPlugins      = new System.Windows.Forms.ListBox();

            this.groupPlugin.SuspendLayout();
            this.groupPluginInfo.SuspendLayout();

            //
            // groupPlugin
            //
            this.groupPlugin.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                             | System.Windows.Forms.AnchorStyles.Left)
                                                                            | System.Windows.Forms.AnchorStyles.Right)));
            this.groupPlugin.Controls.Add(this.panelPlugin);
            this.groupPlugin.Controls.Add(this.groupPluginInfo);
            this.groupPlugin.Location = new System.Drawing.Point(128, 16);
            this.groupPlugin.Name     = "groupPlugin";
            this.groupPlugin.Size     = new System.Drawing.Size(616, 485);
            this.groupPlugin.TabIndex = 2;
            this.groupPlugin.TabStop  = false;

            //
            // panelPlugin
            //
            this.panelPlugin.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                             | System.Windows.Forms.AnchorStyles.Left)
                                                                            | System.Windows.Forms.AnchorStyles.Right)));
            this.panelPlugin.Location = new System.Drawing.Point(8, 64);
            this.panelPlugin.Name     = "panelPlugin";
            this.panelPlugin.Size     = new System.Drawing.Size(600, 413);
            this.panelPlugin.TabIndex = 1;
            //
            // groupPluginInfo
            //
            this.groupPluginInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                                | System.Windows.Forms.AnchorStyles.Right)));
            this.groupPluginInfo.BackColor = System.Drawing.SystemColors.Control;
            this.groupPluginInfo.Controls.Add(this.linkPluginURL);
            this.groupPluginInfo.Controls.Add(this.lblPluginInfo);
            this.groupPluginInfo.Location = new System.Drawing.Point(8, 8);
            this.groupPluginInfo.Name     = "groupPluginInfo";
            this.groupPluginInfo.Size     = new System.Drawing.Size(600, 48);
            this.groupPluginInfo.TabIndex = 0;
            this.groupPluginInfo.TabStop  = false;
            //
            // linkPluginURL
            //
            this.linkPluginURL.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.linkPluginURL.Location     = new System.Drawing.Point(424, 16);
            this.linkPluginURL.Name         = "linkPluginURL";
            this.linkPluginURL.Size         = new System.Drawing.Size(160, 23);
            this.linkPluginURL.TabIndex     = 1;
            this.linkPluginURL.TextAlign    = System.Drawing.ContentAlignment.MiddleRight;
            this.linkPluginURL.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkPluginURL_LinkClicked);
            //
            // lblPluginInfo
            //
            this.lblPluginInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                              | System.Windows.Forms.AnchorStyles.Right)));
            this.lblPluginInfo.Location  = new System.Drawing.Point(8, 16);
            this.lblPluginInfo.Name      = "lblPluginInfo";
            this.lblPluginInfo.Size      = new System.Drawing.Size(408, 24);
            this.lblPluginInfo.TabIndex  = 0;
            this.lblPluginInfo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // lstPlugins
            //
            this.lstPlugins.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                           | System.Windows.Forms.AnchorStyles.Left)));
            this.lstPlugins.Location              = new System.Drawing.Point(8, 16);
            this.lstPlugins.Name                  = "lstPlugins";
            this.lstPlugins.Size                  = new System.Drawing.Size(112, 485);
            this.lstPlugins.TabIndex              = 1;
            this.lstPlugins.SelectedIndexChanged += new System.EventHandler(this.lstPlugins_SelectedIndexChanged);

            Controls.Add(this.groupPlugin);
            Controls.Add(this.lstPlugins);
        }
Exemplo n.º 24
0
        protected override void CreateChildControls()
        {
            Controls.Clear();
            bindDropDownLists();

            #region Child Controls for General Folder

            tbName.EnableViewState = false;
            Controls.Add(tbName);

            tbOrderNum.ID = this.ID + "_OrderNum";
            tbOrderNum.EnableViewState = false;
            Controls.Add(tbOrderNum);
            revOrderNum.ControlToValidate    = tbOrderNum.ID;
            revOrderNum.ValidationExpression = "^(\\+|-)?\\d+$";
            revOrderNum.ErrorMessage         = "*";
            revOrderNum.Display         = ValidatorDisplay.Dynamic;
            revOrderNum.EnableViewState = false;
            Controls.Add(revOrderNum);

            #endregion

            #region Child Controls for Flags Folder

            cbIsEligible.EnableViewState = false;
            Controls.Add(cbIsEligible);

            cbIsPassed.EnableViewState = false;
            Controls.Add(cbIsPassed);

            cbIsFailed.EnableViewState = false;
            Controls.Add(cbIsFailed);

            cbIsFiled.EnableViewState = false;
            Controls.Add(cbIsFiled);

            cbIsApproved.EnableViewState = false;
            Controls.Add(cbIsApproved);

            cbIsAwarded.EnableViewState = false;
            Controls.Add(cbIsAwarded);

            #endregion

            btOk.Text            = "OK";
            btOk.Width           = Unit.Pixel(72);
            btOk.EnableViewState = false;
            btOk.Click          += new EventHandler(ok_Click);
            Controls.Add(btOk);

            btCancel.Text             = "Cancel";
            btCancel.Width            = Unit.Pixel(72);
            btCancel.EnableViewState  = false;
            btCancel.CausesValidation = false;
            btCancel.Click           += new EventHandler(cancel_Click);
            Controls.Add(btCancel);

            btDelete.Text            = "Delete";
            btDelete.Width           = Unit.Pixel(72);
            btDelete.EnableViewState = false;
            btDelete.Click          += new EventHandler(delete_Click);
            Controls.Add(btDelete);

            ChildControlsCreated = true;
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            AddCaption("Color picker");



            m_hueSlider = new MyGuiControlSlider(
                position: new Vector2(x / 1600f, (y + 50) / 1200f),
                width: 0.25f,
                minValue: 0,
                maxValue: 360,
                labelText: String.Empty,
                labelDecimalPlaces: 0,
                labelSpaceWidth: 50 / 1200f,
                intValue: true,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                visualStyle: MyGuiControlSliderStyleEnum.Hue
                );
            m_saturationSlider = new MyGuiControlSlider(
                position: new Vector2(x / 1600f, (y + 150) / 1200f),
                width: 0.25f,
                minValue: -100,
                maxValue: 100,
                defaultValue: 0,
                labelText: String.Empty,
                labelDecimalPlaces: 0,
                labelSpaceWidth: 50 / 1200f,
                intValue: true,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
                );
            m_valueSlider = new MyGuiControlSlider(
                position: new Vector2(x / 1600f, (y + 250) / 1200f),
                width: 0.25f,
                minValue: -100,
                maxValue: 100,
                defaultValue: 0,
                labelText: String.Empty,
                labelDecimalPlaces: 0,
                labelSpaceWidth: 50 / 1200f,
                intValue: true,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
                );

            m_hueSlider.ValueChanged        += OnValueChange;
            m_saturationSlider.ValueChanged += OnValueChange;
            m_valueSlider.ValueChanged      += OnValueChange;

            m_hueLabel        = new MyGuiControlLabel(position: new Vector2(100 / 1600f, y / 1200f), text: String.Empty, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_saturationLabel = new MyGuiControlLabel(position: new Vector2(100 / 1600f, (y + 100) / 1200f), text: String.Empty, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_valueLabel      = new MyGuiControlLabel(position: new Vector2(100 / 1600f, (y + 200) / 1200f), text: String.Empty, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);



            Controls.Add(new MyGuiControlLabel(position: new Vector2(x / 1600f, y / 1200f), text: "Hue:", originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_hueLabel);
            Controls.Add(m_hueSlider);
            Controls.Add(new MyGuiControlLabel(position: new Vector2(x / 1600f, (y + 100) / 1200f), text: "Saturation:", originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_saturationLabel);
            Controls.Add(m_saturationSlider);
            Controls.Add(new MyGuiControlLabel(position: new Vector2(x / 1600f, (y + 200) / 1200f), text: "Value:", originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            Controls.Add(m_valueLabel);
            Controls.Add(m_valueSlider);
            Controls.Add(new MyGuiControlButton(
                             size: new Vector2(100f, 0.1f),
                             position: new Vector2(0 / 1600f, (y + 285 + (MyPlayer.BuildColorSlotCount / 7 + 1) * 36) / 1200f),
                             text: new StringBuilder("Defaults"),
                             onButtonClick: OnDefaultsClick));
            Controls.Add(new MyGuiControlButton(
                             size: new Vector2(100f, 0.1f),
                             position: new Vector2(0 / 1600f, (y + 360 + (MyPlayer.BuildColorSlotCount / 7 + 1) * 36) / 1200f),
                             text: new StringBuilder("OK"),
                             onButtonClick: OnOkClick));
            Controls.Add(new MyGuiControlButton(
                             position: new Vector2(0 / 1600f, (y + 435 + (MyPlayer.BuildColorSlotCount / 7 + 1) * 36) / 1200f),
                             text: new StringBuilder("Cancel"),
                             onButtonClick: OnCancelClick));

            Color c = Color.White;
            int   j = 0;

            m_highlightControlPanel = new MyGuiControlPanel(
                size: new Vector2(0.03f, 0.03f),
                position: new Vector2(((x + defColCol) / 1600f) + (MyPlayer.SelectedColorSlot % 7) * 0.03f, (y + defColLine) / 1200f + (MyPlayer.SelectedColorSlot / 7) * 0.03f));
            m_highlightControlPanel.ColorMask         = c.ToVector4();
            m_highlightControlPanel.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;
            Controls.Add(m_highlightControlPanel);
            int tmpx = MyPlayer.BuildColorSlotCount;

            for (int i = 0; i < MyPlayer.BuildColorSlotCount;)
            {
                MyGuiControlPanel tmpPanel = new MyGuiControlPanel(
                    size: new Vector2(0.025f, 0.025f),
                    position: new Vector2(((x + defColCol) / 1600f) + (i % 7) * 0.03f, (y + defColLine) / 1200f + j * 0.03f));
                tmpPanel.ColorMask         = (prev(MyPlayer.ColorSlots.ItemAt(i))).HSVtoColor().ToVector4();
                tmpPanel.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;
                m_colorPaletteControlsList.Add(tmpPanel);
                Controls.Add(tmpPanel);
                i++;
                if (i % 7 == 0)
                {
                    j++;
                }
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Reads in a puzzle file and error checks for a valid input file.
        /// </summary>
        private void ReadPuzzleFile()
        {
            if (ux_OpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (_PuzzleGrid == null)
                {
                    int[,] tempPuzzleGrid = new int[5, 5];
                    using (StreamReader inFile = new StreamReader(ux_OpenFileDialog.FileName))
                    {
                        int rowIndex = 0;
                        while (!inFile.EndOfStream)
                        {
                            string[] nums = inFile.ReadLine().Split(' ');

                            if (nums.Length != 5)
                            {
                                throw new Exception();
                            }

                            for (int i = 0; i < nums.Length; i++)
                            {
                                if (Convert.ToInt32(nums[i]) < 1 || Convert.ToInt32(nums[i]) > 5)
                                {
                                    throw new Exception();
                                }
                            }

                            for (int i = 0; i < nums.Length; i++)
                            {
                                tempPuzzleGrid[rowIndex, i] = Convert.ToInt32(nums[i]);
                            }
                            rowIndex++;
                        }
                    }

                    int xLocation = 130;
                    int yLocation = 80;

                    _PuzzleGrid = new PuzzleCell[5, 5];

                    for (int r = 0; r < tempPuzzleGrid.GetLength(0); r++)
                    {
                        for (int c = 0; c < tempPuzzleGrid.GetLength(1); c++)
                        {
                            PuzzleCell tempPC = new PuzzleCell(tempPuzzleGrid[r, c], r, c);
                            _PuzzleGrid[r, c] = tempPC;
                            tempPC.Text       = tempPC.Number.ToString();
                            tempPC.Location   = new Point(xLocation, yLocation);
                            tempPC.Size       = new Size(30, 30);
                            tempPC.BackColor  = Color.White;
                            Controls.Add(tempPC);
                            tempPC.Click += new EventHandler(ux_PuzzleCell_Click);
                            xLocation    += 35;
                        }
                        xLocation  = 130;
                        yLocation += 35;
                    }
                }
                else
                {
                    for (int r = 0; r < _PuzzleGrid.GetLength(0); r++)
                    {
                        for (int c = 0; c < _PuzzleGrid.GetLength(1); c++)
                        {
                            Controls.Remove(_PuzzleGrid[r, c]);
                        }
                    }
                    int[,] tempPuzzleGrid = new int[5, 5];
                    using (StreamReader inFile = new StreamReader(ux_OpenFileDialog.FileName))
                    {
                        int rowIndex = 0;
                        while (!inFile.EndOfStream)
                        {
                            string[] nums = inFile.ReadLine().Split(' ');

                            if (nums.Length != 5)
                            {
                                throw new Exception();
                            }

                            for (int i = 0; i < nums.Length; i++)
                            {
                                if (Convert.ToInt32(nums[i]) < 1 || Convert.ToInt32(nums[i]) > 5)
                                {
                                    throw new Exception();
                                }
                            }

                            for (int i = 0; i < nums.Length; i++)
                            {
                                tempPuzzleGrid[rowIndex, i] = Convert.ToInt32(nums[i]);
                            }
                            rowIndex++;
                        }
                    }

                    int xLocation = 130;
                    int yLocation = 80;

                    _PuzzleGrid = new PuzzleCell[5, 5];

                    for (int r = 0; r < tempPuzzleGrid.GetLength(0); r++)
                    {
                        for (int c = 0; c < tempPuzzleGrid.GetLength(1); c++)
                        {
                            PuzzleCell tempPC = new PuzzleCell(tempPuzzleGrid[r, c], r, c);
                            _PuzzleGrid[r, c] = tempPC;
                            tempPC.Text       = tempPC.Number.ToString();
                            tempPC.Location   = new Point(xLocation, yLocation);
                            tempPC.Size       = new Size(30, 30);
                            tempPC.BackColor  = Color.White;
                            Controls.Add(tempPC);
                            tempPC.Click += new EventHandler(ux_PuzzleCell_Click);
                            xLocation    += 35;
                        }
                        xLocation  = 130;
                        yLocation += 35;
                    }
                }
            }
        }
Exemplo n.º 27
0
        public FormBrowser()
        {
            InitializeComponent();

            Text = Program.BrandName;

            this.plugins           = new PluginManager(Program.Config.Plugins, Program.PluginPath);
            this.plugins.Reloaded += plugins_Reloaded;
            this.plugins.Executed += plugins_Executed;
            this.plugins.Reload();

            this.notification = new FormNotificationTweet(this, plugins);
            this.notification.Show();

            this.updates = new UpdateHandler(Program.InstallerPath);
            this.updates.CheckFinished += updates_CheckFinished;

            this.updateBridge = new UpdateBridge(updates, this);
            this.updateBridge.UpdateAccepted  += updateBridge_UpdateAccepted;
            this.updateBridge.UpdateDelayed   += updateBridge_UpdateDelayed;
            this.updateBridge.UpdateDismissed += updateBridge_UpdateDismissed;

            this.browser     = new TweetDeckBrowser(this, plugins, new TweetDeckBridge.Browser(this, notification), updateBridge);
            this.contextMenu = ContextMenuBrowser.CreateMenu(this);

            Controls.Add(new MenuStrip {
                Visible = false
            });                                             // fixes Alt freezing the program in Win 10 Anniversary Update

            Disposed += (sender, args) => {
                Config.MuteToggled         -= Config_MuteToggled;
                Config.TrayBehaviorChanged -= Config_TrayBehaviorChanged;

                browser.Dispose();
                updates.Dispose();
                contextMenu.Dispose();

                notificationScreenshotManager?.Dispose();
                videoPlayer?.Dispose();
                analytics?.Dispose();
            };

            Config.MuteToggled += Config_MuteToggled;

            this.trayIcon.ClickRestore += trayIcon_ClickRestore;
            this.trayIcon.ClickClose   += trayIcon_ClickClose;
            Config.TrayBehaviorChanged += Config_TrayBehaviorChanged;

            UpdateTray();

            if (Config.MuteNotifications)
            {
                UpdateFormIcon();
            }

            if (Config.AllowDataCollection)
            {
                analytics = new AnalyticsManager(this, plugins, Program.AnalyticsFilePath);
            }

            RestoreWindow();
        }
Exemplo n.º 28
0
    private void InitializeComponent()
    {
        splitContainer1 = new System.Windows.Forms.SplitContainer();
        treeView1       = new System.Windows.Forms.TreeView();
        splitContainer2 = new System.Windows.Forms.SplitContainer();
        listView1       = new System.Windows.Forms.ListView();
        listView2       = new System.Windows.Forms.ListView();
        splitContainer1.SuspendLayout();
        splitContainer2.SuspendLayout();
        SuspendLayout();

        // <snippet2>
        // Basic SplitContainer properties.
        // This is a vertical splitter that moves in 10-pixel increments.
        // This splitter needs no explicit Orientation property because Vertical is the default.
        splitContainer1.Dock      = System.Windows.Forms.DockStyle.Fill;
        splitContainer1.ForeColor = System.Drawing.SystemColors.Control;
        splitContainer1.Location  = new System.Drawing.Point(0, 0);
        splitContainer1.Name      = "splitContainer1";
        // You can drag the splitter no nearer than 30 pixels from the left edge of the container.
        splitContainer1.Panel1MinSize = 30;
        // You can drag the splitter no nearer than 20 pixels from the right edge of the container.
        splitContainer1.Panel2MinSize    = 20;
        splitContainer1.Size             = new System.Drawing.Size(292, 273);
        splitContainer1.SplitterDistance = 79;
        // This splitter moves in 10-pixel increments.
        splitContainer1.SplitterIncrement = 10;
        splitContainer1.SplitterWidth     = 6;
        // splitContainer1 is the first control in the tab order.
        splitContainer1.TabIndex = 0;
        splitContainer1.Text     = "splitContainer1";
        // When the splitter moves, the cursor changes shape.
        splitContainer1.SplitterMoved  += new System.Windows.Forms.SplitterEventHandler(splitContainer1_SplitterMoved);
        splitContainer1.SplitterMoving += new System.Windows.Forms.SplitterCancelEventHandler(splitContainer1_SplitterMoving);

        // Add a TreeView control to the left panel.
        splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.Control;
        // Add a TreeView control to Panel1.
        splitContainer1.Panel1.Controls.Add(treeView1);
        splitContainer1.Panel1.Name = "splitterPanel1";
        // Controls placed on Panel1 support right-to-left fonts.
        splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;

        // </snippet2>

        // Add a SplitContainer to the right panel.
        splitContainer1.Panel2.Controls.Add(splitContainer2);
        splitContainer1.Panel2.Name = "splitterPanel2";

        // This TreeView control is in Panel1 of splitContainer1.
        treeView1.Dock               = System.Windows.Forms.DockStyle.Fill;
        treeView1.ForeColor          = System.Drawing.SystemColors.InfoText;
        treeView1.ImageIndex         = -1;
        treeView1.Location           = new System.Drawing.Point(0, 0);
        treeView1.Name               = "treeView1";
        treeView1.SelectedImageIndex = -1;
        treeView1.Size               = new System.Drawing.Size(79, 273);
        // treeView1 is the second control in the tab order.
        treeView1.TabIndex = 1;

        // <snippet3>
        // Basic SplitContainer properties.
        // This is a horizontal splitter whose top and bottom panels are ListView controls. The top panel is fixed.
        splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
        // The top panel remains the same size when the form is resized.
        splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
        splitContainer2.Location   = new System.Drawing.Point(0, 0);
        splitContainer2.Name       = "splitContainer2";
        // Create the horizontal splitter.
        splitContainer2.Orientation      = System.Windows.Forms.Orientation.Horizontal;
        splitContainer2.Size             = new System.Drawing.Size(207, 273);
        splitContainer2.SplitterDistance = 125;
        splitContainer2.SplitterWidth    = 6;
        // splitContainer2 is the third control in the tab order.
        splitContainer2.TabIndex = 2;
        splitContainer2.Text     = "splitContainer2";
        // </snippet3>

        // This splitter panel contains the top ListView control.
        splitContainer2.Panel1.Controls.Add(listView1);
        splitContainer2.Panel1.Name = "splitterPanel3";

        // This splitter panel contains the bottom ListView control.
        splitContainer2.Panel2.Controls.Add(listView2);
        splitContainer2.Panel2.Name = "splitterPanel4";

        // This ListView control is in the top panel of splitContainer2.
        listView1.Dock     = System.Windows.Forms.DockStyle.Fill;
        listView1.Location = new System.Drawing.Point(0, 0);
        listView1.Name     = "listView1";
        listView1.Size     = new System.Drawing.Size(207, 125);
        // listView1 is the fourth control in the tab order.
        listView1.TabIndex = 3;

        // This ListView control is in the bottom panel of splitContainer2.
        listView2.Dock     = System.Windows.Forms.DockStyle.Fill;
        listView2.Location = new System.Drawing.Point(0, 0);
        listView2.Name     = "listView2";
        listView2.Size     = new System.Drawing.Size(207, 142);
        // listView2 is the fifth control in the tab order.
        listView2.TabIndex = 4;

        // These are basic properties of the form.
        ClientSize = new System.Drawing.Size(292, 273);
        Controls.Add(splitContainer1);
        Name = "Form1";
        Text = "Form1";
        splitContainer1.ResumeLayout(false);
        splitContainer2.ResumeLayout(false);
        ResumeLayout(false);
    }
Exemplo n.º 29
0
        public IPAddressControl()
        {
            BackColor = SystemColors.Window;

            ResetBackColorChanged();

            for (int index = 0; index < _fieldControls.Length; ++index)
            {
                _fieldControls[index] = new FieldControl();

                _fieldControls[index].CreateControl();

                _fieldControls[index].FieldIndex = index;
                _fieldControls[index].Name       = "FieldControl" + index.ToString(CultureInfo.InvariantCulture);
                _fieldControls[index].Parent     = this;

                _fieldControls[index].CedeFocusEvent   += new EventHandler <CedeFocusEventArgs>(OnCedeFocus);
                _fieldControls[index].Click            += new EventHandler(OnSubControlClicked);
                _fieldControls[index].DoubleClick      += new EventHandler(OnSubControlDoubleClicked);
                _fieldControls[index].GotFocus         += new EventHandler(OnFieldGotFocus);
                _fieldControls[index].KeyDown          += new KeyEventHandler(OnFieldKeyDown);
                _fieldControls[index].KeyPress         += new KeyPressEventHandler(OnFieldKeyPressed);
                _fieldControls[index].KeyUp            += new KeyEventHandler(OnFieldKeyUp);
                _fieldControls[index].LostFocus        += new EventHandler(OnFieldLostFocus);
                _fieldControls[index].MouseClick       += new MouseEventHandler(OnSubControlMouseClicked);
                _fieldControls[index].MouseDoubleClick += new MouseEventHandler(OnSubControlMouseDoubleClicked);
                _fieldControls[index].MouseEnter       += new EventHandler(OnSubControlMouseEntered);
                _fieldControls[index].MouseHover       += new EventHandler(OnSubControlMouseHovered);
                _fieldControls[index].MouseLeave       += new EventHandler(OnSubControlMouseLeft);
                _fieldControls[index].MouseMove        += new MouseEventHandler(OnSubControlMouseMoved);
                _fieldControls[index].PreviewKeyDown   += new PreviewKeyDownEventHandler(OnFieldPreviewKeyDown);
                _fieldControls[index].TextChangedEvent += new EventHandler <TextChangedEventArgs>(OnFieldTextChanged);

                Controls.Add(_fieldControls[index]);

                if (index < (FieldCount - 1))
                {
                    _dotControls[index] = new DotControl();

                    _dotControls[index].CreateControl();

                    _dotControls[index].Name   = "DotControl" + index.ToString(CultureInfo.InvariantCulture);
                    _dotControls[index].Parent = this;

                    _dotControls[index].Click            += new EventHandler(OnSubControlClicked);
                    _dotControls[index].DoubleClick      += new EventHandler(OnSubControlDoubleClicked);
                    _dotControls[index].MouseClick       += new MouseEventHandler(OnSubControlMouseClicked);
                    _dotControls[index].MouseDoubleClick += new MouseEventHandler(OnSubControlMouseDoubleClicked);
                    _dotControls[index].MouseEnter       += new EventHandler(OnSubControlMouseEntered);
                    _dotControls[index].MouseHover       += new EventHandler(OnSubControlMouseHovered);
                    _dotControls[index].MouseLeave       += new EventHandler(OnSubControlMouseLeft);
                    _dotControls[index].MouseMove        += new MouseEventHandler(OnSubControlMouseMoved);

                    Controls.Add(_dotControls[index]);
                }
            }

            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.ContainerControl, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.FixedWidth, true);
            SetStyle(ControlStyles.FixedHeight, true);

            _referenceTextBox.AutoSize = true;

            Cursor = Cursors.IBeam;

            AutoScaleDimensions = new SizeF(96F, 96F);
            AutoScaleMode       = AutoScaleMode.Dpi;

            Size = MinimumSize;

            DragEnter += new DragEventHandler(IPAddressControl_DragEnter);
            DragDrop  += new DragEventHandler(IPAddressControl_DragDrop);
        }
Exemplo n.º 30
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="view"></param>
 /// <param name="control"></param>
 public AddControlCommand(GUIView view, GUIControl parent, GUIControl control)
 {
     mView   = view;
     mParent = parent;
     Controls.Add(control);
 }