Exemplo n.º 1
0
        private void updateWireView()
        {
            //Stack overflow here to save the day again! I really did not want to
            //manually iterate over each item, it takes up a bunch of lines and looks bad.
            //I had to in the button status method :\
            lblCutNumber.Text = "Don\'t cut yet, I\'m not done thinking!";
            List <String> currWires = wireList.getWires();
            TableLayoutControlCollection controls = tlpCurrentWires.Controls;
            int visibleWires = wireList.getLength();

            foreach (Control ctrl in tlpCurrentWires.Controls)
            {
                if (ctrl is Label)
                {
                    ctrl.Visible = false;
                }
            }
            for (int i = 0; i < visibleWires; ++i)
            {
                if (controls[i] is Label)
                {
                    controls[i].ForeColor = Color.FromName(currWires[i]);
                    controls[i].Visible   = true;
                }
            }
        }
Exemplo n.º 2
0
 private void SetVisible(TableLayoutControlCollection CtrCollection, bool isV)
 {
     foreach (Control ctz in CtrCollection)
     {
         ctz.Visible = isV;
     }
 }
        protected override void AssignImages()
        {
            TableLayoutControlCollection controls = tableLayoutPanel1.Controls;
            int offset      = 0;
            int columnCount = textLabels.Length * 2 - 1;

            foreach (Label control in controls.OfType <Label>())
            {
                if (offset == 0)
                {
                    control.Image = (Progress > 0) ? images[1] : images[0];
                }
                else if (offset == columnCount)
                {
                    control.Image = (Progress >= offset) ? images[7] : images[6];
                }
                else
                {
                    control.Image = (offset % 2 == 1)
                  ? ((Progress > offset) ? images[3] : images[2])
                  : ((Progress > offset) ? images[5] : images[4]);
                }
                offset++;
                if (offset > columnCount)
                {
                    break;
                }
            }
        }
        private void buttonBinaryUpdate_Click(object sender, EventArgs e)
        {
            TableLayoutControlCollection tableLayoutCtrlColl = this.tableLayoutPanel.Controls;

            System.Windows.Forms.Control labelBinaryName = tableLayoutCtrlColl[this.labelBinaryName.Name];
            System.Windows.Forms.Control labelLatestVer  = tableLayoutCtrlColl[this.labelBinaryLatestVer.Name];
            System.Windows.Forms.Control labelCurVer     = tableLayoutCtrlColl[this.labelBinaryYourVer.Name];
            string binaryName     = labelBinaryName.Text;
            string currentVersion = labelCurVer.Text;

            if (DialogResult.Yes == MessageBox.Show((IWin32Window)sender, string.Format("Are you sure you want to add {0} {1} with version {2} to the repository?",
                                                                                        this.binaryType, binaryName, currentVersion), "Update Repository", MessageBoxButtons.YesNo,
                                                    MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2))
            {
                string[] filePaths = new string[0];
                bool     success   = BinaryPackagerHelper.Package(this.binaryRootDir, binaryName, false /*singleBin*/, "dll",
                                                                  this.binaryType, this.repositoryDir, ref filePaths, this.logger);
                if (!success)
                {
                    logger.Error("Failed to create {0} update packages", this.binaryType);
                }
                List <MainForm.BinaryPackageItem> binaryPackageItemList = new List <MainForm.BinaryPackageItem>();
                binaryPackageItemList.Add(new MainForm.BinaryPackageItem(this.binaryType, filePaths));
                UpdateRepositoryBinaries(binaryPackageItemList);
            }
        }
Exemplo n.º 5
0
        public void TableLayoutControlCollection_Add_NullContainer_ThrowsNullReferenceExceptio()
        {
            var collection = new TableLayoutControlCollection(null);
            var control    = new Control();

            Assert.Throws <NullReferenceException>(() => collection.Add(control, -2, 2));
        }
