Beispiel #1
0
        protected override async void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Activity_To_Do);

            CurrentPlatform.Init ();

            // Create the Mobile Service Client instance, using the provided
            // Mobile Service URL and key
            client = new MobileServiceClient (applicationURL, applicationKey);
            await InitLocalStoreAsync();

            // Get the Mobile Service sync table instance to use
            toDoTable = client.GetSyncTable <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
            OnRefreshItemsSelected ();
        }
Beispiel #2
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            scanner = new MobileBarcodeScanner(this);

            //removed
            // Set our view from the "main" layout resource
            // SetContentView(SmartBasket.Resource.Layout.Activity_To_Do);
            // CurrentPlatform.Init();
            //edit
            SetContentView(SmartBasket.Resource.Layout.Activity_To_Do);
            //done

            // Create the client instance, using the mobile app backend URL.
            client = new MobileServiceClient(applicationURL);
#if OFFLINE_SYNC_ENABLED
            await InitLocalStoreAsync();

            // Get the sync table instance to use to store TodoItem rows.
            todoTable = client.GetSyncTable <ToDoItem>();
#else
            todoTable = client.GetTable <ToDoItem>();
            itemTable = client.GetTable <Item>();
#endif
            TextView sumView = FindViewById <TextView>(SmartBasket.Resource.Id.sum);
            sumView.Text = "Total: " + sum;
            textNewToDo  = FindViewById <EditText>(SmartBasket.Resource.Id.textNewToDo);

            // Create an adapter to bind the items with the view
            adapter = new ToDoItemAdapter(this, SmartBasket.Resource.Layout.Row_List_To_Do);
            var listViewToDo = FindViewById <ListView>(SmartBasket.Resource.Id.listViewToDo);
            listViewToDo.Adapter = adapter;

            // Load the items from the mobile app backend.
            OnRefreshItemsSelected();

            /*
             *      buttonDoScan = this.FindViewById<Button>(SmartBasket.Resource.Id.scanner);
             *      buttonDoScan.Click += async delegate
             *      {
             *          scanner.UseCustomOverlay = false;
             *          scanner.TopText = "Scanning for barcode";
             *          var result = await scanner.Scan();
             *          DisplayResult(result);
             *      };
             */

            buttonBluetooth        = this.FindViewById <Button>(SmartBasket.Resource.Id.bluetooth);
            buttonBluetooth.Click += async delegate
            {
                scanner.UseCustomOverlay = false;
                scanner.TopText          = "moving to new activity";
                var m_activity = new Intent(this, typeof(BluetoothA));



                this.StartActivity(m_activity);
            };
        }
        protected override async void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Activity_To_Do);

            progressBar = FindViewById<ProgressBar> (Resource.Id.loadingProgressBar);

            // Initialize the progress bar
            progressBar.Visibility = ViewStates.Gone;

            // Create ProgressFilter to handle busy state
            var progressHandler = new ProgressHandler ();
            progressHandler.BusyStateChange += (busy) => {
                if (progressBar != null) 
                    progressBar.Visibility = busy ? ViewStates.Visible : ViewStates.Gone;
            };

            try {
                CurrentPlatform.Init ();
                // Create the Mobile Service Client instance, using the provided
                // Mobile Service URL and key
                client = new MobileServiceClient (
                    applicationURL,
                    applicationKey, progressHandler);

                string path = 
                    Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "localstore.db");
                
                if (!File.Exists(path))
                {
                    File.Create(path).Dispose();
                }
                var store = new MobileServiceSQLiteStore(path);
                store.DefineTable<ToDoItem>();
                await client.SyncContext.InitializeAsync(store, new SyncHandler(this));

                // Get the Mobile Service Table instance to use
                toDoTable = client.GetSyncTable <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");
            }
        }
Beispiel #4
0
		protected override async void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Activity_To_Do);

			progressBar = FindViewById<ProgressBar> (Resource.Id.loadingProgressBar);

			// Initialize the progress bar
			progressBar.Visibility = ViewStates.Gone;

			// Create ProgressFilter to handle busy state
			var progressHandler = new ProgressHandler ();
			progressHandler.BusyStateChange += (busy) => {
				if (progressBar != null) 
					progressBar.Visibility = busy ? ViewStates.Visible : ViewStates.Gone;
			};

			try {
				CurrentPlatform.Init ();

				// Create the Mobile Service Client instance, using the provided
				// Mobile Service URL
				client = new MobileServiceClient (
					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");
			}
		}
        protected override async void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Activity_To_Do);

            CurrentPlatform.Init ();

            // Create the Mobile Service Client instance, using the provided
            // Mobile Service URL and key
			client = new MobileServiceClient (AppConstant.applicationURL, AppConstant.applicationKey);
            await InitLocalStoreAsync();

			user = new MobileServiceUser(Intent.GetStringExtra("UserID"));
			user.MobileServiceAuthenticationToken = Intent.GetStringExtra("UserToken");

			client.CurrentUser = user;

			// Set the current instance of TodoActivity.
			instance = this;

			// Make sure the GCM client is set up correctly.
			GcmClient.CheckDevice(this);
			GcmClient.CheckManifest(this);

			// Register the app for push notifications.
			GcmClient.Register(this, ToDoBroadcastReceiver.senderIDs);

            // Get the Mobile Service sync table instance to use
            toDoTable = client.GetSyncTable <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
            OnRefreshItemsSelected ();
        }
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Activity_To_Do);

            _progressBar = FindViewById<ProgressBar>(Resource.Id.loadingProgressBar);

            _progressBar.Visibility = ViewStates.Gone;

            CurrentPlatform.Init();

            // Create the Mobile Service Client instance, using the provided
            // Mobile Service URL
            client = new MobileServiceClient(applicationURL);
            await InitLocalStoreAsync();

            // Get the Mobile Service sync table instance to use
            toDoTable = client.GetSyncTable<ImageQualityError>();
            
            // 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
            OnRefreshItemsSelected();

            instance = this;

            // Make sure the GCM client is set up correctly.
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            // Register the app for push notifications.
            GcmClient.Register(this, ToDoBroadcastReceiver.senderIDs);
        }
        protected override async void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Activity_To_Do);

            CurrentPlatform.Init ();

            // Create the Mobile Service Client instance, using the provided
            // Mobile Service URL
            client = new MobileServiceClient(applicationURL);
            await InitLocalStoreAsync();

            // Set the current instance of TodoActivity.
            instance = this;

            // Make sure the GCM client is set up correctly.
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            // Get the Mobile Service sync table instance to use
            toDoTable = client.GetSyncTable <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 App backend.
            //OnRefreshItemsSelected ();
        }