Esempio n. 1
0
 public void AddVisibleResource(TableState resource)
 {
     lock (this) {
         visibleList.Add(resource);
         visListChange = true;
     }
 }
Esempio n. 2
0
 public void AddDeleteResource(TableState resource)
 {
     lock (this) {
         deleteList.Add(resource);
         delListChange = true;
     }
 }
    public override void PutMessage(GameMsg msg)
    {
        base.PutMessage(msg);

        InteractStatusMsg ismsg = msg as InteractStatusMsg;
        if (ismsg != null)
        {
            if (ismsg.InteractName == "TASK:TABLE:PUTHOME")
            {
                State = TableState.NotInPlace;
                UnityEngine.Debug.Log("IntubationTable.PutMessage() : " + ismsg.InteractName + ", tray is not in place = <" + InPlace + ">");
            }
            if (ismsg.InteractName == "TASK:TABLE:PUTBEDSIDE:COMPLETE")
            {
                State = TableState.InPlace;
                UnityEngine.Debug.Log("IntubationTable.PutMessage() : " + ismsg.InteractName + ", tray is in place = <" + InPlace + ">");
            }
        }

        TaskRequestedMsg trmsg = msg as TaskRequestedMsg;
        if (trmsg != null)
        {
            if (trmsg.Request == "TASK:TABLE:PUTBEDSIDE")
            {
                UnityEngine.Debug.Log("IntubationTable.PutMessage() : TaskRequestMsg=<" + trmsg.Name + "," + trmsg.Request + ">");
            }
        }
    }
Esempio n. 4
0
        public void AddToPot(Player p, double amount, TableState tState)
        {
            //m_pcPotCollection[potIndex].AddToCurrentPot(new Bet(p, amount, tState));
            if (p.State == PlayerState.AllIn)
            {
                if (this.CurrentPot.Cap == -1)
                    this.CurrentPot.Cap = amount;
                else if (this.CurrentPot.Cap > amount)
                {
                    this.CurrentPot.Cap = amount;
                    //Cap has been reduced, must shift the pots right.
                    this.reducePotCap(amount, m_intPotIndex);
                }
            }

            if (this.CurrentPot.IsCapped && amount > this.CurrentPot.Cap)
            {
                double firstBet = this.CurrentPot.Cap;
                double secondBet = amount - firstBet;

                this.CurrentPot.AddToCurrentPot(new Bet(p, firstBet, tState));
                this.nextPot.AddToCurrentPot(new Bet(p, secondBet, tState));
            }
            else if (this.CurrentPot.IsCapped && amount < this.CurrentPot.Cap)
                throw new InvalidOperationException("The Player can only bet less than the Pot Cap if she/he is AllIn.");
            else
            {
                //The Pot is not capped, bet whatever you wish
                this.CurrentPot.AddToCurrentPot(new Bet(p, amount, tState));
                //this.CurrentPot.AddToCurrentPot(new Bet(p, firstBet, tState));
            }
        }
        public void ChageState(TableState pState)
        {
            state = pState;
            hide = pState.ToString();

            //~ synchronize to db, if need to maintain the state in db
            DataContextDataContext dc = new DataContextDataContext();
            dc.update_state_table(id, (int?)state);
        }
        public SysTable(Guid pId, string pName, int pSeat, string pPictPath, TableState pState)
        {
            id = pId;
            name = pName;
            seat = pSeat;
            pictPath = pPictPath;
            state = pState;

            hide = state.ToString();
        }
Esempio n. 7
0
        protected async Task <TableData <T> > ServerReload(TableState state)
        {
            switch (state.SortDirection)
            {
            case SortDirection.Ascending:
                if (orderBy != state.SortLabel)
                {
                    table.CurrentPage = 0;
                }

                orderBy           = state.SortLabel;
                orderByDescending = null;
                break;

            case SortDirection.Descending:
                if (orderByDescending != state.SortLabel)
                {
                    table.CurrentPage = 0;
                }

                orderByDescending = state.SortLabel;
                orderBy           = null;
                break;

            case SortDirection.None:
                if (orderBy != null || orderByDescending != null)
                {
                    table.CurrentPage = 0;
                }

                orderBy           = null;
                orderByDescending = null;
                break;
            }

            await OnPage(state.Page, state.PageSize);

            return(new TableData <T>()
            {
                TotalItems = totalItemsCount, Items = items
            });
        }