Exemplo n.º 6
0
        private void button8_Click(object sender, EventArgs e)
        {
            //new Form10().Show();
            //this.Hide();
            button2.BackColor = Color.FromArgb(255, 107, 107);
            button2.ForeColor = SystemColors.ControlLightLight;

            button8.BackColor = SystemColors.Control;
            button8.ForeColor = SystemColors.ControlText;


            button3.BackColor = Color.FromArgb(255, 107, 107);
            button3.ForeColor = SystemColors.ControlLightLight;
            button7.BackColor = Color.FromArgb(255, 107, 107);
            button7.ForeColor = SystemColors.ControlLightLight;

            button4.BackColor = Color.FromArgb(255, 107, 107);
            button1.BackColor = Color.FromArgb(255, 107, 107);
            panel1.BackColor  = Color.FromArgb(255, 107, 107);

            button7.Font = new Font("MS Sans Serif", 12);
            button2.Font = new Font("MS Sans Serif", 12);
            button3.Font = new Font("MS Sans Serif", 12);
            button8.Font = new Font("MS Sans Serif", 12);


            uplata.Visible = false;
            unos.Visible   = false;
            label1.Visible = false;
            label2.Visible = false;
            panel4.Visible = false;
            //panel4.Visible = true;
            panel5.Visible            = true;
            tableLayoutPanel1.Visible = true;
            TableLayoutControlCollection tableControls = tableLayoutPanel1.Controls;

            foreach (Control kontrola in tableControls)
            {
                if (kontrola.GetType() == pictureBox2.GetType())
                {
                    PictureBox pbKontrola = kontrola as PictureBox;
                    Console.WriteLine(pbKontrola.Image.ToString());
                    if (kontrola.Name[kontrola.Name.Length - 1] == 'a')
                    {
                        toolTip1.SetToolTip(kontrola, "A12-A-123");
                    }
                    else
                    {
                        toolTip1.SetToolTip(kontrola, "Slobodno mjesto");
                    }
                }
            }


            //panel5.Controls.Clear();
            //Form10 novaforma12 = new Form10();
            //novaforma12.TopLevel = false;
            //panel5.Controls.Add(novaforma12);
            //novaforma12.Show();
        }
Exemplo n.º 7
0
 private void hinzufügenToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     saved = false;
     if (table_lines >= table.RowCount)
     {
         return;
     }
     for (int i = 0; i < 4; i++)
     {
         TextBox textBox = new TextBox();// { Name = Convert.ToString(textboxname + i) };
         textBox.Name = "textBox" + Convert.ToString(textboxname + i);
         Console.WriteLine(textBox.Name);
         textBox.Dock      = DockStyle.Fill;
         textBox.KeyDown  += TextBoxesKeyPressed;
         textBox.KeyPress += TextBoxesKeyPressEvent;
         //textBox.Text = textBox.Name;
         TableLayoutControlCollection controls = table.Controls;
         try
         {
             controls.Add(textBox);
         }
         catch (System.ArgumentException)
         {
         }
     }
     textboxname += 4;
     table_lines += 1;
 }
        public static void Save(TableLayoutControlCollection table, int score1, int score2, bool beurt)
        {
            int i = 16;

            foreach (Control control in table)
            {
                cards += Convert.ToString(control.Tag) + ","; //tags in de volgorde 16-1
            }

            scores = score1.ToString() + "," + score2.ToString();

            names = Data.playername1 + "," + Data.playername2;

            if (beurt)
            {
                turn = "1";
            }
            else
            {
                turn = "2";
            }

            saveFile = string.Format("{0}|{1}|{2}|{3}", cards, scores, names, turn);
            System.IO.StreamWriter file = new System.IO.StreamWriter("D:\\NHL HBO ICT\\Project Memory\\Memory spel 16-10\\SafeFile");
            file.WriteLine(saveFile);
            file.Close();
        }
Exemplo n.º 9
0
        public void TableLayoutControlCollection_Add_NullControl_ThrowsNullReferenceException()
        {
            var container  = new TableLayoutPanel();
            var collection = new TableLayoutControlCollection(container);

            Assert.Throws <NullReferenceException>(() => collection.Add(null, 1, 2));
            Assert.Empty(collection);
        }
