コード例 #1
0
 private void updateData(Boolean toUI)
 {
     if (toUI)
     {
         if (this.subjectTextFieldOutlet != null)
         {
             this.subjectTextFieldOutlet.stringValue = _taskToEdit.subject;
         }
         if (this.dueDatePickerOutlet != null)
         {
             this.dueDatePickerOutlet.dateValue = _taskToEdit.dueDate;
         }
         if (this.priorityTextFieldOutlet != null)
         {
             this.priorityTextFieldOutlet.stringValue = NSString.stringWithFormat(@"%@", _taskToEdit.priority);
         }
         if (this.doneCheckBoxOutlet != null)
         {
             this.doneCheckBoxOutlet.state = _taskToEdit.done ? 1 : 0;
         }
     }
     else
     {
         if (this.subjectTextFieldOutlet != null)
         {
             _taskToEdit.subject = this.subjectTextFieldOutlet.stringValue;
         }
         if (this.dueDatePickerOutlet != null)
         {
             _taskToEdit.dueDate = this.dueDatePickerOutlet.dateValue;
         }
         if (this.priorityTextFieldOutlet != null)
         {
             _taskToEdit.priority = Helpers.sharedInstance.decimalNumberFromString(this.priorityTextFieldOutlet.stringValue);
         }
         if (this.doneCheckBoxOutlet != null)
         {
             _taskToEdit.done = (this.doneCheckBoxOutlet.state == NSOnState);
         }
     }
 }
コード例 #2
0
        public id tableView(NSTableView tableView) objectValueForTableColumn(NSTableColumn tableColumn) row(NSInteger row)
        {
            NSString  columnName = tableColumn.identifier;
            TaskModel task       = DataLayer.sharedInstance.tasks[row];

            if ("Subject" == columnName)
            {
                return(task.subject);
            }

            if ("Priority" == columnName)
            {
                return(NSString.stringWithFormat("%@", task.priority));
            }

            if ("DueDate" == columnName)
            {
                return(Helpers.sharedInstance.stringFromDate(task.dueDate));
            }

            return("nothing?");
        }
コード例 #3
0
        public UICollectionReusableView collectionView(UICollectionView collectionView) viewForSupplementaryElementOfKind(String kind) atIndexPath(NSIndexPath indexPath)
        {
            var result = collectionView.dequeueReusableSupplementaryViewOfKind(kind) withReuseIdentifier(HEADER_IDENTIFIER) forIndexPath(indexPath);

            // remove any existing sub-views, in case we are reusing an existing cell
            if (result.subviews != null)
            {
                result.subviews.makeObjectsPerformSelector(__selector(removeFromSuperview));
            }

            // and then add a label to the cell showing the current section.
            var lLabel = new UILabel();

            lLabel.text            = NSString.stringWithFormat("Section %ld", indexPath.section);
            lLabel.frame           = result.bounds;
            lLabel.textColor       = UIColor.blackColor;
            lLabel.backgroundColor = UIColor.lightGrayColor;
            lLabel.font            = UIFont.boldSystemFontOfSize(20);
            lLabel.textAlignment   = NSTextAlignment.NSTextAlignmentCenter;
            lLabel.contentMode     = UIViewContentMode.UIViewContentModeRedraw;
            result.addSubview(lLabel);

            return(result);
        }