Esempio n. 1
0
        public static Color GetNewJarColor()
        {
            int   randomColorValue = new Random().Next(1, 17);
            Color currentColor     = SetColor.GetColor((SetColor.JartrekColors)randomColorValue);

            return(currentColor);
        }
Esempio n. 2
0
 /// <summary>
 /// Buttons the clicked.
 /// </summary>
 /// <param name="button">The button.</param>
 /// <param name="index">The index.</param>
 private void ButtonClicked(Button button, int index)
 {
     if (button.Text == "Not Used!" || button.Text == "Current Location")
     {
         timesClicked = 1;
         if (btnClicked == 0)
         {
             btnClicked = index;
         }
         btnArray[btnClicked].Text      = "Not Used!";
         btnArray[btnClicked].BackColor = prevColor;
         btnArray[btnClicked].UseVisualStyleBackColor = false;
         button.Text = jarLegend;
         // button.BackColor = _currentColor;
         btnClicked = index;
     }
     else if (button.Text == jarLegend)
     {
         if (timesClicked > 17)
         {
             timesClicked = 1;
         }
         timesClicked++;
         button.BackColor = SetColor.GetColor((SetColor.JartrekColors)timesClicked);
     }
     else
     {
         MessageBox.Show("This button is already in use!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 3
0
        private void MainTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            presetMasterBindingSource.Position = presetMasterBindingSource.Find("PresetDesc", (sender as TreeView).SelectedNode.Text);

            try
            {
                Preview_Button.Text        = e.Node.Parent.Text;
                CurrentPreset_Button.Image = DataAccessor.GetBitMaps(e.Node.Name);
                if (CurrentPreset_Button.Image != null)
                {
                    CurrentPreset_Button.Text      = null;
                    CurrentPreset_Button.BackColor = SetColor.GetColor((SetColor.JartrekColors) 7);
                }
                else
                {
                    CurrentPreset_Button.Text      = e.Node.Text.ToLower();
                    CurrentPreset_Button.BackColor = SetColor.GetNewJarColor();
                }
                Preset_Label.Text = e.Node.Text.ToLower();
            }
            catch (NullReferenceException nr)
            {
                Console.WriteLine(nr.Message + "Looks like that node doesnt have a parent...");
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Sets the key text.
 /// </summary>
 private void setKeyText()
 {
     try
     {
         for (int i = 0; i < _myKeyMasterDataTable.Rows.Count; i++)
         {
             Button myBtn = btnArray[Int32.Parse(_keyPri2d[i, 0].ToString())];
             myBtn.Text      = _myKeyMasterDataTable.Rows[i]["KeyLegend"].ToString();
             myBtn.BackColor = SetColor.GetColor((SetColor.JartrekColors)_myKeyMasterDataTable.Rows[i]["KeyColor"]);//eliminated SetKeyColorMethod!
         }
     }
     catch (IndexOutOfRangeException e)
     {
         Console.WriteLine(e.Message + " Somethings going wrong with setKeyText Method. ");
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Sets the jar text.
 /// </summary>
 private void setJarText()
 {
     try
     {
         for (int i = 0; i < _jarPri2d.GetLength(0); i++)
         {
             int btnIndex = Int32.Parse(_jarPri2d[i, 0].ToString()) - 1;
             if (btnIndex >= 0 && btnIndex < 101)
             {
                 Button myBtn = btnArray[btnIndex];
                 myBtn.Text      = _myJarTypeDataTable.Rows[i]["JarLegend"].ToString();
                 myBtn.BackColor = SetColor.GetColor((SetColor.JartrekColors)_myJarTypeDataTable.Rows[i]["JarColor"]);
             }
         }
     }
     catch (IndexOutOfRangeException e)
     {
         Console.WriteLine(e.Message + " Somethings not right with setJarText method.");
     }
 }