/// <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); } }
public RowVM(CachedBox box, RowVM parent) { Persistent = box; Parent = parent; }