Example #1
0
        public async Task LoginAsync(string password)
        {
            Logger.Info("Logging in...");

            AuthSession session = new AuthSession();

            session.AuthFailedEvent   += AuthFailedEventHandler;
            session.AuthSuccessEvent  += AuthSuccessEventHandler;
            session.DisconnectedEvent += DisconnectEventHandler;
            session.ErrorEvent        += ErrorEventHandler;

            AuthStage            = AuthenticationStage.NotAuthenticated;
            UserAccount.Password = password;

            if (UseDummyNetwork)
            {
                Logger.Debug("Faking network for testing...");
                await Task.Delay(1000).ConfigureAwait(false);

                await session.AuthSuccessAsync(string.Empty).ConfigureAwait(false);

                return;
            }

            await session.BeginConnectAsync(ConfigurationManager.AppSettings["authHost"], Convert.ToInt32(ConfigurationManager.AppSettings["authPort"])).ConfigureAwait(false);

            await Sessions.AddAsync(session).ConfigureAwait(false);
        }
Example #2
0
        public App()
        {
            InitializeComponent();

            UserAccount = new Account();
            AuthStage   = AuthenticationStage.NotAuthenticated;
        }