Beispiel #1
0
        public IGSObserver(IGSClient client, IgsServerInfo serverInfo) : base(client, serverInfo)
        {
            Client.AddHandler(IGSMessages.Info, ReadInfo);
            Client.AddHandler(IGSMessages.Undo, ReadUndo);
            Client.AddHandler(IGSMessages.Kibitz, ReadKibitz);

            ExpectedGames = new List <int>();
        }
Beispiel #2
0
        public GamesListView(Size size,
                             IgsServerInfo serverInfo,
                             IGSObserver gameObserver) : base(size)
        {
            if ((serverInfo == null) || (gameObserver == null))
            {
                throw new Exception("Argument canot be null");
            }

            dataTable = new DataTable();
            dataTable.BeginInit();
            dataTable.Columns.AddRange(new DataColumn[]
            {
                new DataColumn("#", Type.GetType("System.Int32")),
                new DataColumn("White"),
                new DataColumn("WR", Type.GetType("IGoEnchi.IGSRank")),
                new DataColumn("Black"),
                new DataColumn("BR", Type.GetType("IGoEnchi.IGSRank")),
                new DataColumn("Moves", Type.GetType("System.Int32")),
                new DataColumn("Size", Type.GetType("System.Int32")),
                new DataColumn("Handi", Type.GetType("System.Int32")),
                new DataColumn("Komi", Type.GetType("System.Single")),
                new DataColumn("Byo", Type.GetType("System.Int32")),
                new DataColumn("Type"),
                new DataColumn("Obs", Type.GetType("System.Int32"))
            });
            dataTable.EndInit();

            var sort = ConfigManager.Settings.SortModes.Games;

            dataView = new DataView(dataTable)
            {
                AllowEdit   = false,
                AllowDelete = false,
                AllowNew    = false,
                Sort        =
                    dataTable.Columns.Contains(SortModes.ActualName(sort)) ?
                    sort : ""
            };

            dataGrid = new DataGrid()
            {
                Dock = DockStyle.Fill,
                RowHeadersVisible = false,
                DataSource        = dataView,
            };
            dataGrid.MouseDown += new MouseEventHandler(DataGridClick);

            this.serverInfo = serverInfo;

            serverInfo.GameListUpdated += new EventHandler(GamesListUpdated);

            Controls = new List <Control>()
            {
                dataGrid
            };
            RefreshGamesList();
        }
Beispiel #3
0
        public PlayersListView(Size size,
                               IgsServerInfo serverInfo) : base(size)
        {
            if ((serverInfo == null))
            {
                throw new Exception("Argument canot be null");
            }

            dataTable = new DataTable();
            dataTable.BeginInit();
            dataTable.Columns.AddRange(new DataColumn[]
            {
                new DataColumn("Flags"),
                new DataColumn("Name"),
                new DataColumn("Rank", Type.GetType("IGoEnchi.IGSRank")),
                new DataColumn("Won", Type.GetType("System.Int32")),
                new DataColumn("Lost", Type.GetType("System.Int32")),
                new DataColumn("Playing", Type.GetType("System.Int32")),
                new DataColumn("Observing", Type.GetType("System.Int32")),
                new DataColumn("Idle"),
                new DataColumn("Country"),
                new DataColumn("Info")
            });
            dataTable.EndInit();

            var sort = ConfigManager.Settings.SortModes.Players;

            dataView = new DataView(dataTable)
            {
                AllowEdit   = false,
                AllowDelete = false,
                AllowNew    = false,
                Sort        =
                    dataTable.Columns.Contains(SortModes.ActualName(sort)) ?
                    sort : ""
            };

            dataGrid = new DataGrid()
            {
                Dock = DockStyle.Fill,
                RowHeadersVisible = false,
                DataSource        = dataView
            };

            dataGrid.MouseDown += new MouseEventHandler(DataGridClick);

            this.serverInfo = serverInfo;
            serverInfo.PlayersListUpdated += new EventHandler(PlayersListUpdated);

            Controls = new List <Control>()
            {
                dataGrid
            };
            RefreshPlayersList();
        }
Beispiel #4
0
        public PlayerStatsView(Size size,
                               IgsServerInfo serverInfo,
                               string name) : base(size)
        {
            this.serverInfo = serverInfo;
            serverInfo.RequestPlayerStats(name);
            serverInfo.PlayerStatsUpdated +=
                delegate { Container.BaseForm.Invoke(new EventHandler(LoadStats)); };

            this.name = name;
        }
Beispiel #5
0
 public IGSPlayer(IGSClient client, IgsServerInfo serverInfo) : base(client, serverInfo)
 {
     client.AddHandler(IGSMessages.SaySource, ReadSaySource);
     client.AddHandler(IGSMessages.Say, ReadSay);
     client.AddHandler(IGSMessages.Info, ReadInfo);
     client.AddHandler(IGSMessages.Adjourn, ReadAdjourn);
     client.AddHandler(IGSMessages.Score, ReadScore);
     client.AddHandler(IGSMessages.StoredGames, ReadStoredGames);
     client.AddHandler(IGSMessages.Undo, ReadUndo);
     client.AddHandler(IGSMessages.StoneRemoval, ReadStoneRemoval);
     client.AddHandler(IGSMessages.SeekInfo, ReadSeekInfo);
 }
Beispiel #6
0
        public IGSGameListener(IGSClient client, IgsServerInfo serverInfo)
        {
            if ((client == null) ||
                (serverInfo == null))
            {
                throw new ArgumentException("Arguments cannot be null");
            }

            Client     = client;
            ServerInfo = serverInfo;
            client.AddHandler(IGSMessages.GameMove, ReadMoves);
            client.AddHandler(IGSMessages.GameStatus, ReadStatus);
            client.Disconnected += OnDisconnect;

            Games = new List <ObservedGame>();
        }