示例#1
0
        private void BindNumber(string numberString)
        {
            List <NumberInfo>      lstOriginal = DataHolder.LstOriginalNumber;
            List <BingoNumberInfo> lstBingo    = DataHolder.LstBingoNumber;

            Utilities.DeleteNumber(numberString);

            NumberInfo number = lstOriginal.FirstOrDefault(x => x.NumberString == numberString);

            BingoNumberInfo bingoNumber = new BingoNumberInfo(number);

            Utilities.SaveBingoNumber(bingoNumber);

            BingoNumber numberCell = new BingoNumber(bingoNumber);

            Grid.SetRow(numberCell, currentRow);
            Grid.SetColumn(numberCell, currentColumn);
            grdBingoNumbers.Children.Add(numberCell);



            //lstOriginal.Remove(number);
            //lstBingo.Add(number);

            //DataHolder.LstOriginalNumber = lstOriginal;
            //DataHolder.LstBingoNumber = lstBingo;


            if (currentColumn == columnCount - 1)
            {
                currentRow    = currentRow + 1;
                currentColumn = 0;
            }
            else
            {
                currentColumn = currentColumn + 1;
            }

            if (DataHolder.Unlucky)
            {
                if (DataHolder.LstBingoNumber.Count == DataHolder.UnluckyNumber)
                {
                    txtMessage.Text          = StaticMessage.UnLuckyWarning;
                    grdRoot.IsHitTestVisible = false;
                    grdRoot.Opacity          = 0.6;

                    MessagePopUp.VerticalOffset = (DataHolder.DeviceHeight - brdrMain.Height) / 2;
                    if (!MessagePopUp.IsOpen)
                    {
                        MessagePopUp.IsOpen = true;
                    }
                    btnUnlucky.IsEnabled = true;
                }

                else
                {
                    btnUnlucky.IsEnabled = false;
                }
            }
        }
示例#2
0
        private async void btnDraw_Click(object sender, RoutedEventArgs e)
        {
            if (DataHolder.LstOriginalNumber.Count > 0)
            {
                grdRoot.IsHitTestVisible      = false;
                grdRoot.Opacity               = 0.4;
                LoadingPopUp.VerticalOffset   = (DataHolder.DeviceHeight - brdrMainLoading.Height) / 2;
                LoadingPopUp.HorizontalOffset = (DataHolder.DeviceWidth - brdrMainLoading.Width) / 2;
                if (!LoadingPopUp.IsOpen)
                {
                    LoadingPopUp.IsOpen = true;
                }


                Random rnd    = new Random();
                int    second = rnd.Next(1, 4);
                txtNumber.Text = string.Empty;
                sec            = second;
                await System.Threading.Tasks.Task.Delay(second * 1000);

                if (LoadingPopUp.IsOpen)
                {
                    LoadingPopUp.IsOpen = false;
                }

                ProcessingPopUp.VerticalOffset   = (DataHolder.DeviceHeight - brdrMainProcessing.Height) / 2;
                ProcessingPopUp.HorizontalOffset = (DataHolder.DeviceWidth - brdrMainProcessing.Width) / 2;
                if (!ProcessingPopUp.IsOpen)
                {
                    ProcessingPopUp.IsOpen = true;
                }

                List <NumberInfo>        lstOriginal = DataHolder.LstOriginalNumber;
                List <BingoNumberInfo>   lstBingo    = DataHolder.LstBingoNumber;
                IEnumerable <NumberInfo> numbers     = lstOriginal.OrderBy(x => rnd.Next()).Take(1);
                NumberInfo number = numbers.First();
                txtNumber.Text = number.NumberString;
                txtTest.Text   = string.Format("The Lucky Number Is: ");
                //processRing.IsIndeterminate = false;
            }
            else
            {
                txtMessage.Text          = StaticMessage.NoNumberLeft;
                grdRoot.IsHitTestVisible = false;
                grdRoot.Opacity          = 0.6;

                MessagePopUp.VerticalOffset = (DataHolder.DeviceHeight - brdrMain.Height) / 2;
                if (!MessagePopUp.IsOpen)
                {
                    MessagePopUp.IsOpen = true;
                }
            }
        }
示例#3
0
 public static void SaveNumber(NumberInfo info)
 {
     using (var db = new SQLite.SQLiteConnection(App.DBPath))
     {
         string change = string.Empty;
         try
         {
             int success = db.Insert(info);
         }
         catch (Exception ex)
         {
         }
     }
 }
示例#4
0
 public BingoNumberInfo(NumberInfo info)
 {
     NumberString = info.NumberString;
     State        = info.State;
     BackColor    = info.BackColor;
 }