Esempio n. 8
0
 private void AskWin_EventPickUpTable(object sender, EventArgs e)
 {
     try
     {
         TableState tableState = new TableState();
         tableState.TableName    = MediatorSema.UsingTable.TableName;
         tableState.UserName     = Environment.UserName;
         tableState.StartTime    = String.Format("{0:G}", DateTime.Now);
         tableState.Path         = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
         MediatorSema.UsingTable = tableState;
         ManagerDb.UpdateTableState();
         MediatorSema.IsTableMy       = true;
         MediatorSema.CurrentFileType = FileType.Bat;
         GetFiles();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "AskWin_EventPickUpTable() Exception", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 9
0
      internal static bool IsTableFree(string tableName)
      {
          bool isFree = true;

          try
          {
              TableState tableState = GetTableState(tableName);
              if (tableState != null)
              {
                  isFree = false;
              }
              MediatorSema.UsingTable = tableState;
              MediatorSema.IsTableMy  = isFree;
          }
          catch (Exception)
          {
              throw;
          }
          return(isFree);
      }
Esempio n. 10
0
        private async Task <TableData <TableUser> > TableData(TableState state)
        {
            var users = this.UsersState.Value.Users;

            if (users == null)
            {
                return(await Task.FromResult(new TableData <TableUser>
                {
                    TotalItems = 0,
                    Items = Array.Empty <TableUser>(),
                }));
            }

            users = state.SortLabel switch
            {
                nameof(ApplicationUser.UserName) =>
                users.OrderByDirection(state.SortDirection, i => i.UserName),
                _ =>
                users.OrderBy(i => i.UserName),
            };

            var skip          = state.Page * state.PageSize;
            var take          = state.PageSize;
            var selectedUsers = users.Skip(skip).Take(take).ToList();

            List <TableUser> tableUsers = new();

            foreach (ApplicationUser user in selectedUsers)
            {
                var roles = await this.UsersService.GetUserRoles(user);

                tableUsers.Add(new TableUser(user, roles));
            }

            return(await Task.FromResult(new TableData <TableUser>
            {
                TotalItems = users.Count(),
                Items = tableUsers,
            }));
        }
Esempio n. 11
0
        private static TableState CreateState(FilterInfo filter, bool hasConsolidated)
        {
            TableState tState = new TableState();

            tState.Filter = filter;

            if (hasConsolidated)
            {
                tState.Columns.AddRange(new[] {
                    new ColumnInfo("Invoice #", "invoiceno", true, true),
                    new ColumnInfo("Trx Date", "trxdate", true, true),
                    new ColumnInfo("Ship Date", "shipdate", true, true),
                    new ColumnInfo("Master PO #", "releasenum", true, true),
                    new ColumnInfo("PO #", "ponumber", true, true),
                    new ColumnInfo("BOL #", "bolnumber", true, true),
                    new ColumnInfo("SCAC", "scaccode", true, true),
                    new ColumnInfo("Type", "xfertype", false, true),
                    new ColumnInfo("Status", "hprocessed", false, false),
                    new ColumnInfo("Errors", "msg", false, false)
                });
            }
            else
            {
                tState.Columns.AddRange(new[] {
                    new ColumnInfo("Invoice #", "invoiceno", true, true),
                    new ColumnInfo("Trx Date", "trxdate", true, true),
                    new ColumnInfo("Ship Date", "shipdate", true, true),
                    new ColumnInfo("PO #", "ponumber", true, true),
                    new ColumnInfo("BOL #", "bolnumber", true, true),
                    new ColumnInfo("SCAC", "scaccode", true, true),
                    new ColumnInfo("Type", "xfertype", false, true),
                    new ColumnInfo("Status", "hprocessed", false, false),
                    new ColumnInfo("Errors", "msg", false, false)
                });
            }

            return(tState);
        }
Esempio n. 12
0
        public TableRendererTest()
        {
            ITableNodeParser nodeParser = Substitute.For <ITableNodeParser>();

            _tableState = new TableState
            {
                Filter   = new Dictionary <string, string>(), Page = 1, PageSize = 3,
                SortProp = "SortProp", AscSort = true
            };
            _tableConfig = Substitute.For <ITableConfig <TableEntity> >();
            _tableConfig.Columns.Returns(new Dictionary <string, ColumnConfig>());
            _tableConfig.Paging.Returns(new PagingConfig());
            _tableConfig.Footer.Returns(new FooterConfig());
            _tableConfig.Sorting.Returns(new SortingConfig());
            _tableConfig.Update.Returns(new UpdateConfig
            {
                Url   = "Url", BusyIndicatorId = "BusyId", Start = "start", Success = "success",
                Error = "error",
            });
            _tableConfig.Paging.Returns(new PagingConfig());
            nodeParser.Parse(Arg.Do <IEnumerable <TableNode> >(n => _nodes = n)).Returns(new HtmlString("Content"));
            _renderer = new TableRenderer <TableEntity>(_tableState, nodeParser);
        }
Esempio n. 13
0
    /// <summary>
    /// Starts this state.
    /// </summary>
    public override void StartThisState()
    {
        base.StartThisState();

        startTime = Time.time + 2f;

        stateOfTable = gameMode.StateOfTable;

        // gets the last state balls and positions
        Vector3[]   ballsPositions = stateOfTable.BallPositions;
        Transform[] balls          = gameMode.Balls;

        for (int i = 0; i < balls.Length; i++)
        {
            balls [i].position = ballsPositions [i];
        }

        Vector3 offset = stateOfTable.Cameraoffset;

        cameraTransition.Reset(offset, Quaternion.LookRotation(-offset));

        StartCoroutine(delayedShoot());
    }
Esempio n. 14
0
        public bool Evaluate(IPlay <TicTacToe> play, TableState <TicTacToe> tableState)
        {
            var ttt_play       = play as TicTacToePlay;
            var ttt_tableState = tableState as TicTacToeTableState;

            //verifica que no se salga de los límites del tablero
            if (ttt_play.Row >= 0 && ttt_play.Row < ttt_tableState.CountRows && ttt_play.Column >= 0 && ttt_play.Column < ttt_tableState.CountColumns)
            {
                //verifica que en esa posición no haya nada
                if (ttt_tableState[ttt_play.Row, ttt_play.Column] != null)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
Esempio n. 15
0
        public bool Evaluate(IPlay <FourInLine> play, TableState <FourInLine> tableState)
        {
            var f_play       = play as FourInLinePlay;
            var f_tableState = tableState as FourInLineTableState;

            //verifica que no se salga de los límites del tablero
            if (f_play.Column >= 0 && f_play.Column < f_tableState.CountColumns)
            {
                //verifica que en esa columna no esté llena
                for (int i = 0; i < f_tableState.CountColumns; i++)
                {
                    if (f_tableState[i, f_play.Column] == null)
                    {
                        return(true);
                    }
                }

                return(false);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 16
0
        public ITable Delete()
        {
            State = TableState.Deleted;

            return(this);
        }
Esempio n. 17
0
 public PanOperation(TableState state)
 {
     _state = state;
 }
Esempio n. 18
0
 public TexasHoldemRoutine(TexasHoldemTable table, TableState newState)
     : base(table, newState)
 {
     Table = table;
 }
        private async Task LoadData(int pageNumber, int pageSize, TableState state)
        {
            var request = new GetAllPagedProductsRequest {
                PageSize = pageSize, PageNumber = pageNumber + 1
            };
            var response = await _productManager.GetProductsAsync(request);

            if (response.Succeeded)
            {
                totalItems  = response.TotalCount;
                currentPage = response.CurrentPage;
                var data       = response.Data;
                var loadedData = data.Where(element =>
                {
                    if (string.IsNullOrWhiteSpace(searchString))
                    {
                        return(true);
                    }
                    if (element.Name?.Contains(searchString, StringComparison.OrdinalIgnoreCase) == true)
                    {
                        return(true);
                    }
                    if (element.Description?.Contains(searchString, StringComparison.OrdinalIgnoreCase) == true)
                    {
                        return(true);
                    }
                    if (element.Barcode?.Contains(searchString, StringComparison.OrdinalIgnoreCase) == true)
                    {
                        return(true);
                    }
                    return(false);
                });
                switch (state.SortLabel)
                {
                case "productIdField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, p => p.Id);
                    break;

                case "productNameField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, p => p.Name);
                    break;

                case "productBrandField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, p => p.Brand);
                    break;

                case "productDescriptionField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, p => p.Description);
                    break;

                case "productBarcodeField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, p => p.Barcode);
                    break;

                case "productRateField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, p => p.Rate);
                    break;
                }
                data      = loadedData.ToList();
                pagedData = data;
            }
            else
            {
                foreach (var message in response.Messages)
                {
                    _snackBar.Add(localizer[message], Severity.Error);
                }
            }
        }
Esempio n. 20
0
            public BaseGameRoutine(BaseGameTable table, TableState newState)
            {
                Table = table;

                RoutineState = newState;
            }
Esempio n. 21
0
		/*/// <summary>
		/// Specifies whether pressing the Tab key while editing moves the 
		/// editor to the next available cell
		/// </summary>
		private bool tabMovesEditor;*/

		#endregion

		#endregion


		#region Constructor

		/// <summary>
		/// Initializes a new instance of the Table class with default settings
		/// </summary>
		public Table()
		{
			// starting setup
			this.init = true;
			
			// This call is required by the Windows.Forms Form Designer.
			components = new System.ComponentModel.Container();

			//
			this.SetStyle(ControlStyles.UserPaint, true);
			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.DoubleBuffer, true);
			this.SetStyle(ControlStyles.ResizeRedraw, true);
			this.SetStyle(ControlStyles.Selectable, true);
			this.TabStop = true;

			this.Size = new Size(150, 150);

			this.BackColor = Color.White;

			//
			this.columnModel = null;
			this.tableModel = null;

			// header
			this.headerStyle = ColumnHeaderStyle.Clickable;
			this.headerFont = this.Font;
			this.headerRenderer = new XPHeaderRenderer();
			//this.headerRenderer = new GradientHeaderRenderer();
			//this.headerRenderer = new FlatHeaderRenderer();
			this.headerRenderer.Font = this.headerFont;
			this.headerContextMenu = new HeaderContextMenu();
			
			this.columnResizing = true;
			this.resizingColumnIndex = -1;
			this.resizingColumnWidth = -1;
			this.hotColumn = -1;
			this.pressedColumn = -1;
			this.lastSortedColumn = -1;
			this.sortedColumnBackColor = Color.WhiteSmoke;

			// borders
			this.borderStyle = BorderStyle.Fixed3D;

			// scrolling
			this.scrollable = true;

			this.hScrollBar = new HScrollBar();
			this.hScrollBar.Visible = false;
			this.hScrollBar.Location = new Point(this.BorderWidth, this.Height - this.BorderWidth - SystemInformation.HorizontalScrollBarHeight);
			this.hScrollBar.Width = this.Width - (this.BorderWidth * 2) - SystemInformation.VerticalScrollBarWidth;
			this.hScrollBar.Scroll += new ScrollEventHandler(this.OnHorizontalScroll);
			this.Controls.Add(this.hScrollBar);

			this.vScrollBar = new VScrollBar();
			this.vScrollBar.Visible = false;
			this.vScrollBar.Location = new Point(this.Width - this.BorderWidth - SystemInformation.VerticalScrollBarWidth, this.BorderWidth);
			this.vScrollBar.Height = this.Height - (this.BorderWidth * 2) - SystemInformation.HorizontalScrollBarHeight;
			this.vScrollBar.Scroll += new ScrollEventHandler(this.OnVerticalScroll);
			this.Controls.Add(this.vScrollBar);

			//
			this.gridLines = GridLines.None;;
			this.gridColor = SystemColors.Control;
			this.gridLineStyle = GridLineStyle.Solid;

			this.allowSelection = true;
			this.multiSelect = false;
			this.fullRowSelect = false;
			this.hideSelection = false;
			this.selectionBackColor = SystemColors.Highlight;
			this.selectionForeColor = SystemColors.HighlightText;
			this.unfocusedSelectionBackColor = SystemColors.Control;
			this.unfocusedSelectionForeColor = SystemColors.ControlText;
			this.selectionStyle = SelectionStyle.ListView;
			this.alternatingRowColor = Color.Transparent;

			// current table state
			this.tableState = TableState.Normal;

			this.lastMouseCell = new CellPos(-1, -1);
			this.lastMouseDownCell = new CellPos(-1, -1);
			this.focusedCell = new CellPos(-1, -1);
			this.hoverTime = 1000;
			this.trackMouseEvent = null;
			this.ResetMouseEventArgs();

			this.toolTip = new ToolTip(this.components);
			this.toolTip.Active = false;
			this.toolTip.InitialDelay = 1000;

			this.noItemsText = "There are no items in this view";

			this.editingCell = new CellPos(-1, -1);
			this.curentCellEditor = null;
			this.editStartAction = EditStartAction.DoubleClick;
			this.customEditKey = Keys.F5;
			//this.tabMovesEditor = true;

			// finished setting up
			this.beginUpdateCount = 0;
			this.init = false;
			this.preview = false;
		}
Esempio n. 22
0
 public void Mark(TableSquare square, TableState state)
 {
     States[square.SquareNumber] = state;
 }
        public override async Task <TableData <ISpellsPage> > GetPage(SpellSortInput[] sortInputs, TableState state, string searchTerm)
        {
            IOperationResult <IGetSpellsPageWithTraditionResult> result = await PathfinderReferenceApi.GetSpellsPageWithTradition
                                                                          .ExecuteAsync(state.Page *state.PageSize, state.PageSize, MagicTraditionId, searchTerm, sortInputs);

            if (result?.Data?.Spells == null)
            {
                return(EmptyPage());
            }

            TableData <ISpellsPage> page = new TableData <ISpellsPage>()
            {
                TotalItems = result.Data !.Spells !.TotalCount,
                Items      = result.Data !.Spells !.Items !
            };

            return(page);
        }
    }
Esempio n. 24
0
        public override async Task <TableData <IDeitiesPage> > GetPage(DeitySortInput[] sortInputs, TableState state, string searchTerm)
        {
            IOperationResult <IGetDeitiesPageWithDivineFontResult> result = await PathfinderReferenceApi.GetDeitiesPageWithDivineFont
                                                                            .ExecuteAsync(state.Page *state.PageSize, state.PageSize, DivineFontName, searchTerm, sortInputs);

            if (result.Data?.Deities == null)
            {
                return(EmptyPage());
            }

            TableData <IDeitiesPage> page = new TableData <IDeitiesPage>()
            {
                TotalItems = result.Data !.Deities !.TotalCount,
                Items      = result.Data !.Deities !.Items !
            };

            return(page);
        }
    }
        public override async Task <TableData <IRangedWeaponsPage> > GetPage(RangedWeaponSortInput[] sortInputs, TableState state, string searchTerm)
        {
            IOperationResult <IGetRangedWeaponsPageResult> result = await PathfinderReferenceApi.GetRangedWeaponsPage
                                                                    .ExecuteAsync(state.Page *state.PageSize, state.PageSize, searchTerm, sortInputs);

            if (result?.Data?.RangedWeapons == null)
            {
                return(EmptyPage());
            }

            TableData <IRangedWeaponsPage> page = new TableData <IRangedWeaponsPage>()
            {
                TotalItems = result.Data !.RangedWeapons !.TotalCount,
                Items      = result.Data !.RangedWeapons !.Items !
            };

            return(page);
        }
    }
Esempio n. 26
0
 public BettingRoundRoutine(TexasHoldemTable table, TableState newState)
     : base(table, newState)
 {
     TurnCounter = new Dictionary<string, int>();
 }
        // IHasTableStateExtensions

        public static ComponentBuilder <TConfig, TTag> SetState <TConfig, TTag>(this ComponentBuilder <TConfig, TTag> builder, TableState state)
            where TConfig : BootstrapConfig
            where TTag : Tag, IHasTableStateExtensions
        {
            builder.Component.ToggleCss(state);
            return(builder);
        }
Esempio n. 28
0
 public void StartDispatch()
 {
     dispatcher.Dispatch(CardEvent.DispatchStart);
     state = TableState.Dispatching;
 }
Esempio n. 29
0
 public Bet(Player player, double value, TableState tState)
 {
     this.Player = player;
     this.Value = value;
     this.TableState = tState;
 }
Esempio n. 30
0
 public TurnRiverOrFlopRoutine(TexasHoldemTable table, TableState newState)
     : base(table, newState)
 {
 }
Esempio n. 31
0
 /// <summary>
 /// Raise by the minimum bet.
 /// </summary>
 /// <param name="hand">My hand.</param>
 /// <param name="state">The table state.</param>
 /// <returns>A raise by the minimum bet.</returns>
 public TurnAction DoAction(Card[] hand, TableState state)
 {
     return(TurnAction.Raise(state.MinimumBet));
 }
Esempio n. 32
0
		/// <summary>
		/// Calculates the state of the Table at the specified 
		/// client coordinates
		/// </summary>
		/// <param name="x">The client x coordinate</param>
		/// <param name="y">The client y coordinate</param>
		protected void CalcTableState(int x, int y)
		{
			TableRegion region = this.HitTest(x, y);

			// are we in the header
			if (region == TableRegion.ColumnHeader)
			{
				int column = this.ColumnIndexAt(x, y);

				// get out of here if we aren't in a column
				if (column == -1)
				{
					this.TableState = TableState.Normal;

					return;
				}

				// get the bounding rectangle for the column's header
				Rectangle columnRect = this.ColumnModel.ColumnHeaderRect(column);
				x = this.ClientToDisplayRect(x, y).X;

				// are we in a resizing section on the left
				if (x < columnRect.Left + Column.ResizePadding)
				{
					this.TableState = TableState.ColumnResizing;
					
					while (column != 0)
					{
						if (this.ColumnModel.Columns[column-1].Visible)
						{
							break;
						}

						column--;
					}

					// if we are in the first visible column or the next column 
					// to the left is disabled, then we should be potentialy 
					// selecting instead of resizing
					if (column == 0 || !this.ColumnModel.Columns[column-1].Enabled)
					{
						this.TableState = TableState.ColumnSelecting;
					}
				}
					// or a resizing section on the right
				else if (x > columnRect.Right - Column.ResizePadding)
				{
					this.TableState = TableState.ColumnResizing;
				}
					// looks like we're somewhere in the middle of 
					// the column header
				else
				{
					this.TableState = TableState.ColumnSelecting;
				}
			}
			else if (region == TableRegion.Cells)
			{
				this.TableState = TableState.Selecting;
			}
			else
			{
				this.TableState = TableState.Normal;
			}

			if (this.TableState == TableState.ColumnResizing && !this.ColumnResizing)
			{
				this.TableState = TableState.ColumnSelecting;
			}
		}
Esempio n. 33
0
 public void OnTableFilled()
 {
     State = TableState.Filled;
     TableFilled?.Invoke(this, new EventArgs());
 }
Esempio n. 34
0
 public void Mark(int pos, TableState state)
 {
     States[pos] = state;
 }
Esempio n. 35
0
 public Table(Table table)
 {
     States = new TableState[CantSquares];
     Array.Copy(table.States, States, CantSquares);
 }
Esempio n. 36
0
 public Table(int tableID, TableState tableState)
 {
     TableID    = tableID;
     TableState = tableState;
 }
Esempio n. 37
0
 private async void Table_TableStateChanged(object sender, EventArgs e)
 {
     this.tableState = this.table.TableState;
     await this.RefreshAsync();
 }
Esempio n. 38
0
        private async Task LoadData(int pageNumber, int pageSize, TableState state)
        {
            var request = new GetAllPagedDocumentsRequest {
                PageSize = pageSize, PageNumber = pageNumber + 1
            };
            var response = await _documentManager.GetAllAsync(request);

            if (response.Succeeded)
            {
                totalItems  = response.TotalCount;
                currentPage = response.CurrentPage;
                var data       = response.Data;
                var loadedData = data.Where(element =>
                {
                    if (string.IsNullOrWhiteSpace(searchString))
                    {
                        return(true);
                    }
                    if (element.Title.Contains(searchString, StringComparison.OrdinalIgnoreCase))
                    {
                        return(true);
                    }
                    if (element.Description.Contains(searchString, StringComparison.OrdinalIgnoreCase))
                    {
                        return(true);
                    }
                    return(false);
                });
                switch (state.SortLabel)
                {
                case "documentIdField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, d => d.Id);
                    break;

                case "documentTitleField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, d => d.Title);
                    break;

                case "documentDescriptionField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, d => d.Description);
                    break;

                case "documentIsPublicField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, d => d.IsPublic);
                    break;

                case "documentDateCreatedField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, d => d.CreatedOn);
                    break;

                case "documentOwnerField":
                    loadedData = loadedData.OrderByDirection(state.SortDirection, d => d.CreatedBy);
                    break;
                }
                data      = loadedData.ToList();
                pagedData = data;
            }
            else
            {
                foreach (var message in response.Messages)
                {
                    _snackBar.Add(localizer[message], Severity.Error);
                }
            }
        }
Esempio n. 39
0
 /// <summary>
 /// Call.
 /// </summary>
 /// <param name="hand">My hand.</param>
 /// <param name="state">The table state.</param>
 /// <returns>Calling.</returns>
 public TurnAction DoAction(Card[] hand, TableState state)
 {
     return(TurnAction.Call);
 }
Esempio n. 40
0
        public override async Task <TableData <IArmorsPage> > GetPage(ArmorSortInput[] sortInputs, TableState state, string searchTerm)
        {
            IOperationResult <IGetArmorPageWithCategoryResult> result = await PathfinderReferenceApi.GetArmorPageWithCategory
                                                                        .ExecuteAsync(state.Page *state.PageSize, state.PageSize, WeaponCategoryId, searchTerm, sortInputs);

            if (result.Data?.Armors == null)
            {
                return(EmptyPage());
            }

            TableData <IArmorsPage> page = new TableData <IArmorsPage>()
            {
                TotalItems = result.Data !.Armors !.TotalCount,
                Items      = result.Data !.Armors !.Items !
            };

            return(page);
        }
    }
Esempio n. 41
0
        public override bool Match(InlineProcessor processor, ref StringSlice slice)
        {
            // Only working on Paragraph block
            if (!(processor.Block is ParagraphBlock))
            {
                return(false);
            }

            var c = slice.CurrentChar;

            // If we have not a delimiter on the first line of a paragraph, don't bother to continue
            // tracking other delimiters on following lines
            var  tableState       = processor.ParserStates[Index] as TableState;
            bool isFirstLineEmpty = false;


            int globalLineIndex;
            int column;
            var position       = processor.GetSourcePosition(slice.Start, out globalLineIndex, out column);
            var localLineIndex = globalLineIndex - processor.LineIndex;

            if (tableState == null)
            {
                // A table could be preceded by an empty line or a line containing an inline
                // that has not been added to the stack, so we consider this as a valid
                // start for a table. Typically, with this, we can have an attributes {...}
                // starting on the first line of a pipe table, even if the first line
                // doesn't have a pipe
                if (processor.Inline != null && (localLineIndex > 0 || c == '\n'))
                {
                    return(false);
                }

                if (processor.Inline == null)
                {
                    isFirstLineEmpty = true;
                }
                // Else setup a table processor
                tableState = new TableState();
                processor.ParserStates[Index] = tableState;
            }

            if (c == '\n')
            {
                if (!isFirstLineEmpty && !tableState.LineHasPipe)
                {
                    tableState.IsInvalidTable = true;
                }
                tableState.LineHasPipe = false;
                lineBreakParser.Match(processor, ref slice);
                tableState.LineIndex++;
                if (!isFirstLineEmpty)
                {
                    tableState.ColumnAndLineDelimiters.Add(processor.Inline);
                    tableState.EndOfLines.Add(processor.Inline);
                }
            }
            else
            {
                processor.Inline = new PipeTableDelimiterInline(this)
                {
                    Span           = new SourceSpan(position, position),
                    Line           = globalLineIndex,
                    Column         = column,
                    LocalLineIndex = localLineIndex
                };
                var deltaLine = localLineIndex - tableState.LineIndex;
                if (deltaLine > 0)
                {
                    tableState.IsInvalidTable = true;
                }
                tableState.LineHasPipe = true;
                tableState.LineIndex   = localLineIndex;
                slice.NextChar(); // Skip the `|` character

                tableState.ColumnAndLineDelimiters.Add(processor.Inline);
            }


            return(true);
        }
Esempio n. 42
0
 public void SetTableState(TableState tableState)
 {
     base.TableState = tableState;
 }
Esempio n. 43
0
        public override async Task <TableData <IHazardsPage> > GetPage(HazardSortInput[] sortInputs, TableState state, string searchTerm)
        {
            IOperationResult <IGetHazardsWithComplexityPageResult> result = await PathfinderReferenceApi.GetHazardsWithComplexityPage
                                                                            .ExecuteAsync(state.Page *state.PageSize, state.PageSize, HazardComplexityId, searchTerm, sortInputs);

            if (result.Data?.Hazards == null)
            {
                return(EmptyPage());
            }

            TableData <IHazardsPage> page = new TableData <IHazardsPage>()
            {
                TotalItems = result.Data !.Hazards !.TotalCount,
                Items      = result.Data !.Hazards !.Items !
            };

            return(page);
        }
    }