Exemplo n.º 10
0
        public void TableLayoutControlCollection_Ctor_TableLayoutPanel(TableLayoutPanel container)
        {
            var collection = new TableLayoutControlCollection(container);

            Assert.Equal(container, collection.Container);
            Assert.Equal(container, collection.Owner);
            Assert.Empty(collection);
        }
Exemplo n.º 11
0
 public static void DisableControls(TableLayoutControlCollection controls, string drive)
 {
     MessageBox.Show(String.Format("This tool cannot be used while {0} is inaccessible.", drive));
     foreach (System.Windows.Forms.Control control in controls)
     {
         control.Enabled = false;
     }
 }
        public void TableLayoutControlCollection_Add_NullControl_ThrowsArgumentNullException()
        {
            var container  = new TableLayoutPanel();
            var collection = new TableLayoutControlCollection(container);

            Assert.Throws <ArgumentNullException>("control", () => collection.Add(null, 1, 2));
            Assert.Empty(collection);
        }
Exemplo n.º 13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtRoleName.Text))
                {
                    MessageBox.Show("请输入角色名称");
                    return;
                }
                TableLayoutControlCollection controls = tableLayoutPanelGrid.Controls;
                if (controls.Count < 1)
                {
                    return;
                }
                StringBuilder sb = new StringBuilder();
                foreach (Control ct in controls)
                {
                    GetChild(sb, ct, null);
                }
                if (sb.Length < 1)
                {
                    MessageBox.Show("请选择此角色拥有的权限");
                    return;
                }
                if (sb.ToString().EndsWith(","))
                {
                    sb.Remove(sb.Length - 1, 1);
                }
                string Id = btnSave.Tag == null?Guid.NewGuid().ToString("N") : btnSave.Tag.ToString();

                string  sql = "select * from AdminRole where Name='" + txtRoleName.Text + "'" + (btnSave.Tag == null ? "" : " and Id<>'" + Id + "'");
                DataSet ds  = DBHelper.ExecuteDataSet(sql);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("此角色名称已经存在,不能重复");
                    return;
                }
                if (btnSave.Tag == null)
                {
                    sql = "Insert into AdminRole(Id,Name,RoleList)values('" + Id + "','" + txtRoleName.Text + "','" + sb.ToString() + "')";
                }
                else
                {
                    sql = "Update AdminRole set Name='" + txtRoleName.Text + "',RoleList='" + sb.ToString() + "' where Id='" + Id + "'";
                }
                if (DBHelper.ExecuteNonQuery(sql) > 0)
                {
                    MessageBox.Show("保存成功!");
                    InItList();
                    toolStripButtonAdd_Click(sender, e);
                }
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(UCRoleSetting));
            }
        }
Exemplo n.º 14
0
        //private bool isClickedIcon = false;

        public Game(TableLayoutControlCollection controls)
        {
            // Fetch label which will contain icons
            fetchIconLabels(controls);
            // Set properties to label (fill,align,etc)
            setLabelProperties(labels);
            // Set icon from to each label
            assignIconsToLabels(labels);
        }
Exemplo n.º 15
0
 public static void AssignIcons(TableLayoutControlCollection controls)
 {
     foreach (Label label in controls) // This is used since the layout has the controls we need to play with
     {
         int randIndex = random.Next(0, icons.Count);
         label.Text = icons[randIndex];
         icons.RemoveAt(randIndex);
         label.ForeColor = label.BackColor;
     }
 }
 /// <summary>
 /// Reset the channel of each <c>IPlotterWatch</c> derived plotter control associated with the specified <c>TableLayoutControlCollection</c>.
 /// </summary>
 /// <param name="controlCollection">Reference to the <c>TableLayoutControlCollection</c> containing the <c>IPlotterWatch</c> derived user controls.</param>
 public void ResetChannel(TableLayoutControlCollection controlCollection)
 {
     for (int index = 0; index < controlCollection.Count; index++)
     {
         if ((controlCollection[index] as IPlotterWatch) != null)
         {
             (controlCollection[index] as IPlotterWatch).Channels[0].Reset();
         }
     }
 }
 public static void SelectInstallers(string installerGroup, TableLayoutControlCollection controls)
 {
     foreach (var control in controls)
     {
         if (control is CheckBox checkBox)
         {
             var installer = checkBox.Tag as Installer;
             checkBox.Checked = installer.Groups.Contains(installerGroup);
         }
     }
 }
Exemplo n.º 18
0
        public void TableLayoutControlCollection_Add_NegativeColumn_ThrowsArgumentOutOfRangeException()
        {
            using var container = new TableLayoutPanel();
            var collection = new TableLayoutControlCollection(container);

            using var child = new Control();
            Assert.Throws <ArgumentOutOfRangeException>("column", () => collection.Add(child, -2, 2));
            Assert.Equal(child, Assert.Single(collection));
            Assert.Equal(-1, container.GetColumn(child));
            Assert.Equal(-1, container.GetRow(child));
        }
        public void TableLayoutControlCollection_Add_NegativeRow_ThrowsArgumentOutOfRangeException()
        {
            var container  = new TableLayoutPanel();
            var collection = new TableLayoutControlCollection(container);
            var control    = new Control();

            Assert.Throws <ArgumentOutOfRangeException>("row", () => collection.Add(control, 1, -2));
            Assert.Equal(control, Assert.Single(collection));
            Assert.Equal(1, container.GetColumn(control));
            Assert.Equal(-1, container.GetRow(control));
        }
        public void TableLayoutControlCollection_Add_ValidControl_Success(int column, int row)
        {
            var container  = new TableLayoutPanel();
            var collection = new TableLayoutControlCollection(container);
            var control    = new Control();

            collection.Add(control, column, row);
            Assert.Equal(control, Assert.Single(collection));
            Assert.Equal(column, container.GetColumn(control));
            Assert.Equal(row, container.GetRow(control));
        }
Exemplo n.º 21
0
 public static void ResetGame(Label MessageText, TableLayoutControlCollection controls)
 {
     counter          = 10;
     iconsFound       = 0;
     MessageText.Text = "Number of tries: " + counter;
     icons            = new List <string>()
     {
         "!", "~", "a", "b", "c", "h", "w", "#", "!", "~", "a", "b", "c", "h", "w", "#"
     };
     AssignIcons(controls);
 }
Exemplo n.º 22
0
 private void CheckOrNot(TableLayoutControlCollection CtrCollection)
 {
     foreach (Control ctz in CtrCollection)
     {
         if (ctz is CheckBox)
         {
             CheckBox cb = ctz as CheckBox;
             cb.Checked = !cb.Checked;
         }
     }
 }
