Пример #1
0
        /// <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;
            });
        }
Пример #2
0
        /// <summary>
        /// Gets the order types for position.
        /// </summary>
        /// <param name="positionFlag">Position flag.</param>
        /// <param name="callback">Callback.</param>
        public async void GetOrderTypesForPosition(Position.PositionFlag positionFlag, Action <IEnumerable <OrderType> > callback)
        {
            List <OrderType> orderTypes = await GetDataManager().GetItems(null, true);

            IEnumerable <OrderType> results = from element in orderTypes
                                              where element.IsForPosition(positionFlag)
                                              select element;

            callback(results);
        }
Пример #3
0
 /// <summary>
 /// Gets the type of the positions of.
 /// </summary>
 /// <returns>The positions of type.</returns>
 /// <param name="positionType">Position type.</param>
 public static List <Position> GetPositionsOfType(Position.PositionFlag positionType)
 {
     if (positionType != Position.PositionFlag.None)
     {
         return(Query <Position> ("select p.* from Position p where p.PositionType = ? order by p.Name asc", positionType));
     }
     else
     {
         return(Query <Position> ("select p.* from Position p order by p.Name asc"));
     }
 }
Пример #4
0
 /// <summary>
 /// Gets the type of the positions of.
 /// </summary>
 /// <returns>The positions of type.</returns>
 /// <param name="positionType">Position type.</param>
 public Task <List <Position> > GetPositionsOfType(Position.PositionFlag positionType)
 {
     return(Task <List <Position> > .Factory.StartNew(() => {
         return DL.PhoenixDatabase.GetPositionsOfType(positionType);
     }));
 }
Пример #5
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);
 }
Пример #6
0
        /// <summary>
        /// Gets the type of the positions of.
        /// </summary>
        /// <param name="positionType">Position type.</param>
        /// <param name="callback">Callback.</param>
        public async void GetPositionsOfType(Position.PositionFlag positionType, Action <IEnumerable <Position> > callback)
        {
            List <Position> list = await GetPositionDataManager().GetPositionsOfType(positionType);

            callback(list);
        }