public override void RegisteredForRemoteNotifications(UIApplication app, NSData deviceToken) { // Connection string from your azure dashboard var cs = SBConnectionString.CreateListenAccess( new NSUrl(EnvironmentConstants.AzureListenAccessEndPoint), EnvironmentConstants.AzurePushAccess); // Register our information with Azure var hub = new SBNotificationHub(cs, EnvironmentConstants.AzureNamespace); hub.RegisterNativeAsync(deviceToken, null, err => { if (err != null) { UIAlertViewHelpers.ShowAlert( "Uh Oh!", "There was a problem registering with push notifications. Email [email protected]", "Got it!"); } else { Console.WriteLine("Success"); } }); }
// Check the stuatus of our connections private async void SearchButton_Clicked(object sender, EventArgs e) { var conversationsPass = "******"; //var conversationsPass = ConversationsControls.Instance.IsListening ? "PASS" : "FAIL"; var signalrPass = SignalRService.IsConnected ? "PASS" : "FAIL"; await UIAlertViewHelpers.ShowAlert( "Status Check!", $"Conversations: {conversationsPass}\n" + $"SignalR Events: {signalrPass}\n", "Got it!"); }
public override async void ViewDidLoad() { base.ViewDidLoad(); if (SelectedTransactionId != 0) { var messagesViewController = GetViewController(MainStoryboard, "TransactionDetailController") as TransactionDetailViewController; messagesViewController.SelectedTransactionId = SelectedTransactionId; NavigationController.PushViewController(messagesViewController, true); } var searchButton = new UIBarButtonItem(UIBarButtonSystemItem.Search); searchButton.Clicked += SearchButton_Clicked; NavigationItem.SetRightBarButtonItem(searchButton, true); viewModel.Transactions.CollectionChanged += Transactions_CollectionChanged; viewModel.PropertyChanged += (sender, e) => InvokeOnMainThread(RefreshUI); await viewModel.FetchTransactionsCommand(); var revealViewController = this.RevealViewController(); if (revealViewController != null) { RevealButton.Clicked += (sender, e) => revealViewController.RevealToggleAnimated(true); View.AddGestureRecognizer(revealViewController.PanGestureRecognizer); } else { // Bug: Currently app needs to be restarted. RevealButton.Clicked += async(sender, e) => { await UIAlertViewHelpers.ShowAlert( "Uh Oh!", "You have to restart the app to see the menu. I promise this wont happen after you restart!", "Got it!"); }; } LayoutViews(); SignalRManager.RegisterEventHandlers(); await SignalRService.ConnectAsync(); }