Пример #1
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			if (!IsTaskRoot)
			{
				Intent intent = Intent;
				String intentAction = intent.Action; 
				if (intent.HasCategory(Intent.CategoryLauncher) && intentAction != null && intentAction.Equals(Intent.ActionMain)) {
					Finish ();
					return;       
				}
			}

			constants.isSignInFromSplashScreen = false;
			constants.currentActivity = null;

			if (constants.network == null) {
				constants.network = new NetworkStatusMonitor ();
				constants.network.Start ();
			}

			// Check to auto login
			if (Utils.getRememberLogin ()) {
				if (Utils.getUserName () != null && Utils.getPassWord () != null) {
					LoginRequest loginRequest = new LoginRequest (this);
					loginRequest.signInDelegate = this;
					loginRequest.sendLoginRequest (Utils.getUserName (), Utils.getPassWord (), true, true);
				} else {
					startHomeActivity();
				}
			} else {
				startHomeActivity();
			}

			TCNotificationCenter.defaultCenter.observers.Clear ();
			TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostDeferOrRescheduleTalkNow, new TCSelector (onDefefTalkNow));
			TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostCallDuration, new TCSelector (updateCallStart));
			TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostNotifyDeclineConferrence, new TCSelector (onDeclineConferrence));
			TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostNotifySignOut, new TCSelector (onNotifyLogout));
			TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostNotifyCloseBalance, new TCSelector (onNotifyExpired));
			TCNotificationCenter.defaultCenter.addObserver (this, Constants.kPostNotifyCloseBalanceCalling, new TCSelector (onNotifyInConference));
			TCNotificationCenter.defaultCenter.addObserver (this, Constants.kNetworkNotAvailable, new TCSelector (onNetworkDisConnect));
		}
Пример #2
0
		private void sendLogin(){
			if(edUserName.Text.Count() > 0 && edPass.Text.Count() > 0) {
				if (loginRequest == null) {
					loginRequest = new LoginRequest (this);
					loginRequest.signInDelegate = this;
				}
				loginRequest.sendLoginRequest (edUserName.Text.Trim (), edPass.Text.Trim (), cbRememberPass.Checked, false);
				tvErrorLogin.Visibility = ViewStates.Gone;
				//btnLogin.Enabled = false;
			} else {
				btnLogin.Enabled = false;
				if(edUserName.Text.Count() <= 0) {
					tvErrorLogin.SetText(Android.Resource.String.userNameRequired);
				} else {
					tvErrorLogin.SetText(Android.Resource.String.passRequired);
				}
				tvErrorLogin.Visibility = ViewStates.Visible;
			}
		}