public BoxPreviewVM(AgendaEntry persistent, string contextDate, Action <BoxPreviewVM> gotFocusAction) { GotFocus = gotFocusAction; Persistent = persistent; ContextDate = contextDate; InitializeFromPersistent(); }
public RowVM(AgendaEntry ae) { AgendaEntry = ae; Time = ae.Time; MainText = ae.Box.Title; TimeDisplay = ae.Box.TimeType >= Constants.TIMETYPE_MINUTE ? DateUtil.ToReadableTime(ae.Time) : "----"; }
/// <summary> /// handler for result of a drag onto a chunk title, or onto another boxpreview (indirectly). /// </summary> void MoveBoxToChunk(CachedBox box, TodayVM.ChunkVM chunk, bool rebulidViews) { if (!VM.ContainsBoxId(box.RowId)) { UIGlobals.Do.ShowTimedMessge("Cannot drag task to a different day"); return; } //remove box from all chunks foreach (var c in VM.Chunks) { for (int i = c.Items.Count - 1; i >= 0; --i) { if (c.Items[i].Persistent.Box.RowId == box.RowId) { c.Items.RemoveAt(i); c.IsDirty = true; } } } //add to target chunk var ae = new AgendaEntry { Box = box }; //this is short lived since we will rebuild today anyway chunk.Items.Add(new BoxPreviewVM(ae, Date, ItemGotFocus)); chunk.IsDirty = true; SaveChunks(force: true); //this handler can only affect today so we only refresh this one view if (rebulidViews) { Refresh(null); } }