Exemple #1
0
        public BetOfferActionView(PokerGameWindow parent, BetOfferAction action)
        {
            InitializeComponent();
            this.parent = parent;
            this.action = action;

            //Pobieramy naszego gracza
            var _player = (from p in parent.TableModel.PlayersList
                           where p.User.ID == Session.Data.User.ID
                           select p).FirstOrDefault();

            this.BidSlider.Maximum       = (double)this.action.MaxBet;
            this.BidSlider.TickFrequency = (double)this.action.BetTick;
            this.BidSlider.Minimum       = (double)action.MinBet;

            this.BidSlider.Value = this.BidSlider.Minimum;

            //Jesli za malo pieniedzy ukrywamy elementy przebiajajce
            if (this.BidSlider.Value > (double)_player.Stack)
            {
                RiseBetButton.Visibility = Visibility.Hidden;
                SliderPanel.Visibility   = Visibility.Hidden;
            }

            this.UpdateRiseButton();
            this.UpdateCheckCallButton();
        }
Exemple #2
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());
                    }
                }));
            });
        }
Exemple #3
0
        public void InitializeTable()
        {
            this.Window    = Helper.FindVisualParent <PokerGameWindow>(this);
            this.GameTable = this.Window.TableModel;

            //Styl gracza
            this.LoadUserStyle();

            //Usadzenie miejsc przy stole
            this.ClearTable();

            //Dodaje miejsca do gry
            this.SeatsPlacer();

            //Usadzenie graczy przy stolkach ktorzy sa juz przy nim
            foreach (PlayerModel player in GameTable.PlayersList)
            {
                var _seat = this.ellipseTableSeats.Children.
                            Cast <GameControls.Seat>().
                            ElementAt(player.Seat);

                _seat.SitDownUser(player);
            }

            this.ellipseTableSeats.Refresh();
            ellipseTableSeats.UpdateLayout();

            this.OnRenderSizeChanged(null);
            this.Refresh();
            this.UpdateLayout();
        }
        public NormalModeStackWindow(PokerGameWindow parent)
        {
            InitializeComponent();
            this.parent = parent;
            this.game   = (NormalGameModel)Session.Data.Client.ServiceProxy.GetGameModelByTable(parent.TableModel);

            this.AvailableBallance.Visibility = Visibility.Hidden;

            this.JoinButton.IsEnabled = false;

            this.table_name.Text = this.game.Name;
            this.Blind.Text      = this.game.Table.Stakes;

            this.StackSlider.TickFrequency = (double)this.game.Table.Blind;
            this.StackSlider.Minimum       = (double)this.game.Minimum;
            this.StackSlider.Maximum       = (double)this.game.Maximum;
            this.MinAmount.Text            = CurrencyFormat.Get(
                this.game.Table.Currency, ((decimal)this.StackSlider.Minimum)
                );
            this.StackSlider.Value = this.StackSlider.Maximum;

            this.StackValue.Text = this.StackSlider.Value.ToString();

            //Pobieramy wallet
            Task.Factory.StartNew(() =>
            {
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    wallet = Session.Data.Client.ServiceProxy.GetWallet(this.game.Table.Currency);
                    if (wallet == null)
                    {
                        AvailableBallance.Text = "Brak konta z walutą";
                    }
                    else
                    {
                        AvailableBallance.Text = CurrencyFormat.Get(this.game.Table.Currency, wallet.Available);
                    }

                    if (wallet != null && wallet.Available > this.game.Minimum)
                    {
                        if (wallet.Available < this.game.Maximum)
                        {
                            this.StackSlider.Maximum = (double)wallet.Available;
                        }
                        this.JoinButton.IsEnabled = true;

                        //Tworzymy rezerwacje
                        //Session.Data.Client.ServiceProxy.DoAction(ActionModel.GameActionType.Booking, this.game.Table);
                    }
                    else
                    {
                        this.JoinButton.Content = "Brak funduszy";
                    }

                    this.Loader.Visibility            = Visibility.Hidden;
                    this.AvailableBallance.Visibility = Visibility.Visible;
                }));
            });
        }
Exemple #5
0
        public BackOfferActionView(PokerGameWindow parent)
        {
            InitializeComponent();
            this.parent = parent;

            var _player = this.parent.GameTable.GameTable.PlayersList.
                          Where(c => c.User.ID == Session.Data.User.ID).
                          Select(c => c).FirstOrDefault();

            this.Sit.Content = "Usiądź";
        }
Exemple #6
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();
        }
Exemple #7
0
 public FindAnotherTableOfferActionView(PokerGameWindow parent)
 {
     InitializeComponent();
     this.parent = parent;
 }
        public void OpenPoker(int playerNum)
        {
            PokerGameWindow gameWindow = new PokerGameWindow(playerNum);

            gameWindow.Show();
        }
Exemple #9
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();
        }
Exemple #10
0
 public SeatOfferActionView(PokerGameWindow parent)
 {
     InitializeComponent();
     this.parent = parent;
 }