Exemplo n.º 23
0
 private void fetchIconLabels(TableLayoutControlCollection controls)
 {
     foreach (Control control in controls)
     {
         Label label = control as Label;
         if (label != null)
         {
             labels.Add(label);
         }
     }
 }
        /// <summary>
        /// Check whether there were any breaks in communication with the VCU and set the breakpoint values of each plotter controls accordingly. This allows the plot
        /// to be drawn using a transparent pen for periods where there was a break in transmission.
        /// </summary>
        /// <param name="controlCollection">Reference to the <c>TableLayoutControlCollection</c> containing the <c>IPlotterWatch</c> derived user controls.</param>
        /// <param name="startTime">The start time of the plot.</param>
        /// <param name="historicDataManager">Reference to the <c>HistoricDataManager</c> class containing the data that is to be plotted.</param>
        public void SetBreakpoints(TableLayoutControlCollection controlCollection, DateTime startTime, IHistoricDataManager historicDataManager)
        {
            // Skip, if the Dispose() method has been called.
            if (m_IsDisposed)
            {
                return;
            }

            // Skip, if there are no plotter controls associated with the TableLayoutPanel.
            if (controlCollection.Count == 0)
            {
                return;
            }

            // The time, in ms since the start of the plot, where a break in the sequence was detected.
            long breakpoint;

            // The DateTime corresponding to the previous entry, used to determine a break in the log sequence for running logs.
            DateTime previousEntryDateTime = new DateTime();

            // The interval between concurrent frames above which the plot is considered to have been interrupted i.e a new breakpoint has been triggered.
            TimeSpan breakpointTriggerInterval = new TimeSpan(0, 0, 0, 0, BreakpointTriggerIntervalAsMultiple * Parameter.IntervalWatchMs);

            long adjust;

            for (int frame = 0; frame < m_HistoricDataManager.FramesToDisplay.Count; frame++)
            {
                // Don't perform comparison on the first entry.
                if (frame != 0)
                {
                    if (historicDataManager.FramesToDisplay[frame].CurrentDateTime.Subtract(previousEntryDateTime) > breakpointTriggerInterval)
                    {
                        // Detected a break in the log sequence, record the previous entry as a breakpoint, round down to the nearest 10ms.
                        breakpoint  = (long)previousEntryDateTime.Subtract(startTime).TotalMilliseconds;
                        adjust      = breakpoint % BreakpointResolutionMs;
                        breakpoint -= adjust;

                        // Record the breakPoint for each plotter.
                        for (int index = 0; index < controlCollection.Count; index++)
                        {
                            // Skip, if the plotter user control has not been configured.
                            if ((controlCollection[index] as IPlotterWatch) == null)
                            {
                                continue;
                            }

                            (controlCollection[index] as IPlotterWatch).Channels[0].SetBreakPoint(breakpoint);
                        }
                    }
                }
                previousEntryDateTime = m_HistoricDataManager.FramesToDisplay[frame].CurrentDateTime;
            }
        }
Exemplo n.º 25
0
        internal void clearBoard()
        {
            TableLayoutControlCollection buttons = tableLayoutPanel1.Controls;

            for (int i = 0; i < buttons.Count; i++)
            {
                if (buttons[i] is Button)
                {
                    buttons[i].Text = "";
                }
            }
        }
        private void Iskoci(TableLayoutControlCollection Controls, Bitmap slika)
        {
            Random rGen = new Random();

            Button[] btns = Controls.OfType <Button>().ToArray();
            foreach (Button btn in btns)
            {
                btn.Image = null;
            }

            //U Bjelicinoj f-ji je (0,10) pa moze dat i 10 i doce do greske jer je 9 dugmadi.
            btns[rGen.Next(0, 9)].Image = slika;
        }
Exemplo n.º 27
0
        public void clearbound()
        {
            TableLayoutControlCollection buttons = tableLayoutPanel1.Controls;

            for (int i = 0; i < buttons.Count; i++)
            {
                if (buttons[i] is Button)
                {
                    buttons[i].Text = "";
                }
            }
            currentPlayer = CurrentPlayer.Cross;
        }
Exemplo n.º 28
0
        public void wyczyść()
        {
            TableLayoutControlCollection buttons = tableLayoutPanel1.Controls;

            for (int i = 0; i < buttons.Count; i++)
            {
                if (buttons[i] is Button)
                {
                    buttons[i].Text = "";
                }
                cp = CurrentPlayer.Krzyzyk;
                Currentlabel2.Text = "Krzyżyk";
            }
        }
Exemplo n.º 29
0
 public static void InitShowResult(TableLayoutControlCollection ctrls, Color bc)
 {
     if (ctrls == null)
     {
         return;
     }
     foreach (Control c in ctrls)
     {
         if (c is TextBox)
         {
             c.BackColor = bc;
         }
     }
 }
        /// <inheritdoc />
        public object PerformSet(object toTarget, object newValue, object[] arguments)
        {
            IEnumerable <Control>        newValueEnumerable = (IEnumerable <Control>)newValue;
            TableLayoutControlCollection targetCollection   = (TableLayoutControlCollection)toTarget;

            targetCollection.Container.SuspendLayout();

            targetCollection.Clear();

            targetCollection.AddRange(newValueEnumerable.ToArray());

            targetCollection.Container.ResumeLayout();
            return(targetCollection);
        }