コード例 #1
0
		public static ChatHubClientService RecreateServiceInstance(string bearerToken)
		{
			
			serviceInstance = new ChatHubClientService(bearerToken);

			return serviceInstance;
		}
コード例 #2
0
		public static ChatHubClientService GetServiceInstance(string bearerToken)
		{
			if (serviceInstance == null)
			{
				serviceInstance = new ChatHubClientService(bearerToken);
			}

			return serviceInstance;
		}
コード例 #3
0
		protected override async void OnCreate(Bundle savedInstanceState)
		{
			base.OnCreate(savedInstanceState);
			ActivityInstance = this;
			this.preferenceHelper = new SharedPreferencesHelper(this);
			bearerToken = (string)preferenceHelper.GetSharedPreference<string>(SharedPreferencesKeys.BEARER_TOKEN);
			this.chatHubClientService = ChatHubClientService.GetServiceInstance(bearerToken);
			SetContentView(Resource.Layout.ConversationActivity);
			GetExtras();
			pageNumber = 0;
			await SetupViews(savedInstanceState);
		}
コード例 #4
0
        public static ChatHubClientService GetServiceInstance(string bearerToken)
        {
            if (serviceInstance == null)
            {
                serviceInstance = new ChatHubClientService(bearerToken);
            }
            else if (!serviceInstance.IsConnected())
            {
                serviceInstance.Reconnect();
            }

            return(serviceInstance);
        }
コード例 #5
0
		private void DoWork()
		{
			this.signalRThread = new Thread(() =>
			{
				this.sharedPreferencesHelper = new SharedPreferencesHelper(Application.ApplicationContext);
				this.bearerToken = (string)this.sharedPreferencesHelper.GetSharedPreference<string>(SharedPreferencesKeys.BEARER_TOKEN);
				this.chatHubClientService = ChatHubClientService.GetServiceInstance(bearerToken);
				this.chatHubClientService.RegisterReceiveMessages(ShowNotification);

				var timer = new Timer(new TimerCallback(TimerCallBackMethod));
				timer.Change(0, 5000);
			}
		);
			signalRThread.Start();
		}
コード例 #6
0
 public void Dispose()
 {
     hubConnection.Stop();
     serviceInstance = null;
 }