private void Initialize()
 {
     m_name = FindViewById<EditText>(Resource.Id.EnterName);
     m_pass = FindViewById<EditText>(Resource.Id.EnterPass);
     var buttonLogIn = FindViewById<Button>(Resource.Id.LogInButton);
     buttonLogIn.Click += ButtonLogIn_Click;
     var login = "******";
     var pass = "******";
     m_unitAPIShellAutorizator = new UnitAPIShellAuthorizator(login, pass);
     AccountDB remember = m_unitAPIShellAutorizator.GetRememberAccount();
     if (remember != null)
     {
         m_name.Text = remember.Login;
         m_pass.Text = remember.Password;
         AccountDB account = new AccountDB() { CurUserAdSid = string.Empty, Password = m_pass.Text, Login = m_name.Text, Sid = string.Empty };
         if (m_unitAPIShellAutorizator.LogIn(account))
             GoMainActivity();
     }
 }
Exemple #2
0
 private void InitializeButton()
 {
     Button buttonGetInfo = FindViewById<Button>(Resource.Id.GetInfoDevice);
     buttonGetInfo.Click += HandleClickGetInfo;
     Button buttonSaveInfo = FindViewById<Button>(Resource.Id.Save);
     buttonSaveInfo.Click += HandleClickSaveInfo;
     Button buttonChangeDownload = FindViewById<Button>(Resource.Id.DownloadButton);
     buttonChangeDownload.Click += async (obj, state) =>
     {
         HideKeyboard();
         try
         {
             mDownloadChangeLayout.Visibility = ViewStates.Gone;
             await m_unitAPIShellUpdater.UpdateAsync();
             mDateLastExcharge.Text = m_unitAPIShellUpdater.GetDateLastUpdate().ToString("yyyy-MM-dd HH:mm:ss");
             Toast.MakeText(this, Resource.String.CompleteDownloadData, ToastLength.Long).Show();
         }
         catch (WebException)
         {
             mChangeLayout.Visibility = ViewStates.Gone;
             mNoServerConnectionLayout.Visibility = ViewStates.Visible;
             Toast.MakeText(this, Resource.String.NoConnectionServer, ToastLength.Long).Show();
         }
     };
     Button exitButton = FindViewById<Button>(Resource.Id.ExitButton);
     exitButton.Click += (obj, state) =>
     {
         HideKeyboard();
         var login = "******";
         var pass = "******";
         UnitAPIShellAuthorizator authorizator = new UnitAPIShellAuthorizator(login, pass);
         authorizator.DontRememberMe();
         GoAuthorizationActivity();
     };
 }