Пример #1
0
 public ConnectionSettings MapDefaultTypeNames(Action<FluentDictionary<Type, string>> mappingSelector)
 {
     mappingSelector.ThrowIfNull("mappingSelector");
     mappingSelector(this.DefaultTypeNames);
     return this;
 }
Пример #2
0
 /// <summary>
 /// Initializes new instance of <see cref="ActionCommand"/>.
 /// </summary>
 /// <param name="action">Action to execute.</param>
 /// <param name="condition">Condition that must be met.</param>
 public ActionCommand(Action action, Func <bool> condition)
 {
     _action    = action.ThrowIfNull(nameof(action));
     _condition = condition;
 }
Пример #3
0
 /// <summary>
 /// Get delta order book bids and asks via web socket. Only the deltas are returned for each callback. To manage a full order book, use ExchangeAPIExtensions.GetOrderBookWebSocket.
 /// </summary>
 /// <param name="callback">Callback of symbol, order book</param>
 /// <param name="maxCount">Max count of bids and asks - not all exchanges will honor this parameter</param>
 /// <param name="symbol">Ticker symbols or null/empty for all of them (if supported)</param>
 /// <returns>Web socket, call Dispose to close</returns>
 public virtual IWebSocket GetOrderBookWebSocket(Action <ExchangeOrderBook> callback, int maxCount = 20, params string[] symbols)
 {
     callback.ThrowIfNull(nameof(callback), "Callback must not be null");
     return(OnGetOrderBookWebSocket(callback, maxCount, symbols));
 }
Пример #4
0
 public void Fetch([NotNull] Credentials credentials, [NotNull] Action <Response <int[]> > callback)
 {
     callback.ThrowIfNull();
     Wrap(FetchAsync(credentials), callback);
 }
Пример #5
0
 /// <summary>
 /// Registers the profile with the specified name.
 /// </summary>
 /// <param name="name">The name of the SI profile to register.</param>
 /// <param name="cb">A callback method invoked whenever an initiation
 /// request for the specified profile is received.</param>
 /// <exception cref="ArgumentNullException">The name parameter or the
 /// cb parameter is null.</exception>
 /// <exception cref="ArgumentException">A profile with the specified name
 /// has already been registered.</exception>
 public void RegisterProfile(string name, Action <Jid, XmlElement, Action <XmlElement> > cb)
 {
     name.ThrowIfNull("name");
     cb.ThrowIfNull("cb");
     profiles.Add(name, cb);
 }
Пример #6
0
 /// <summary>
 /// Get all tickers via web socket
 /// </summary>
 /// <param name="callback">Callback</param>
 /// <returns>Web socket, call Dispose to close</returns>
 public virtual IWebSocket GetTickersWebSocket(Action <IReadOnlyCollection <KeyValuePair <string, ExchangeTicker> > > callback)
 {
     callback.ThrowIfNull(nameof(callback), "Callback must not be null");
     return(OnGetTickersWebSocket(callback));
 }
        public static async ValueTask Continue(this ValueTask task, Action action)
        {
            await task;

            action.ThrowIfNull(nameof(action)).Invoke();
        }
Пример #8
0
 /// <summary>
 /// Get the details of all changed orders via web socket
 /// </summary>
 /// <param name="callback">Callback</param>
 /// <returns>Web socket, call Dispose to close</returns>
 public virtual Task <IWebSocket> GetOrderDetailsWebSocketAsync(Action <ExchangeOrderResult> callback)
 {
     callback.ThrowIfNull(nameof(callback), "Callback must not be null");
     return(OnGetOrderDetailsWebSocketAsync(callback));
 }
Пример #9
0
 public RelayCommand(Action <object> execute, Func <object, bool> canExecute = null)
 {
     _execute    = execute.ThrowIfNull("execute");
     _canExecute = canExecute;
 }
        public static async ValueTask Continue <T>(this ValueTask <T> task, Action <T> action)
        {
            var value = await task;

            action.ThrowIfNull(nameof(action)).Invoke(value);
        }
Пример #11
0
 public Commands(DirectoryInfo directory, IFileUtil fileUtil, Action <string> writeLine)
 {
     _directory = directory.ThrowIfNull(nameof(directory));
     _fileUtil  = fileUtil.ThrowIfNull(nameof(fileUtil));
     _writeLine = writeLine.ThrowIfNull(nameof(writeLine));
 }
Пример #12
0
        public override void IfSuccess(Action <T> sideEffect)
        {
            sideEffect.ThrowIfNull(nameof(sideEffect));

            sideEffect(_value);
        }
Пример #13
0
 /// <summary>
 /// Executes the given action on each element in the source sequence
 /// and yields it.
 /// </summary>
 /// <remarks>
 /// The returned sequence is essentially a duplicate of
 /// the original, but with the extra action being executed while the
 /// sequence is evaluated. The action is always taken before the element
 /// is yielded, so any changes made by the action will be visible in the
 /// returned sequence. This operator uses deferred execution and streams it results.
 /// </remarks>
 /// <typeparam name="T">The type of the elements in the sequence</typeparam>
 /// <param name="source">The sequence of elements</param>
 /// <param name="action">The action to execute on each element</param>
 public static IEnumerable <T> Pipe <T> (this IEnumerable <T> source, Action <T> action)
 {
     source.ThrowIfNull("source");
     action.ThrowIfNull("action");
     return(PipeImpl(source, action));
 }
Пример #14
0
 /// <summary>
 /// Get all tickers via web socket
 /// </summary>
 /// <param name="callback">Callback</param>
 /// <param name="symbols"></param>
 /// <returns>Web socket, call Dispose to close</returns>
 public virtual Task <IWebSocket> GetTickersWebSocketAsync(Action <IReadOnlyCollection <KeyValuePair <string, ExchangeTicker> > > callback, params string[] symbols)
 {
     callback.ThrowIfNull(nameof(callback), "Callback must not be null");
     return(OnGetTickersWebSocketAsync(callback, symbols));
 }
Пример #15
0
            /// <summary>
            /// Provides a delegate that maps the member.
            /// </summary>
            /// <param name="mapDelegate">An <see cref="Action{TTarget,TSource}"/> that maps the member.</param>
            /// <exception cref="ArgumentNullException">Thrown when <paramref name="mapDelegate"/> is null.</exception>
            public void ByInvoking(Action <TTarget, TSource> mapDelegate)
            {
                mapDelegate.ThrowIfNull("mapDelegate");

                _configuration._memberMappingActionsByMemberName[_memberName] = new MemberMappingAction <TTarget, TSource>(_memberName, mapDelegate);
            }
Пример #16
0
 /// <summary>
 /// Get delta order book bids and asks via web socket. Only the deltas are returned for each callback. To manage a full order book, use ExchangeAPIExtensions.GetOrderBookWebSocket.
 /// </summary>
 /// <param name="callback">Callback of symbol, order book</param>
 /// <param name="maxCount">Max count of bids and asks - not all exchanges will honor this parameter</param>
 /// <param name="marketSymbols">Market symbols or null/empty for all of them (if supported)</param>
 /// <returns>Web socket, call Dispose to close</returns>
 public virtual Task <IWebSocket> GetDeltaOrderBookWebSocketAsync(Action <ExchangeOrderBook> callback, int maxCount = 20, params string[] marketSymbols)
 {
     callback.ThrowIfNull(nameof(callback), "Callback must not be null");
     return(OnGetDeltaOrderBookWebSocketAsync(callback, maxCount, marketSymbols));
 }
Пример #17
0
        /// <summary>
        /// Adds the specified delegate as a custom mapping delegate.
        /// </summary>
        /// <param name="customDelegate">A delegate.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="customDelegate"/> is null.</exception>
        public void AddCustomActionDelegate(Action <TTarget, TSource> customDelegate)
        {
            customDelegate.ThrowIfNull("customDelegate");

            _customMemberMappingActions.Add(new MemberMappingAction <TTarget, TSource>(null, customDelegate));
        }
Пример #18
0
 /// <summary>
 /// Get user detail over web socket
 /// </summary>
 /// <param name="callback">Callback</param>
 /// <param name="listenKey">Listen key</param>
 /// <returns>Web socket, call Dispose to close</returns>
 public virtual Task <IWebSocket> GetUserDataWebSocketAsync(Action <object> callback, string listenKey)
 {
     callback.ThrowIfNull(nameof(callback), "Callback must not be null");
     return(OnUserDataWebSocketAsync(callback, listenKey));
 }
Пример #19
0
        public ToastContext(Action closeAction)
        {
            closeAction.ThrowIfNull();

            _closeAction = closeAction;
        }
Пример #20
0
 public Disposer(Action <T> dispose)
 {
     _dispose = dispose.ThrowIfNull();
 }
Пример #21
0
        public override void IfFailure(Action <Exception> sideEffect)
        {
            sideEffect.ThrowIfNull(nameof(sideEffect));

            sideEffect(_error);
        }
Пример #22
0
 /// <summary>
 /// Get information about trades via web socket
 /// </summary>
 /// <param name="callback">Callback (symbol and trade)</param>
 /// <param name="symbols">Symbols</param>
 /// <returns>Web socket, call Dispose to close</returns>
 public virtual IWebSocket GetTradesWebSocket(Action <KeyValuePair <string, ExchangeTrade> > callback, params string[] symbols)
 {
     callback.ThrowIfNull(nameof(callback), "Callback must not be null");
     return(OnGetTradesWebSocket(callback, symbols));
 }
Пример #23
0
 public override void IfSuccess(Action <T> sideEffect) =>
 sideEffect.ThrowIfNull(nameof(sideEffect));
Пример #24
0
 /// <summary>
 /// Get the details of all completed orders via web socket
 /// </summary>
 /// <param name="callback">Callback</param>
 /// <returns>Web socket, call Dispose to close</returns>
 public virtual IWebSocket GetCompletedOrderDetailsWebSocket(Action <ExchangeOrderResult> callback)
 {
     callback.ThrowIfNull(nameof(callback), "Callback must not be null");
     return(OnGetCompletedOrderDetailsWebSocket(callback));
 }
Пример #25
0
 public RelayCommand(Action <object> execute, Func <object, bool> canExecute)
 {
     _execute    = execute.ThrowIfNull(nameof(execute));
     _canExecute = canExecute ?? (x => true);
 }
Пример #26
0
 /// <summary>
 /// Subscribes to the specified node.
 /// </summary>
 /// <param name="node">The id of the node to subscribe to.</param>
 /// <param name="cb">A callback method to invoke whenever an event
 /// notification for the node specified is received.</param>
 /// <exception cref="ArgumentNullException">The node parameter is null or the
 /// cb parameter is null.</exception>
 /// <exception cref="ArgumentException">A callback for the specified node id
 /// has already been installed.</exception>
 public void Subscribe(string node, Action <Jid, XmlElement> cb)
 {
     node.ThrowIfNull("node");
     cb.ThrowIfNull("cb");
     callbacks.Add(node, cb);
 }
Пример #27
0
 public static IServiceCollection RegisterCapabilityController(this IServiceCollection services, Action <MvcOptions> controllerOptions, Action <IMvcBuilder> controllerAction)
 {
     controllerAction.ThrowIfNull().Invoke(services.AddControllers(controllerOptions));
     return(services);
 }
Пример #28
0
 public ConnectionSettings SetConnectionStatusHandler(Action<ConnectionStatus> handler)
 {
     handler.ThrowIfNull("handler");
     this.ConnectionStatusHandler = handler;
     return this;
 }
Пример #29
0
 /// <summary>
 /// Creates an instance of a command with an action and the ability to turn on/off the execution of that action.
 /// </summary>
 /// <param name="executeAction"></param>
 /// <param name="canExecuteAction"></param>
 public BindableCommand(Action executeAction, Func <bool> canExecuteAction)
 {
     this.executeAction    = executeAction.ThrowIfNull(nameof(executeAction));
     this.canExecuteAction = canExecuteAction.ThrowIfNull(nameof(canExecuteAction));
 }