public NewPurchaseHistoriesUI(Size2 size)
        {
            Branch = new ClickUIBranch("Purchases", (int)ClickUIPriorities.Pad);
            _grid  = new GridLayout(size,
                                    new List <Definition> {
                new ConcreteDefinition(120), new ShareDefintion(), new ConcreteDefinition(120)
            }, 1);

            var backButton      = ImageTextButtonFactory.CreateRotated("<<", Vector2.Zero, NavigateBack, () => _index != 0 && _isInCall);
            var smartBackButton = new SmartControl(backButton, (int)ClickUIPriorities.Pad);

            Branch.Add(smartBackButton.Branch);
            _grid.AddSpatial(smartBackButton, backButton.Transform, 1, 1);

            var forwardButton      = ImageTextButtonFactory.CreateRotated(">>", Vector2.Zero, NavigateForward, () => (_purchaseSupplier?.Current != null || _index + _ordersPerPage < _purchaseUIs.Count) && _isInCall);
            var smartForwardButton = new SmartControl(forwardButton, (int)ClickUIPriorities.Pad);

            Branch.Add(smartForwardButton.Branch);
            _grid.AddSpatial(smartForwardButton, forwardButton.Transform, 3, 1);

            _branches.Add(smartForwardButton.Branch);
            _branches.Add(smartBackButton.Branch);

            World.Subscribe(EventSubscription.Create <PurchaseInspected>(x => Inspect(), this));
            World.Subscribe(EventSubscription.Create <PurchasesListed>(x => ListPurchases(), this));
            World.Subscribe(EventSubscription.Create <CallResolved>(x => EndCall(), this));
            World.Subscribe(EventSubscription.Create <CallStarted>(x => StartCall(x.Call), this));
        }
