Exemplo n.º 1
0
        public LiveOrdersLayout(Context context) : base(context)
        {
            this.Orientation = Orientation.Horizontal;
            this.SetBackgroundColor(Color.White);

            FrameLayout leftFrame = new FrameLayout(context);

            leftFrame.Id = 1;
            leftFrame.SetMinimumHeight(500);
            leftFrame.SetMinimumWidth(700);
            leftFrame.SetBackgroundColor(Color.White);
            this.AddView(leftFrame);

            FrameLayout rightFrame = new FrameLayout(context);

            rightFrame.Id = 2;
            rightFrame.SetMinimumHeight(700);
            rightFrame.SetMinimumWidth(1190);
            rightFrame.SetBackgroundColor(Color.White);

            this.AddView(rightFrame);

            ordersFragment = new LiveOrdersFragment();
            orderFragment  = new OrderFragment();

            Activity activity = (Activity)context;

            FragmentTransaction ft = activity.FragmentManager.BeginTransaction();

            ft.Add(leftFrame.Id, ordersFragment);
            ft.Add(rightFrame.Id, orderFragment);
            ft.Commit();
        }
Exemplo n.º 2
0
        public CurrentOrderLayout(Context context) : base(context)
        {
            Orientation = Android.Widget.Orientation.Vertical;
            SetMinimumHeight(500);
            SetMinimumWidth(1920);
            SetBackgroundColor(Color.White);

            LinearLayout frames = new LinearLayout(context);

            frames.Orientation = Android.Widget.Orientation.Horizontal;

            leftFrame    = new FrameLayout(frames.Context);
            leftFrame.Id = 1;
            leftFrame.SetMinimumHeight(500);
            leftFrame.SetMinimumWidth(850);
            leftFrame.SetBackgroundColor(Color.White);
            frames.AddView(leftFrame);

            rightFrame    = new FrameLayout(frames.Context);
            rightFrame.Id = 2;
            rightFrame.SetMinimumHeight(700);
            rightFrame.SetMinimumWidth(1040);
            rightFrame.SetBackgroundColor(Color.White);
            frames.AddView(rightFrame);

            AddView(frames);

            VariationsFragment variationsFragment = new VariationsFragment(1);

            leftFragment  = variationsFragment;
            orderFragment = new OrderFragment();

            Activity activity = (Activity)context;

            FragmentTransaction ft = activity.FragmentManager.BeginTransaction();

            ft.Add(leftFrame.Id, variationsFragment);
            ft.Add(rightFrame.Id, orderFragment);
            ft.Commit();
        }
Exemplo n.º 3
0
        public TillLayout(Context context, OrderFragment parent) : base(context)
        {
            borderPaint           = new Paint();
            borderPaint.AntiAlias = true;
            borderPaint.SetStyle(Paint.Style.Stroke);
            borderPaint.Color       = Color.Black;
            borderPaint.StrokeWidth = 1;

            Orientation = Orientation.Vertical;
            SetPadding(10, 10, 10, 10);
            SetBackgroundColor(Color.White);
            SetMinimumHeight(800);

            this.parent = parent;

            LinearLayout entryLayout = new LinearLayout(context);

            entryLayout.Orientation = Orientation.Horizontal;

            TextView entryTitle = new TextView(context);

            entryTitle.Text     = "Tendered: ";
            entryTitle.TextSize = 20;
            entryTitle.SetTextColor(Color.Black);
            entryTitle.SetPadding(10, 30, 0, 0);

            entryLayout.AddView(entryTitle);

            entry               = new EditText(context);
            entry.TextSize      = 20;
            entry.TextAlignment = TextAlignment.TextEnd;
            entry.Text          = "0";
            entry.SetTextColor(Color.Black);
            entry.SetSelection(entry.Text.Length);

            entryLayout.AddView(entry);

            AddView(entryLayout);

            entry.LayoutParameters.Width = 570;

            LinearLayout calcView = new LinearLayout(context);

            TextView calcTextView = new TextView(context);

            calcTextView.Text     = "Change (£) : ";
            calcTextView.TextSize = 20;
            calcTextView.SetTextColor(Color.Black);
            calcTextView.SetPadding(10, 0, 0, 10);

            calcView.AddView(calcTextView);

            change          = new TextView(context);
            change.Text     = "Not calculated";
            change.TextSize = 20;
            change.SetTextColor(Color.Blue);

            calcView.AddView(change);

            AddView(calcView);

            keypad = new TillKeypad(context);
            keypad.SetPadding(15, 0, 0, 0);
            keypad.AlignmentMode      = GridAlign.Bounds;
            keypad.TillButtonClicked += Keypad_TillButtonClicked;

            AddView(keypad);

            keypad.LayoutParameters.Width  = 600;
            keypad.LayoutParameters.Height = 400;

            LinearLayout bottomKeys = new LinearLayout(context);

            bottomKeys.Orientation = Orientation.Horizontal;
            bottomKeys.SetBackgroundColor(Color.White);
            bottomKeys.SetPadding(5, 0, 0, 0);

            Button calcButton = new Button(context);

            calcButton.Text     = "Calc";
            calcButton.TextSize = 20;
            calcButton.Click   += CalcButton_Click;

            bottomKeys.AddView(calcButton);

            Button cancelButton = new Button(context);

            cancelButton.Text     = "Cancel";
            cancelButton.TextSize = 20;
            cancelButton.Click   += CancelButton_Click;

            bottomKeys.AddView(cancelButton);

            Button payButton = new Button(context);

            payButton.Text     = "Pay";
            payButton.TextSize = 20;
            payButton.Click   += PayButton_Click;

            bottomKeys.AddView(payButton);

            AddView(bottomKeys);

            bottomKeys.LayoutParameters.Width  = 600;
            bottomKeys.LayoutParameters.Height = 130;
        }
Exemplo n.º 4
0
        public void SetLayout(Layout layout)
        {
            switch (layout)
            {
            case Activities.Layout.CurrentOrder:
            {
                if (currentView is CurrentOrderLayout)
                {
                    return;
                }

                RemoveAllViews();

                currentView = new CurrentOrderLayout(this.Context);

                AddView(currentView);
                break;
            }

            case Activities.Layout.LiveOrders:
            {
                if (currentView is LiveOrdersLayout)
                {
                    return;
                }
                else if (currentView is CurrentOrderLayout)
                {
                    CurrentOrderLayout orderLayout   = (CurrentOrderLayout)currentView;
                    OrderFragment      orderFragment = orderLayout.OrderFragment;

                    if (orderFragment.CurrentOrder.OrderItems.Count > 0)
                    {
                        if (orderFragment.SaveCurrentOrder(true))
                        {
                            orderFragment.SaveCurrentOrder(false);
                            ((MainActivity)this.Context).AddOrderToQueue(orderFragment.CurrentOrder);
                        }
                    }
                }

                RemoveAllViews();

                currentView = new LiveOrdersLayout(this.Context);

                AddView(currentView);
                break;
            }

            case Activities.Layout.Admin:
            {
                if (currentView is AdminLayout)
                {
                    return;
                }

                RemoveAllViews();

                currentView = new AdminLayout(this.Context);

                AddView(currentView);
                break;
            }

            case Activities.Layout.Reports:
            {
                if (currentView is ReportLayout)
                {
                    return;
                }

                RemoveAllViews();

                currentView = new ReportLayout(this.Context);

                AddView(currentView);
                break;
            }

            default:
            {
                throw new Exception("Invalid layout selected.");
            }
            }
        }