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; } } }
void Reset() { var dialog = new ConfirmChangeDialogViewModel(); var result = _winMan.ShowDialog(dialog); if (result != null) { if (result == true) { #region attempt that saves event and stuff ////Save the current event, with a different ending ////if it was named bingo2017, save a file called bingo2017RESET[TIMESTAMP] //_log.Info("Saving event before reset..."); //_events.PublishOnBackgroundThread(new CommunicationObject(ApplicationWideEnums.MessageTypes.Save, // ApplicationWideEnums.SenderTypes.ControlPanelView)); //BingoEvent resetEv = new BingoEvent(); ////The following block is almost excatly like the method CopyTo in MainWindowVM, different in the fact that it does not copy over number positions or queues or anything. //resetEv.Initialize(Event.SInfo.Seed, Event.EventTitle, Event.PInfo.PlatesGenerated, DateTime.Now); //resetEv.WindowSettings = Event.WindowSettings; //resetEv.PInfo = Event.PInfo; //resetEv.SInfo = Event.SInfo; ////create a new object, that is the same except for the following: ////empty competitionlist ////empty numberqueue, reset numberboard ////reset singlerow/doublerow/plate to singlerow //CopyEvent(resetEv, Event); //_log.Info("Reset Done"); ////TODO: Somebody else needs to check up on if this actually copies it all over correctly and resets the correct thingies ////ask kris if summin is missin, maybe theres a stupid ass reason for it #endregion foreach (BingoNumber bnum in Event.NumberBoard.Board) { bnum.IsPicked = false; bnum.IsChecked = false; } Event.BingoNumberQueue = new BindableCollection <BingoNumber>(); Event.AvailableNumbersQueue = new BindableCollection <BingoNumber>(); RefreshLatest(); for (int i = 1; i <= 90; i++) { BingoNumber j = new BingoNumber(); j.Value = i; Event.AvailableNumbersQueue.Add(j); } CompetitionObject competition = new CompetitionObject(0, 0, 0, 1); this.AllTeams = new BindableCollection <Team>(competition.AllTeams); } } }
public BingoBoard(IReadOnlyList <int> numbers) { if (numbers.Count != 25) { throw new ArgumentOutOfRangeException(nameof(numbers), $"should have 25 numbers but has {numbers.Count}"); } for (var index = 0; index < numbers.Count; index++) { BingoNumbers[index] = new BingoNumber(numbers[index]); } }
public Board(string input, ref Dictionary <int, BingoNumber> dictNumbers) { string[] lines = input.Split(Environment.NewLine); numbers = new BingoNumber[lines.Length, lines.Length]; for (int i = 0; i < lines.Length; i++) { int[] options = lines[i].Split(" ", StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray(); for (int j = 0; j < options.Length; j++) { if (!dictNumbers.TryGetValue(options[j], out BingoNumber value)) { value = new BingoNumber(options[j]); dictNumbers.Add(options[j], value); } numbers[i, j] = value; } } }
private void AddPreviousCell() { foreach (BingoNumberInfo number in DataHolder.LstBingoNumber) { BingoNumber numberCell = new BingoNumber(number); Grid.SetRow(numberCell, currentRow); Grid.SetColumn(numberCell, currentColumn); grdBingoNumbers.Children.Add(numberCell); if (currentColumn == columnCount - 1) { currentRow = currentRow + 1; currentColumn = 0; } else { currentColumn = currentColumn + 1; } } }
public async Task SendMessage(string user, BingoNumber game) { await Clients.All.SendAsync("StartGame", user, game); }