public TodayController(bool isToday, Action <BlockController> blockGotFocusHandler, Action <BlockController, bool> collapseRequested) : base(blockGotFocusHandler, collapseRequested) { IsToday = isToday; DateTime dt = DateTime.Now; if (!isToday) { dt = dt.AddDays(1); } string dateS = DateUtil.ToYMD(dt); Date = dateS; VM = new TodayVM(isToday, dateS, VMGotFocus); //hook up VM events VM.ChunkGotFocus = idx => { LastFocusedChunk = VM.Chunks[idx]; }; VM.RequestAddChunk = () => { VM.Chunks.Add(new TodayVM.ChunkVM(VM, UserRemovedChunk) { Title = VM.NewChunkTitle, IsDirty = true }); VM.NewChunkTitle = ""; }; VM.DropOnChunkRequested = (BoxDragInfo di, TodayVM.ChunkVM chunkVM) => { MoveBoxToChunk(di.Box, chunkVM, true); }; VM.FocusBarClicked = () => { VisualUtils.DelayThen(30, () => { VM.GetMainControl?.Invoke()?.Focus(); }); }; Refresh(null); }
public ActionResult Index() { var vm = new TodayVM(); return View(vm); }
public ChunkVM(TodayVM owner, Action <ChunkVM> removeAction) { Owner = owner; Remove = removeAction; }