Пример #1
0
        public LoginPresenter(ILoginView view, IChatHubProxy proxy, INavigationService navigationService)
        {
            _view = view;
            _proxy = proxy;
            _navigationService = navigationService;
            _view.PropertyChanged += (s, e) => _view.SetLoginEnabled(proxy.IsConnected && !_isLoggingIn && !String.IsNullOrWhiteSpace(_view.UserName));

            _view.Login += _view_Login;


            _proxy.Connected = (detail, details) =>
            {

            };

            Action connect = async () =>
            {
                _isLoggingIn = true;
                try
                {
                    await proxy.Connect();
                }
                finally
                {
                    _isLoggingIn = false;
                }
            };

            connect.Invoke();

        }