public static ChatHubClientService RecreateServiceInstance(string bearerToken) { serviceInstance = new ChatHubClientService(bearerToken); return serviceInstance; }
public static ChatHubClientService GetServiceInstance(string bearerToken) { if (serviceInstance == null) { serviceInstance = new ChatHubClientService(bearerToken); } return serviceInstance; }
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); }
public static ChatHubClientService GetServiceInstance(string bearerToken) { if (serviceInstance == null) { serviceInstance = new ChatHubClientService(bearerToken); } else if (!serviceInstance.IsConnected()) { serviceInstance.Reconnect(); } return(serviceInstance); }
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(); }
public void Dispose() { hubConnection.Stop(); serviceInstance = null; }