Example #1
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            kinveyClient = ((AppDelegate)UIApplication.SharedApplication.Delegate).kinveyClient;

            TodoItemManager.kinveyClient = kinveyClient;
            TodoItemManager.Init();

            kinveyClient.User().Logout();

            Login();
        }
Example #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // set our layout to be the home screen
            SetContentView(Resource.Layout.HomeScreen);

            //Find our controls
            taskListView  = FindViewById <ListView> (Resource.Id.TaskList);
            addTaskButton = FindViewById <Button> (Resource.Id.AddButton);

            // wire up add task button handler
            if (addTaskButton != null)
            {
                addTaskButton.Click += (sender, e) => {
                    StartActivity(typeof(TodoItemScreen));
                };
            }

            // wire up task click handler
            if (taskListView != null)
            {
                taskListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
                    var taskDetails = new Intent(this, typeof(TodoItemScreen));
                    taskDetails.PutExtra("TaskID", tasks[e.Position]._id);
                    StartActivity(taskDetails);
                };
            }

            var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

            kinveyClient = new Client.Builder("kid_-k5fJBa5eZ", "11a4659800f341f4a2487cf2feb04cb2")
                           .setLogger(delegate(string msg) { Console.WriteLine($"KINVEY{msg}"); })
                           .setFilePath(path)
                           .setOfflinePlatform(new SQLitePlatformAndroid())
                           .build();

            TodoItemManager.kinveyClient = kinveyClient;
            TodoItemManager.Init();
            Login();
        }