public async void Register( )
        {
            _main = MainPresenter.Get();
            _view = ViewPresenterManager.ResolveView(typeof(IRemoteSetupView)) as IRemoteSetupView;

            var users = await DbLocal.FetchUsers();

            _view.Contacts  = users?.ToList();
            _view.StartGame = (addr) => {
                var gamePres = new ChessBoardPresenter();
                var canPlay  = RemoteManager.ConnectTo(new Connection {
                    Address = addr.Split(':')[0],
                    Port    = addr.Split(':')[1]
                });
                if (canPlay)
                {
                    _main.ShowInfo("Невозможно подключиться");
                    _main.ReleaseControl();
                    return;
                }
                gamePres.Register(new Model.Game.Chess.ChessSettings {
                    Type          = Model.Game.Chess.GameType.Remote,
                    IsWhite       = true,// TODO:
                    SecondLimited = -1
                });
            };
            _view.Cancel = () => {
                _main.ReleaseControl();
            };

            _view.Start();
            _main.QueryForSetupView(_view as UserControl);
        }
Exemplo n.º 2
0
        private void StartGameAgainstPC( )
        {
            var sets = new ChessSettings();

            sets.IsWhite       = true;
            sets.Type          = GameType.AgainstPC;
            sets.SecondLimited = -1;

            var pres = new ChessBoardPresenter();

            pres.Register(sets);
            _nowProcessing = true;
        }
Exemplo n.º 3
0
        private void StartSingleGame( )
        {
            // TODO : remote 'chess', set 'game'
            var sets = new ChessSettings();

            sets.IsWhite       = true;
            sets.Type          = GameType.Single;
            sets.SecondLimited = -1;

            var pres = new ChessBoardPresenter();

            pres.Register(sets);
            _nowProcessing = true;
        }