protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); int taskID = Intent.GetIntExtra("TaskID", 0); if(taskID > 0) { this._task = TaskManager.GetTask(taskID); } // set our layout to be the home screen this.SetContentView(Resource.Layout.TaskDetails); this._nameTextEdit = this.FindViewById<EditText>(Resource.Id.txtName); this._notesTextEdit = this.FindViewById<EditText>(Resource.Id.txtNotes); this._saveButton = this.FindViewById<Button>(Resource.Id.btnSave); // find all our controls this._cancelDeleteButton = this.FindViewById<Button>(Resource.Id.btnCancelDelete); // set the cancel delete based on whether or not it's an existing task if(this._cancelDeleteButton != null) { this._cancelDeleteButton.Text = (this._task.ID == 0 ? "Cancel" : "Delete"); } // name if(this._nameTextEdit != null) { this._nameTextEdit.Text = this._task.Name; } // notes if(this._notesTextEdit != null) { this._notesTextEdit.Text = this._task.Notes; } // button clicks this._cancelDeleteButton.Click += (sender, e) => { this.CancelDelete(); }; this._saveButton.Click += (sender, e) => { this.Save(); }; }
public int SaveTask(Task item) { if(item.ID != 0) { base.Update(item); return item.ID; } else { return base.Insert (item); } }
public override void ViewDidLoad() { base.ViewDidLoad(); View.Frame = UIScreen.MainScreen.Bounds; View.BackgroundColor = UIColor.White; View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; button = UIButton.FromType(UIButtonType.RoundedRect); button.Frame = new RectangleF( View.Frame.Width / 2 - buttonWidth / 2, View.Frame.Height / 2 - buttonHeight / 2, buttonWidth, buttonHeight); Task t = new Task(); t.Name = "My Cool task"; t.DueDate = DateTime.Now.AddDays(10); t.Notes = "This should really be done..."; button.SetTitle("Click me", UIControlState.Normal); // MyExternalClassLibrary.BL.Managers.TaskManager(); button.TouchUpInside += (object sender, EventArgs e) => { t.ID = numClicks + 1; int taskId = ExternalLibrary.BL.Managers.TaskManager.SaveTask(t); button.SetTitle(String.Format("clicked {0} times and TaskId {1}", numClicks++, taskId), UIControlState.Normal); }; button.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin; View.AddSubview(button); }
public TaskClickedEventArgs(Task task) : base() { this.Task = task; }
protected void ShowTaskDetails(Task task) { this._detailsScreen = new DetailScreen(task); this.NavigationController.PushViewController(this._detailsScreen, true); }
public DetailScreen(Task task) : base("DetailScreen", null) { this._task = task; }
public static int SaveTask(Task item) { return _me._db.SaveTask(item); }
public static int SaveTask(Task item) { return DAL.TaskManager.SaveTask(item); }