private void Start( ) { //Check to ensure everything's setup right PushClient.CheckDevice(Application.Context); PushClient.CheckManifest(Application.Context); PushClient.Register(Application.Context, PushHandlerBroadcastReceiver.SENDER_IDS); SetContentView(Resource.Layout.Auth); activityIsVisible = true; MenuId = Resource.Menu.EmptyMenu; LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.ActionBar); LegacyBar.SetHomeLogo(Resource.Drawable.Icon); txtLicense = FindViewById <EditText>(Resource.Id.txtLicense); txtPassword = FindViewById <EditText>(Resource.Id.txtPassword); lblError = FindViewById <TextView>(Resource.Id.lblError); btnLogin = FindViewById <Button>(Resource.Id.btnLogin); txtLicense.Text = GetSharedPreferences(Application.Context.PackageName, FileCreationMode.Private).GetString("License", String.Empty); var encryptedPassword = GetSharedPreferences(Application.Context.PackageName, FileCreationMode.Private).GetString("Password", null); txtPassword.Text = encryptedPassword != null ? Crypto.DecryptStringAES(encryptedPassword, SharedSecret) : String.Empty; lblError.Text = String.Empty; btnLogin.Click += btnLogin_Click; LegacyBar.ProgressBarVisibility = ViewStates.Visible; ThreadPool.QueueUserWorkItem(o => GetAreas( )); }
public override void OnCreate() { base.OnCreate(); //ViewModels ServiceContainer.Register <LoginViewModel>(() => new LoginViewModel()); ServiceContainer.Register <FriendViewModel>(() => new FriendViewModel()); ServiceContainer.Register <MessageViewModel>(() => new MessageViewModel()); ServiceContainer.Register <RegisterViewModel>(() => new RegisterViewModel()); //Models ServiceContainer.Register <ISettings>(() => new FakeSettings()); ServiceContainer.Register <IWebService>(() => new AzureWebService()); //Setup push notifications PushClient.CheckDevice(this); PushClient.CheckManifest(this); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); textRegistrationStatus = FindViewById <TextView>(Resource.Id.textRegistrationStatus); textRegistrationId = FindViewById <TextView>(Resource.Id.textRegistrationId); textLastMsg = FindViewById <TextView>(Resource.Id.textLastMessage); buttonRegister = FindViewById <Button>(Resource.Id.buttonRegister); Log.Info(TAG, "Hello World"); //Check to ensure everything's setup right PushClient.CheckDevice(this); PushClient.CheckManifest(this); this.buttonRegister.Click += delegate { if (!registered) { Log.Info(TAG, "Registering..."); //Call to register PushClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); } else { Log.Info(TAG, "Unregistering..."); //Call to unregister PushClient.UnRegister(this); } RunOnUiThread(() => { //Disable the button so that we can't click it again //until we get back to the activity from a notification this.buttonRegister.Enabled = false; }); }; }
public void RegisterDeviceForPushNotifications(bool force = false) { //Check to ensure everything's setup right PushClient.CheckDevice(_context); PushClient.CheckManifest(_context); //Get the stored latest registration id var registrationId = PushClient.GetRegistrationId(_context); var registered = !string.IsNullOrEmpty(registrationId); const string tag = "PushSharp-GCM"; if (!registered || force) { //Call to register var registerIdDebug = _appSettings.Data.GCM.SenderId; PushClient.Register(_context, registerIdDebug); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.LiveSurvey); this.SetOrientationBackground(Resource.Id.LiveSurvey); VM = (ParticipateLiveVM)AppModel.VM; layout = FindViewById <LinearLayout>(Resource.Id.liveOptionLayout); PushClient.CheckDevice(this); PushClient.CheckManifest(this); if (AppModel.GCMNote != null) { CleanGCMNote(); } ShowLoading(); AppModel.GCMNote = new GCMNotifier(); AppModel.GCMNote.RegistrationUpdated += GCMNote_RegistrationUpdated; PushClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); VM.PropertyChanged += (e, a) => { RunOnUiThread(() => { if (a.PropertyName == "NotificationMessage") { Toast.MakeText(this, VM.NotificationMessage, ToastLength.Long).Show(); } if (a.PropertyName == "CurrentQuestion") { ClearComponents(); InitComponents(); } if (a.PropertyName == "IsClosed") { this.Finish(); StartActivity(typeof(Home)); } }); }; }
public override void OnCreate() { base.OnCreate(); //ViewModels ServiceContainer.Register <LoginViewModel>(() => new LoginViewModel()); ServiceContainer.Register <FriendViewModel>(() => new FriendViewModel()); ServiceContainer.Register <MessageViewModel>(() => new MessageViewModel()); ServiceContainer.Register <RegisterViewModel>(() => new RegisterViewModel()); //Models ServiceContainer.Register <ISettings>(() => new FakeSettings()); ServiceContainer.Register <IWebService>(() => new FakeWebService()); //ServiceContainer.Register<IWebService>(() => new AzureWebService()); //Azure Mobile Services CurrentPlatform.Init(); //PushSharp PushClient.CheckDevice(this); PushClient.CheckManifest(this); }
private ProgressBar progressBar; // Progress spinner to use for table operations // Called when the activity initially gets created protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Activity_To_Do); // Initialize the progress bar progressBar = FindViewById <ProgressBar>(Resource.Id.loadingProgressBar); progressBar.Visibility = ViewStates.Gone; // Create ProgressFilter to handle busy state // Create ProgressFilter to handle busy state var progressHandler = new ProgressHandler(); progressHandler.BusyStateChange += (busy) => { if (progressBar != null) { progressBar.Visibility = busy ? ViewStates.Visible : ViewStates.Gone; } }; try { // Check to ensure everything's setup right PushClient.CheckDevice(this); PushClient.CheckManifest(this); // Register for push notifications System.Diagnostics.Debug.WriteLine("Registering..."); PushClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); CurrentPlatform.Init(); // Create the Mobile Service Client instance, using the provided // Mobile Service URL and key client = new MobileServiceClient( Constants.ApplicationURL, progressHandler); // Get the Mobile Service Table instance to use todoTable = client.GetTable <TodoItem>(); textNewTodo = FindViewById <EditText>(Resource.Id.textNewTodo); // Create an adapter to bind the items with the view adapter = new TodoItemAdapter(this, Resource.Layout.Row_List_To_Do); var listViewTodo = FindViewById <ListView>(Resource.Id.listViewTodo); listViewTodo.Adapter = adapter; // Load the items from the Mobile Service await RefreshItemsFromTableAsync(); } catch (Java.Net.MalformedURLException) { CreateAndShowDialog(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error"); } catch (Exception e) { CreateAndShowDialog(e, "Error"); } }