public AddHistoricInstanceDialog(iCheckpointCommandController checkPoints, RootElement root, CheckPoint checkpoint, bool pushing)
            : base()
        {
            this.Root = root;
            this.CheckPoints = checkPoints;
            this.checkPoint = checkpoint;

            this.picker = new UIDatePicker (){ Mode = UIDatePickerMode.DateAndTime };
            this.picker.MaximumDate = DateTime.UtcNow.ToNSDate();

            var pickerElement = new UIViewElement (string.Empty, this.picker, false);

            this.picker.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;

            this.nowSwitch = new BooleanElement ("Reset to now:", true);

            picker.ValueChanged += (s, e) => nowSwitch.Value=false;

            nowSwitch.ValueChanged += (s, e) => {
                if (nowSwitch.Value)
                    this.picker.Date = DateTime.UtcNow.ToNSDate ();
            };

            this.Root.Add(new CheckPointCellSection(this.checkPoint));

            this.Root.Add (new Section ("Completed on:")
                {
                    new MultilineElement("Specify the time of completion:"),
                    pickerElement,
                    nowSwitch});

            this.NavigationItem.SetRightBarButtonItem (new UIBarButtonItem (UIBarButtonSystemItem.Save,(s,e)=>this.Save()),true);
        }
예제 #2
0
        public OccurrencesSection(CheckPoint checkpoint,iCheckpointCommandController Controller,CheckPointDetailDialog dialog)
        {
            this.Caption= "Completions:";
            this.Footer = "Tap to remove.";

            var occurenceElements =
                checkpoint
                    .AllOccurrences
                    .OrderByDescending (o => o.TimeStamp)
                    .Select (o => new StringElement (o.Date.ToString ("d")  + (o.IsSkipped?" (Skipped)":""),
                        ()=>{
                            var c = SharedDialogs.ConfirmationDialog(
                                (a)=>
                                {
                                    checkpoint.RemoveOccurrence(o);
                                    Controller.RewriteOccurrences();
                                    dialog.Render();
                                },Message:"Deleting this completion will affect averages and streaks.");
                            dialog.PresentModalViewController(c,true);
                        })
                        {
                            Value= o.TimeStamp.ToString ("t")
                        })
                    .ToList();
            this.AddAll (occurenceElements.Take(5));

            if (occurenceElements.Count > 5)
                this.Add (new StringElement ("All Completions",
                    ()=>{
                        var r = new RootElement(checkpoint.Name);
                        var s = new Section("All Completions");
                        r.Add(s);
                        s.AddAll(
                            occurenceElements.Select(o=>
                                {
                                    o.Tapped+=()=>
                                    {r.Reload(s,UITableViewRowAnimation.Automatic);};
                                    return o;
                                }
                            ));
                        dialog.moreDialog = new DialogViewController(r,true);
                        dialog.NavigationController.PushViewController(dialog.moreDialog,true);
                    }
                ){ Alignment = UITextAlignment.Center });
        }
예제 #3
0
 public virtual bool ExecuteFor(iCheckpointCommandController controller, CheckPoint checkPoint)
 {
     throw new NotImplementedException ();
 }
 public override bool ExecuteFor(iCheckpointCommandController controller, CheckPoint checkPoint)
 {
     checkPoint.IsEnabled = false;
     return true;
 }
 public override bool ExecuteFor(iCheckpointCommandController controller, ClockKing.Core.CheckPoint checkPoint)
 {
     controller.PresentRelativeTargetDialogForCheckpoint (checkPoint, ExistingDialog);
     return false;
 }
 public CheckpointDetailCommand(iCheckpointCommandController controller)
 {
     this.Controller = controller;
 }