Exemple #1
0
        private void OnSinglePlayer_Button_Click(object sender, RoutedEventArgs e)
        {
            if (_players.Count == 4)
            {
                MessageBox.Show("already 4 players");
                return;
            }

            var wnds = new TileStackWnd[4] {
                Auc, Buc, Cuc, Duc
            };
            TileStackWnd freeWnd = null;

            foreach (var wnd in wnds)
            {
                var p = _players.Find((x) => x.MyWnd == wnd);
                if (p == null)
                {
                    freeWnd = wnd;
                    break;
                }
            }

            if (freeWnd == null)
            {
                MessageBox.Show("no free player-view to use");
                return;
            }

            var inputWnd = new InputWnd {
                Owner = this
            };
            var result = inputWnd.ShowDialog();

            if (result == false)
            {
                return;
            }

            var userId     = inputWnd.TextBoxUserId.Text;
            var roomNumber = inputWnd.TextBoxRoomId.Text;
            var player     = new Player(userId, userId, roomNumber, freeWnd, this);

            player.Connect();

            _players.Add(player);
        }
Exemple #2
0
        private void OnKickAllInRoom_Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var inputWnd = new InputWnd {
                    Owner = this, IsNeedUserId = false
                };
                var result = inputWnd.ShowDialog();
                if (result == false)
                {
                    return;
                }

                var roomNumber = inputWnd.TextBoxRoomId.Text;

                HttpHandlers.SendPostMethod("/support/kickAll", roomNumber, "&roomNumber=" + roomNumber);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #3
0
        private void OnExportTableCfg_Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var inputWnd = new InputWnd {
                    Owner = this, IsNeedUserId = false
                };
                var result = inputWnd.ShowDialog();
                if (result == false)
                {
                    return;
                }

                var tableNumber = inputWnd.TextBoxTableId.Text;

                HttpHandlers.SendPostMethod("/resetTable", tableNumber, "&tableNumber=" + tableNumber);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #4
0
        private void OnAttachDealCfg_Button_Click(object sender, RoutedEventArgs e)
        {
            //TestManualProto();
            // Configure open file dialog box
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName   = "origin";                     // Default file name
            dlg.DefaultExt = ".csv";                       // Default file extension
            dlg.Filter     = "CSV documents (.csv)|*.csv"; // Filter files by extension

            // Show open file dialog box
            bool?result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                try
                {
                    var inputWnd = new InputWnd {
                        Owner = this, IsNeedUserId = false
                    };
                    result = inputWnd.ShowDialog();
                    if (result == false)
                    {
                        return;
                    }

                    var roomNumber = inputWnd.TextBoxRoomId.Text;
                    // Open document
                    var filePath = dlg.FileName;
                    HttpHandlers.SendFileContent2(filePath, roomNumber, HttpHandlers.PathAttachDealCfgFile, this);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }