コード例 #1
0
        private static MethodInfo GetThen(Type typeSrc, Type typeResult, SortingDirection direction)
        {
            string name;

            switch (direction)
            {
            case SortingDirection.Asc:
                name = nameof(Queryable.ThenBy);
                break;

            case SortingDirection.Desc:
                name = nameof(Queryable.ThenByDescending);
                break;

            default: throw new NotSupportedException(direction.ToString());
            }
            return(_methodDictionary2.GetOrAdd((name, typeSrc, typeResult, 2), MethodFactory));
        }
コード例 #2
0
ファイル: MainViewModel.cs プロジェクト: aesalazar/FinJS
        /// <summary>
        /// Send call to the server to open the stream if the connection is open and
        /// unpaused; otherwise store the call to use when the connection is (re)established.
        /// </summary>
        /// <returns>Await <see cref="Task"/></returns>
        protected async Task CallForDataStream()
        {
            //Need a dynamic object to properly format the json string
            var filters = new ExpandoObject();

            if (ColumnFilters != null && ColumnFilters.Any())
            {
                var filtersDict = (IDictionary <string, object>)filters;
                foreach (var filter in ColumnFilters)
                {
                    filtersDict.Add(filter.ColumnName, filter);
                }
            }

            //Create the arg list to send to the sever
            var args = new List <object>
            {
                ScrolledRowNumber,
                ScrolledRowNumber + PageRowCount,
                sortDirection.ToString().ToUpper(),
                SortColumnName,
                filters
            };

            var call = new ServerCall(currentId++, ordersStreamCall, args);

            //If the connection is not in a ready state store the call for when it is; otherwise commit
            if (connection.State != WebSocketState.Open || connection.IsUpdatePaused)
            {
                connection.StoreNextServerCall(call);
            }
            else
            {
                IsStreamPaused = true;
                await connection.Send(call);

                //Resume connection update but do not unpause stream until the next orders received event.
                connection.ResumeUpdate();
            }
        }