Beispiel #2
0
        public ReturnCallApp()
        {
            Branch             = new ClickUIBranch("Call App", (int)ClickUIPriorities.Pad);
            _callBranch        = new ClickUIBranch("In Call Branch", (int)ClickUIPriorities.Pad);
            _betweenCallBranch = new ClickUIBranch("Between Call Branch", (int)ClickUIPriorities.Pad);

            _callGrid = new GridLayout(new Size2(1600, 720),
                                       new List <Definition>
            {
                new ConcreteDefinition(25),
                new ConcreteDefinition(250),
                new ConcreteDefinition(525),
                new ShareDefintion()
            },
                                       new List <Definition>
            {
                new ShareDefintion(),
                new ConcreteDefinition(70)
            });

            var callerGrid          = new CallerGrid(_callGrid.GetBlockSize(2, 1));
            var messengerGrid       = new MessengerGrid(_callGrid.GetBlockSize(3, 1));
            var purchaseHistoryGrid = new PurchaseHistoryGrid(_callGrid.GetBlockSize(4, 1));

            _betweenCallGrid = new BetweenCallGrid(_callGrid.GetBlockSize(1, 1, 4, 2));
            var excuses = new ExcusesUI();
            var callChoicesTransform = new Transform2(_callGrid.GetBlockSize(4, 2));
            var callChoices          = new ChoicesUI(callChoicesTransform);

            _callGrid.AddSpatial(callerGrid, new Transform2(_callGrid.GetBlockSize(2, 1)), 2, 1);
            _callGrid.AddSpatial(messengerGrid, new Transform2(_callGrid.GetBlockSize(3, 1)), 3, 1);
            _callGrid.AddSpatial(purchaseHistoryGrid, new Transform2(_callGrid.GetBlockSize(4, 1)), 4, 1);
            _callGrid.AddSpatial(callChoices, callChoicesTransform, 4, 2);
            _callGrid.AddSpatial(excuses, excuses.Transform, 3, 2);

            _callBranch.Add(callChoices.Branch);
            _callBranch.Add(purchaseHistoryGrid.Branch);
            _callBranch.Add(excuses.Branch);
            _betweenCallBranch.Add(_betweenCallGrid.Branch);
            _automatons.Add(messengerGrid);
            _automatons.Add(callerGrid);
            _automatons.Add(_betweenCallGrid);

            _toDraw = _betweenCallGrid;
            Branch.Add(_betweenCallBranch);
            World.Subscribe(EventSubscription.Create <CallStarted>(x => OnCallStart(), this));
            World.Subscribe(EventSubscription.Create <CallResolved>(x => OnCallEnd(), this));
        }
        public PurchaseHistoryGrid(Size2 size)
        {
            Branch = new ClickUIBranch("Purchase History", (int)ClickUIPriorities.Pad);
            _grid  = new GridLayout(size, 1, new List <Definition> {
                new ShareDefintion()
            });

            var purchases = new NewPurchaseHistoriesUI(_grid.GetBlockSize(1, 1, 2, 1));
            var purchase  = new NewPurchaseUI(_grid.GetBlockSize(1, 1, 2, 1));

            _grid.AddSpatial(purchases, new Transform2(_grid.GetBlockSize(1, 1)), 1, 1);
            _grid.AddSpatial(purchase, purchase.Transform, 1, 1);

            Branch.Add(purchases.Branch);
            Branch.Add(purchase.Branch);
            World.Subscribe(EventSubscription.Create <CallResolved>(x => OnCallResolved(), this));
        }
        public NewSelectSleepDurationUI(Action cancel)
        {
            _grid = new GridLayout(new Size2(1600, 900), 1, 1);
            var innerGrid = new GridLayout(new Size2(250, 525), new List <Definition>
            {
                new ConcreteDefinition(25),
                new ConcreteDefinition(200),
                new ConcreteDefinition(25),
            }, new List <Definition>
            {
                new ConcreteDefinition(25),
                new ConcreteDefinition(50),
                new ConcreteDefinition(25),
                new ConcreteDefinition(70),
                new ConcreteDefinition(10),
                new ConcreteDefinition(50),
                new ConcreteDefinition(10),
                new ConcreteDefinition(70),
                new ConcreteDefinition(25),
                new ConcreteDefinition(70),
                new ConcreteDefinition(25),
                new ConcreteDefinition(70),
                new ConcreteDefinition(25)
            });

            var summary = new Label
            {
                BackgroundColor = Color.Transparent,
                TextColor       = Color.White,
                Font            = "Fonts/16",
                Transform       = new Transform2(innerGrid.GetBlockSize(1, 2, 4, 1)),
                Text            = "How long do you want to sleep for?"
            };
            var upHour        = ImageTextButtonFactory.CreateUpArrow(Vector2.Zero, AddHour);
            var smartUpHour   = new SmartControl(upHour, (int)ClickUIPriorities.Room);
            var downHour      = ImageTextButtonFactory.CreateDownArrow(Vector2.Zero, ReduceHour);
            var smartDownHour = new SmartControl(downHour, (int)ClickUIPriorities.Room);

            _timeLabel = new ImageLabel(_hours + " Hours", "Images/UI/label-small", new Transform2(Sizes.SmallLabel));
            var sleepButton       = ImageTextButtonFactory.Create("Sleep", Vector2.Zero, () => World.Publish(new WentToBed(_hours)));
            var smartSleepButton  = new SmartControl(sleepButton, (int)ClickUIPriorities.Room);
            var cancelButton      = ImageTextButtonFactory.Create("Cancel", Vector2.Zero, cancel);
            var smartCancelButton = new SmartControl(cancelButton, (int)ClickUIPriorities.Room);

            _grid.AddSpatial(innerGrid, new Transform2(innerGrid.Size), 1, 1);
            innerGrid.AddSpatial(new ImageBox(new Transform2(innerGrid.Size), "Images/UI/messenger"), new Transform2(innerGrid.Size), 1, 1, 3, 13);
            innerGrid.AddSpatial(summary, summary.Transform, 2, 2);
            innerGrid.AddSpatial(smartUpHour, new Transform2(new Size2(70, 70)), 2, 4);
            innerGrid.AddSpatial(_timeLabel, new Transform2(Sizes.SmallLabel), 2, 6);
            innerGrid.AddSpatial(smartDownHour, new Transform2(new Size2(70, 70)), 2, 8);
            innerGrid.AddSpatial(smartSleepButton, sleepButton.Transform, 2, 10);
            innerGrid.AddSpatial(smartCancelButton, cancelButton.Transform, 2, 12);
            Branch = new ClickUIBranch("Sleep Duration", (int)ClickUIPriorities.Room);
            Branch.Add(smartUpHour.Branch);
            Branch.Add(smartDownHour.Branch);
            Branch.Add(smartSleepButton.Branch);
            Branch.Add(smartCancelButton.Branch);
        }
        public BetweenCallGrid(Size2 size)
        {
            Branch = new ClickUIBranch("BetweenCalls", (int)ClickUIPriorities.Pad);
            _grid  = new GridLayout(size, 1, 3);

            var rating    = new ReturnsRatingsUI();
            var ready     = new ReturnsCallReadyUI();
            var summaries = new CallSummaryUI();

            _spinner = new Spinner();

            _grid.AddSpatial(rating, rating.Transform, 1, 1);
            _grid.AddSpatial(ready, ready.Transform, 1, 2);
            _grid.AddSpatial(summaries, summaries.Transform, 1, 3);
            _grid.AddSpatial(_spinner, _spinner.Transform, 1, 2);

            Branch.Add(ready.Branch);
        }
Beispiel #6
0
 public void OnCallStart(Call call)
 {
     for (int i = 0; i < call.Options.Count; i++)
     {
         var button      = ImageTextButtonFactory.Create(call.Options[i].Description, Vector2.Zero, call.Options[i].Go);
         var smartButton = new SmartControl(button, (int)ClickUIPriorities.Pad);
         _choices.Add(smartButton);
         _grid.AddSpatial(smartButton, button.Transform, i + 1, 1);
         Branch.Add(smartButton.Branch);
     }
 }
