Esempio n. 1
0
        /// <summary>
        /// Zajęcie miejsca
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GetSeatTournament_Click(object sender, RoutedEventArgs e)
        {
            Task.Factory.StartNew(() =>
            {
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    try
                    {
                        var table = Session.Data.Client.ServiceProxy.GetTournametTable(GameModel);

                        if (table == null)
                        {
                            MessageBox.Show("Nie znaleziono gracza o Twoim identyfikatorze w turnieju. Sprawdź stan rejestracji turnieju.");
                            return;
                        }

                        if (Application.Current.Windows.OfType <PokerGameWindow>().Any(w => w.TableModel.ID == table.ID))
                        {
                            return;
                        }

                        PokerGameWindow gameWindow = new PokerGameWindow(table);
                        gameWindow.Show();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.InnerException.Message.ToString());
                    }
                }));
            });
        }
Esempio n. 2
0
        public static void OpenGameWindow(NormalGameModel game)
        {
            /**
             * Sprawdz czy stol uruchomiony
             * jesli tak podswietl go jesli nie - utworz nowe okno stolu
             * */
            if (Application.Current.Windows.OfType <PokerGameWindow>().Any(w => w.TableModel.ID == game.Table.ID))
            {
                return;
            }

            PokerGameWindow gameWindow = new PokerGameWindow(game.Table);

            //gameWindow.Owner = MainWindow.Instance;
            gameWindow.Show();
        }
        public void OpenPoker(int playerNum)
        {
            PokerGameWindow gameWindow = new PokerGameWindow(playerNum);

            gameWindow.Show();
        }
Esempio n. 4
0
        public Lobby()
        {
            Console.WriteLine("Lobby constructor");

            this.Initialized += (obj, args) =>
            {
                Console.WriteLine("Lobby.Initialized");

                //Zaznaczam ostatnio aktywna zakladke
                LobbyTab.SelectedIndex = Properties.Settings.Default.LastLobbyTab;

                //Aktualizacja statystyk
                PokerClient.Instance.OnGetStatsInfoEvent += Instance_OnGetStatsInfoEvent;

                //Rekalma
                PokerClient.Instance.OnGetAdvertisingEvent += (adv) =>
                {
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        SetAdvertisingLobby(adv);
                    }));
                };

                //Informacja o nowym transferze
                PokerClient.Instance.OnDepositInfoEvent += (transfer) =>
                {
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        if (!Properties.Settings.Default.DontShowDepositWindow)
                        {
                            DepositInfoWindow deposit = new DepositInfoWindow(transfer);
                            deposit.ShowModal(MainWindow.Instance);
                        }
                    }));
                };

                PokerClient.Instance.OnNormalModeUpdateEvent += (game) =>
                {
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        if (NormalModelList == null)
                        {
                            return;
                        }
                        //Aktualizacja elementów listy
                        NormalGameModel item = NormalModelList.FirstOrDefault(t => t.Table.ID == game.Table.ID);

                        if (item != null)
                        {
                            NormalModelList[NormalModelList.IndexOf(item)] = game;
                            NormalGameModeList.Items.Refresh();
                        }
                    }));
                };

                PokerClient.Instance.OnTournamentGameModelUpdateEvent += (game) =>
                {
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        if (NormalModelList == null)
                        {
                            return;
                        }
                        //Aktualizacja elementów listy
                        ITournamentGameModel item = TournamentModelList.FirstOrDefault(t => t.TournamentModel.ID == game.TournamentModel.ID);

                        if (item != null)
                        {
                            TournamentModelList[TournamentModelList.IndexOf(item)] = game;
                            TournamentGameModeList.Items.Refresh();
                        }
                    }));
                };

                PokerClient.Instance.OnTableOpenWindowEvent += (table) =>
                {
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        if (Application.Current.Windows.OfType <PokerGameWindow>().Any(w => w.TableModel.ID == table.ID))
                        {
                            return;
                        }

                        PokerGameWindow gameWindow = new PokerGameWindow(table);
                        gameWindow.Show();
                    }));
                };

                Session.Data.Client.Connected += (e, o) =>
                {
                    Console.WriteLine("OnConnect");
                    RefreshNormalMode();
                    RefreshTournamentMode();
                };

                Session.Data.Client.Disconnected += (e, o) =>
                {
                    Console.WriteLine("OnDisconnect");
                };

                InitializeLobby();
            };

            InitializeComponent();
        }