public void OptionEndDay(uiListable session) { if (app.ticketExistsBy((t) => !t.Closed)) { Ticket[] open = app.FilterTicketsBy((t) => !t.Closed); foreach (Ticket ticket in open) { ticket.endWork(); } } file.Save(app.GetPieces(), app.GetTickets(), (Session)session); running = false; }
public static void NoOp(uiListable ignored) { }
public bool Navigate() { int chosenNumber = 0; if (current.IsDynamic()) { MenuEntry dummy = current.GetChildren()[0]; current.RemoveDummy(); foreach (uiListable listable in current.GetDynamicEntries()) { Builder b = new Builder(); b = b.SetHeader(dummy.GetHeader()). SetDescription(listable.GetDescription()). SetStaticPerform(dummy.staticPerform). SetDynamicPerformPrePick(dummy.dynamicPerformPrePick). SetDynamicPerformPostPick(dummy.dynamicPerformPostPick). SetFuncGetDynamicEntries(dummy.getDynamicEntries). SetFuncIsVisible(dummy.isVisible). SetFuncEndsProgram(dummy.endsProgram). SetParent(current); foreach (MenuEntry child in dummy.GetChildren()) { b = b.AddChild(child).Return(); } current.AddChild(b.Build()); } } MenuEntry choice = LetUserPick(current, ref chosenNumber); if (chosenNumber == -1) { if (current.IsDynamic()) { if (current.GetDynamicEntries().Count == 0 && choice == null) { return(false); } current.ReplaceAllChildrenWithDummy(); } if (choice == null) { return(true); } } else { choice.StaticPerform(); if (current.IsDynamic()) { current.GetDynamicPerformPostPick()(current.GetDynamicEntries()[chosenNumber]); } if (context != null) { choice.GetDynamicPerformPrePick()(context); } if (current.IsDynamic()) { context = current.GetDynamicEntries()[chosenNumber]; } else { context = null; } } current = choice; return(current.EndsProgram()); }
public void OptionLoadSession(uiListable session) { app = file.Load((Session)session); ui = new PresentationLayer(app); }
public void OptionDeletePiece(uiListable piece) { app.DeletePiece(ui.DeletePiece((Piece)piece)); }
public void OptionEditPiece(uiListable piece) { ui.EditPiece((Piece)piece); }
public void OptionEndWork(uiListable listable) { Ticket ticket = (Ticket)listable; ticket.endWork(); }
public void OptionStartWork(uiListable piece) { app.AddTicket(new Ticket((Piece)piece)); }
public void OptionSaveSession(uiListable session) { file.Save(app.GetPieces(), app.GetTickets(), (Session)session); }