public async void GetData(View v)
        {
            var ctrl = ((MainActivity)Activity).Ctrl;

            var pn  = v.FindViewById <TextView>(Resource.Id.TaskTimeLog_ProjectName);
            var tn  = v.FindViewById <TextView>(Resource.Id.TaskTimeLog_TaskName);
            var fab = v.FindViewById <FloatingActionButton>(Resource.Id.TaskTimeLog_fab);

            pn.Text = ProjectName;
            tn.Text = TaskName;

            var pb = new ProgressDialog(this.Activity)
            {
                Indeterminate = true
            };

            pb.SetTitle("Loading");
            pb.SetCanceledOnTouchOutside(false);
            pb.Show();
            var timelogs = await ctrl.GetTimeLogs(Settings.GetInstance().Dataset, null, null, null, _id, null);

            Debug.WriteLine("Got data for timelogs :" + timelogs.Count);
            fab.Click += (sender, args) =>
            {
                if (timelogs.Count > 0)
                {
                    Debug.WriteLine("Project Name :" + timelogs[0].Task.Project.Name);
                    Debug.WriteLine("Task Name :" + timelogs[0].Task.FullName);

                    ((MainActivity)Activity).TimeLogEditCallBack(timelogs[0].Task.Project.Name,
                                                                 timelogs[0].Task.FullName, timelogs[0].Task.Id, null);
                }
                else
                {
                    ((MainActivity)Activity).TimeLogEditCallBack(ProjectName, TaskName, _id, null);
                }
            };
            fab.Show();
            foreach (var timelog in timelogs)

            {
                Debug.WriteLine(timelog);
            }

            var listAdapter = new TaskTimeLogAdapter(Activity, Resource.Layout.TimeLogEntryListItem, timelogs.ToArray());

            ListAdapter = listAdapter;

            if (timelogs.Count > 0)
            {
                pn.Text = timelogs[0].Task.Project.Name;
                tn.Text = timelogs[0].Task.FullName;
            }
            pb.Dismiss();


            ListView.ItemClick += (sender, args) =>
            {
                var i = args.Position;
                Debug.WriteLine("I position :" + i);
                ((MainActivity)Activity).TimeLogEditCallBack(timelogs[i].Task.Project.Name, timelogs[i].Task.FullName,
                                                             timelogs[i].Task.Id, timelogs[i]);
            };
        }
        public async void GetData(View v)
        {
            var ctrl = ((MainActivity)Activity).Ctrl;

            var pn  = v.FindViewById <TextView>(Resource.Id.TaskTimeLog_ProjectName);
            var tn  = v.FindViewById <TextView>(Resource.Id.TaskTimeLog_TaskName);
            var fab = v.FindViewById <FloatingActionButton>(Resource.Id.TaskTimeLog_fab);

            pn.Text = ProjectName;
            tn.Text = TaskName;

            var pb = new ProgressDialog(Activity)
            {
                Indeterminate = true
            };

            pb.SetTitle("Loading");
            pb.SetCanceledOnTouchOutside(false);
            pb.Show();

            try
            {
                var timelogs = await ctrl.GetTimeLogs(AccountStorage.DataSet, null, null, null, _id, null);

                Debug.WriteLine("Got data for timelogs :" + timelogs.Count);
                fab.Click += (sender, args) =>
                {
                    if (timelogs.Count > 0)
                    {
                        Debug.WriteLine("Project Name :" + timelogs[0].Task.Project.Name);
                        Debug.WriteLine("Task Name :" + timelogs[0].Task.FullName);

                        ((MainActivity)Activity).TimeLogEditCallBack(timelogs[0].Task.Project.Name,
                                                                     timelogs[0].Task.FullName, timelogs[0].Task.Id, null);
                    }
                    else
                    {
                        ((MainActivity)Activity).TimeLogEditCallBack(ProjectName, TaskName, _id, null);
                    }
                };
                fab.Show();
                foreach (var timelog in timelogs)

                {
                    Debug.WriteLine(timelog);
                }

                var listAdapter = new TaskTimeLogAdapter(Activity, Resource.Layout.TimeLogEntryListItem,
                                                         timelogs.ToArray());
                ListAdapter = listAdapter;

                if (timelogs.Count > 0)
                {
                    pn.Text = timelogs[0].Task.Project.Name;
                    tn.Text = timelogs[0].Task.FullName;
                }
                pb.Dismiss();


                ListView.ItemClick += (sender, args) =>
                {
                    var i = args.Position;
                    Debug.WriteLine("I position :" + i);
                    ((MainActivity)Activity).TimeLogEditCallBack(timelogs[i].Task.Project.Name,
                                                                 timelogs[i].Task.FullName,
                                                                 timelogs[i].Task.Id, timelogs[i]);
                };
            }
            catch (CannotReachServerException)
            {
                if (pb.IsShowing)
                {
                    pb.Dismiss();
                }

                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("Unable to Connect")
                .SetMessage("Please check your network connection and try again")
                .SetNeutralButton("Okay", (sender2, args2) =>
                {
                    builder.Dispose();
                    ((MainActivity)Activity).FragmentManager.PopBackStack();
                })
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
            catch (WebException we)
            {
                if (we.Status == WebExceptionStatus.ProtocolError)
                {
                    var response = we.Response as HttpWebResponse;
                    if (response != null)
                    {
                        Console.WriteLine("HTTP Status Code: " + (int)response.StatusCode);
                        if (response.StatusCode == HttpStatusCode.Forbidden)
                        {
                            try
                            {
                                if (pb.IsShowing)
                                {
                                    pb.Dismiss();
                                }
                                Toast.MakeText(this.Activity, "Username and password error.", ToastLength.Long).Show();
                                System.Diagnostics.Debug.WriteLine("We are about to logout");
                                AccountStorage.ClearStorage();
                                System.Diagnostics.Debug.WriteLine("Main Activity is :" + Activity == null);
                                System.Diagnostics.Debug.WriteLine("Items in the backstack :" + Activity.FragmentManager.BackStackEntryCount);
                                System.Diagnostics.Debug.WriteLine("Main Activity is :" + Activity == null);
                                Activity.FragmentManager.PopBackStack(null, PopBackStackFlags.Inclusive);
                                System.Diagnostics.Debug.WriteLine("Items in the backstack 2 :" + Activity.FragmentManager.BackStackEntryCount);
                                ((MainActivity)(Activity)).SetDrawerState(false);
                                ((MainActivity)(Activity)).SwitchToFragment(MainActivity.FragmentTypes.Login);
                            }
                            catch (System.Exception e)
                            {
                                System.Diagnostics.Debug.WriteLine("We encountered an error :" + e.Message);
                            }
                        }
                    }
                    else
                    {
                        // no http status code available
                        Toast.MakeText(Activity, "Unable to load the data. Please restart the application.", ToastLength.Short).Show();
                    }
                }
                else
                {
                    // no http status code availableToast.MakeText(Activity, "Unable to load the data. Please restart the application.", ToastLength.Short).Show();
                }
            }
            catch (StatusNotOkayException se)
            {
                if (pb.IsShowing)
                {
                    pb.Dismiss();
                }

                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("An Error has occured")
                .SetMessage("Error :" + se.GetMessage())
                .SetNeutralButton("Okay", (sender2, args2) =>
                {
                    builder.Dispose();
                })
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
            catch (Exception e)
            {
                // For any other weird exceptions

                if (pb.IsShowing)
                {
                    pb.Dismiss();
                }

                AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("An Error has occured")
                .SetNeutralButton("Okay", (sender2, args2) =>
                {
                    builder.Dispose();
                })
                .SetMessage("Error :" + e.Message)
                .SetCancelable(false);
                AlertDialog alert = builder.Create();
                alert.Show();
            }
        }