Exemple #1
0
        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;
        }
Exemple #2
0
 public static void NoOp(uiListable ignored)
 {
 }
Exemple #3
0
            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());
            }
Exemple #4
0
 public void OptionLoadSession(uiListable session)
 {
     app = file.Load((Session)session);
     ui  = new PresentationLayer(app);
 }
Exemple #5
0
 public void OptionDeletePiece(uiListable piece)
 {
     app.DeletePiece(ui.DeletePiece((Piece)piece));
 }
Exemple #6
0
 public void OptionEditPiece(uiListable piece)
 {
     ui.EditPiece((Piece)piece);
 }
Exemple #7
0
        public void OptionEndWork(uiListable listable)
        {
            Ticket ticket = (Ticket)listable;

            ticket.endWork();
        }
Exemple #8
0
 public void OptionStartWork(uiListable piece)
 {
     app.AddTicket(new Ticket((Piece)piece));
 }
Exemple #9
0
 public void OptionSaveSession(uiListable session)
 {
     file.Save(app.GetPieces(), app.GetTickets(), (Session)session);
 }