/// <summary>
        /// Initializes a new instance of the <see cref="PhoenixImperator.Pages.Entities.PositionSelectorPage"/> class.
        /// </summary>
        /// <param name="positionType">Position type.</param>
        /// <param name="selectionAction">Selection action.</param>
        public PositionSelectorPage(Position.PositionFlag positionType, Action<Position> selectionAction)
            : base("Choose Position")
        {
            BackgroundColor = Color.Black;

            ListView listView = AddListViewWithSearchBar (typeof(TextCell), Positions, (sender, e) => {
                Phoenix.Application.PositionManager.Get(((Position)e.Item).Id,(position) => {
                    RootPage.Root.DismissModal();
                    selectionAction(position);
                });
            });
            listView.IsRefreshing = true;

            Button cancelButton = new Button {
                Text = "Cancel",
                TextColor = Color.White
            };

            cancelButton.Clicked += (sender, e) => {
                Device.BeginInvokeOnMainThread(() => {
                    RootPage.Root.DismissModal();
                });
            };

            PageLayout.Children.Add (cancelButton);

            Phoenix.Application.PositionManager.GetPositionsOfType (positionType, (results) => {
                UpdatePositions(results);
                listView.IsRefreshing = false;
            });
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PhoenixImperator.Pages.OrderSelectorPage"/> class.
        /// </summary>
        /// <param name="position">Position.</param>
        public OrderSelectorPage(Position position)
            : base("New Order")
        {
            BackgroundColor = Color.Black;

            AddListViewWithSearchBar (typeof(TextCell), Orders, (sender, e) => {
                Phoenix.Application.OrderTypeManager.Get(((OrderType)e.Item).Id,(orderType) => {
                    Order order = new Order{
                        PositionId = position.Id,
                        OrderType = orderType,
                        OrderTypeId = orderType.Id
                    };
                    OrderEditPage editPage = new OrderEditPage(order);
                    Device.BeginInvokeOnMainThread(() => {
                        RootPage.Root.NextPageAfterModal(editPage);
                    });
                });
            });

            Button cancelButton = new Button {
                Text = "Cancel",
                TextColor = Color.White
            };

            cancelButton.Clicked += (sender, e) => {
                Device.BeginInvokeOnMainThread(() => {
                    RootPage.Root.DismissModal();
                });
            };

            PageLayout.Children.Add (cancelButton);

            Phoenix.Application.OrderTypeManager.GetOrderTypesForPosition ((Position.PositionFlag)position.PositionType, (results) => {
                UpdateOrders(results);
            });
        }
Exemplo n.º 3
0
 /// <summary>
 /// Determines whether this instance is for position of the specified flag.
 /// </summary>
 /// <returns><c>true</c> if this instance is for the position of the specified flag; otherwise, <c>false</c>.</returns>
 /// <param name="flag">Flag.</param>
 public bool IsForPosition(Position.PositionFlag flag)
 {
     return ((Position & (int)flag) != 0);
 }