Ejemplo n.º 1
0
        public void BuildCreateHole()
        {
            this.HolesInfo = new List <HoleInfo>(18);

            for (var i = 0; i < 18; i++)
            {
                int    randNum = new Random().Next();
                byte   Pos     = (byte)new Random().Next(1, 3);
                ushort WP      = (ushort)new Random().Next(0, 8);
                ushort WD      = (ushort)new Random().Next(255);
                ushort WT      = (ushort)(new Random().Next(0, 3));
                var    hole    = new HoleInfo()
                {
                    GameInfo      = this,
                    Index         = randNum,
                    Hole          = (byte)(i + 1),
                    Weather       = WT,
                    WindPower     = WP,
                    WindDirection = WD,
                    Course        = (byte)Course,
                    Pos           = Pos,
                    ModeType      = HoleOrder
                };

                HolesInfo.Add(hole);
            }
        }
Ejemplo n.º 2
0
 public void UpdateHolesInfo(HolesInfo holesInfo)
 {
     this.holesSlider.Maximum = holesInfo.MaxHoleNum;
     this.holesSlider.Minimum = holesInfo.MinHoleNum;
     this.holesSlider.Value   = holesInfo.HoleNum;
     this.holesSlider.Text    = string.Format("{0}holes", holesInfo.HoleNum);
 }
Ejemplo n.º 3
0
 public void UpdateHolesInfo(HolesInfo holesInfo)
 {
     holeSliderUpdate         = false;
     this.holesSlider.Maximum = holesInfo.MaxHoleNum;
     this.holesSlider.Minimum = holesInfo.MinHoleNum;
     this.holesSlider.Value   = holesInfo.HoleNum;
     this.lblHoleNumber.Text  = /*string.Format("{0}", holesInfo.HoleNum)*/ FormatHoleNumber(holesInfo.HoleNum);
     this.holesSlider.Text    = string.Format("{0}holes", holesInfo.HoleNum);
     Console.WriteLine("laser ctrl hole number: " + holesInfo.HoleNum);
     holeSliderUpdate = true;
 }
Ejemplo n.º 4
0
 public void HolesInfoChangeHandler(HolesInfo holesInfo)
 {
     if (holesInfo != null)
     {
         LaserCtrl laserCtrl = controls[0] as LaserCtrl;
         if (laserCtrl != null)
         {
             laserCtrl.UpdateHolesInfo(holesInfo);
         }
     }
 }
Ejemplo n.º 5
0
 private void Next_Click(object sender, RoutedEventArgs e)
 {
     uint numberOfHoles,memorySize;
     if (uint.TryParse(NumberOfHoles.Text, out numberOfHoles) 
         && uint.TryParse(MemorySize.Text, out memorySize))
     {
         var holesInfo = new HolesInfo(numberOfHoles,memorySize);
         holesInfo.Show();
         Close();
     }
     else
     {
         MessageBox.Show("Please enter valid inputs.", "Error",
             MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }