Beispiel #1
0
 // Get list of tasks
 public async Task <List <DTO.Task> > GetTasks(string projectId)
 {
     try
     {
         return(await base.GetTasks(dataset, projectId));
     }
     catch (Exception ex)
     {
         if (ex.Message.Contains("401"))
         {
             AccountStorage.ClearPassword();
             AppDelegate del = UIApplication.SharedApplication.Delegate as AppDelegate;
             del.BindLoginViewController();
         }
         throw ex;
     }
 }
Beispiel #2
0
 // Update a particular task
 public async Task <DTO.Task> UpdateATask(string taskId, double?estimatedTime, DateTime?completionDate, bool markTaskIncomplete)
 {
     try
     {
         return(await base.UpdateATask(dataset, taskId, estimatedTime, completionDate, markTaskIncomplete));
     }
     catch (Exception ex)
     {
         if (ex.Message.Contains("401"))
         {
             AccountStorage.ClearPassword();
             AppDelegate del = UIApplication.SharedApplication.Delegate as AppDelegate;
             del.BindLoginViewController();
         }
         throw ex;
     }
 }
Beispiel #3
0
 //Delete a  timelog entry
 public async Task <Service.Interface.DeleteRoot> DeleteTimeLog(string timeLogId)
 {
     try
     {
         return(await base.DeleteTimeLog(dataset, timeLogId));
     }
     catch (Exception ex)
     {
         if (ex.Message.Contains("401"))
         {
             AccountStorage.ClearPassword();
             AppDelegate del = UIApplication.SharedApplication.Delegate as AppDelegate;
             del.BindLoginViewController();
         }
         throw ex;
     }
 }
Beispiel #4
0
 //Update an existing timelog entry
 public async Task <TimeLogEntry> UpdateTimeLog(string timeLogId, string comment, DateTime?startDate, string taskId, double?loggedTime, double?interruptTime, bool open)
 {
     try
     {
         return(await base.UpdateTimeLog(dataset, timeLogId, comment, startDate, taskId, loggedTime, interruptTime, open));
     }
     catch (Exception ex)
     {
         if (ex.Message.Contains("401"))
         {
             AccountStorage.ClearPassword();
             AppDelegate del = UIApplication.SharedApplication.Delegate as AppDelegate;
             del.BindLoginViewController();
         }
         throw ex;
     }
 }
Beispiel #5
0
 // Get Time Log entries with optional parameters.
 // Optional parameters should be specified as null
 // only dataset is required
 public async Task <List <TimeLogEntry> > GetTimeLogs(int?maxResults, DateTime?startDateFrom, DateTime?startDateTo, string taskId, string projectId)
 {
     try
     {
         return(await base.GetTimeLogs(dataset, maxResults, startDateFrom, startDateTo, taskId, projectId));
     }
     catch (Exception ex)
     {
         if (ex.Message.Contains("401"))
         {
             AccountStorage.ClearPassword();
             AppDelegate del = UIApplication.SharedApplication.Delegate as AppDelegate;
             del.BindLoginViewController();
         }
         throw ex;
     }
 }
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            // request a recycled cell to save memory
            UITableViewCell cell = tableView.DequeueReusableCell(cellIdentifier);

            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Value1, cellIdentifier);
            }
            cell.TextLabel.Font = UIFont.SystemFontOfSize(13);

            if (indexPath.Row == 0)
            {
                cell.TextLabel.Text = "Logged in as: \"" + AccountStorage.UserId + "\"";

                UIButton logoutBtn = new UIButton(UIButtonType.RoundedRect);
                logoutBtn.Frame = new CGRect(0, 0, 65, 30);
                logoutBtn.SetTitle("Log Out", UIControlState.Normal);
                logoutBtn.TouchUpInside += (sender, e) => {
                    UIAlertController actionSheetAlert = UIAlertController.Create(null, "You are going to log out", UIAlertControllerStyle.ActionSheet);

                    actionSheetAlert.AddAction(UIAlertAction.Create("Log Out", UIAlertActionStyle.Destructive, (action) =>
                    {
                        AccountStorage.ClearPassword();
                        AppDelegate del = UIApplication.SharedApplication.Delegate as AppDelegate;
                        del.BindLoginViewController();
                    }));

                    actionSheetAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

                    UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController;
                    if (presentationPopover != null)
                    {
                        presentationPopover.SourceView = this.owner.View;
                        presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
                    }
                    this.owner.PresentViewController(actionSheetAlert, true, null);
                };
                cell.AccessoryView = logoutBtn;
            }
            else if (indexPath.Row == 1)
            {
                cell.TextLabel.Text = "Connect only over WiFi";
                UISwitch wifiSwitch = new UISwitch(new CGRect(0, 0, 80, 20));
                wifiSwitch.On            = SettingsData.WiFiOnly;
                wifiSwitch.ValueChanged += (sender, e) => {
                    SettingsData.WiFiOnly = wifiSwitch.On;
                };
                cell.AccessoryView = wifiSwitch;
            }
            else if (indexPath.Row == 2)
            {
                cell.TextLabel.Text             = "Max continuous interrupt time";
                InterruptTimeText               = new UITextField(new CGRect(0, 400, 150, 30));
                cell.AccessoryView              = InterruptTimeText;
                InterruptTimeText.TextColor     = UIColor.LightGray;
                InterruptTimeText.TextAlignment = UITextAlignment.Right;
                newInterruptTimePicker();
            }
            else if (indexPath.Row == 3)
            {
                cell.TextLabel.Text              = "Forgotten timer threshold";
                ForgottenTimerText               = new UITextField(new CGRect(0, 500, 150, 30));
                cell.AccessoryView               = ForgottenTimerText;
                ForgottenTimerText.TextColor     = UIColor.LightGray;
                ForgottenTimerText.TextAlignment = UITextAlignment.Right;
                newForgottenTimePicker();
            }
            return(cell);
        }