Beispiel #7
0
        public CallerGrid(Size2 size)
        {
            var callerGrid = new GridLayout(size, 1,
                                            new List <Definition>
            {
                new ConcreteDefinition(25),
                new ConcreteDefinition(410),
                new ConcreteDefinition(70),
                new ShareDefintion()
            });

            var caller = new CallerFaceUI();
            var name   = new CallerNameUI();

            callerGrid.AddSpatial(caller, caller.Transform, 1, 2);
            callerGrid.AddSpatial(name, name.Transform, 1, 3);

            _visuals.Add(callerGrid);
            _automatons.Add(caller);
        }
Beispiel #8
0
        public MessengerGrid(Size2 size)
        {
            var grid = new GridLayout(size, 1, 1);

            var messengerTransform = new Transform2(grid.GetBlockSize(1, 1) - new Size2(50, 50));
            var messenger          = new ReturnsCallMessengerUI(messengerTransform);

            grid.AddSpatial(messenger, messengerTransform, 1, 1);

            _automatons.Add(messenger);
            _visuals.Add(grid);
        }
Beispiel #9
0
        private void OnPurchaseInspected(Purchase purchase)
        {
            _grid.AddSpatial(new ImageBox(new Transform2(_grid.Size), "Images/UI/purchase"), new Transform2(_grid.Size), 1, 1, 5, 10);
            _isShowing = true;

            AddLabel(purchase.ProductName, "18", HorizontalAlignment.Center, 2, 1, 3, 1);

            AddLabel("Category: " + purchase.ProductCategory, "12", HorizontalAlignment.Left, 2, 2);
            AddLabel("Product ID: " + purchase.ProductID, "12", HorizontalAlignment.Left, 3, 2, 2, 1);

            AddLabel("Order Date: " + purchase.Date, "12", HorizontalAlignment.Left, 2, 3);
            AddLabel("Order ID: " + purchase.OrderID, "12", HorizontalAlignment.Left, 3, 3, 2, 1);

            var isDelivered = new ImageBox(new Transform2(new Vector2(-100, 0), new Size2(34, 34)), purchase.IsDelivered ? "Images/UI/checkbox-checked" : "Images/UI/checkbox-unchecked");

            _grid.AddSpatial(isDelivered, isDelivered.Transform, 2, 4);
            AddLabel("Is Delivered", "14", HorizontalAlignment.Left, 2, 4, 1, 1, 50, 0);
            AddLabel("Date: " + purchase.DeliverDateTime, "14", HorizontalAlignment.Left, 4, 4);

            AddLabel("Provider: " + purchase.ProviderName, "12", HorizontalAlignment.Left, 2, 5, 2, 1);
            AddLabel("Provider ID: " + purchase.ProviderID, "12", HorizontalAlignment.Left, 4, 5);

            var wasReturned = new ImageBox(new Transform2(new Vector2(-100, 0), new Size2(34, 34)), purchase.WasReturned ? "Images/UI/checkbox-checked" : "Images/UI/checkbox-unchecked");

            _grid.AddSpatial(wasReturned, wasReturned.Transform, 2, 6);
            AddLabel("Was Returned", "14", HorizontalAlignment.Left, 2, 6, 1, 1, 50, 0);
            AddLabel("Date: " + purchase.ReturnDateTime, "14", HorizontalAlignment.Left, 4, 6);

            AddLabel("Shipping Address: " + purchase.ShippingAddress + " Address Owner: " + purchase.AddressOwner, "14", HorizontalAlignment.Left, 2, 7, 3, 1);

            AddLabel("Promo Code: " + purchase.PromoCode, "14", HorizontalAlignment.Left, 2, 8, 3, 1);

            AddLabel("Item Cost: " + purchase.ItemPrice, "14", HorizontalAlignment.Left, 2, 9);
            AddLabel("Total Cost: " + purchase.TotalCost, "14", HorizontalAlignment.Left, 3, 9);

            var soldAsIs = new ImageBox(new Transform2(new Vector2(-100, 0), new Size2(34, 34)), purchase.SoldAsIs ? "Images/UI/checkbox-checked" : "Images/UI/checkbox-unchecked");

            _grid.AddSpatial(soldAsIs, soldAsIs.Transform, 3, 10);
            AddLabel("Sold As Is", "14", HorizontalAlignment.Left, 3, 10, 1, 1, 50, 0);
            AddLabel(purchase.ItemsInStock + " In Stock", "14", HorizontalAlignment.Left, 2, 10);
            _grid.AddSpatial(_viewList, _viewList.Transform, 4, 10, 2, 1);
        }