private int PassCheckpoint(CheckpointMenuItem checkpoint)
        {
            if (_checkpointHandlers.ContainsKey(checkpoint.Text) == false)
            {
                return(Constants.CheckpointOnFail);
            }

            var handler = _checkpointHandlers[checkpoint.Text];
            var args    = new CheckpointHandlerArgs
            {
                Value  = checkpoint.Value,
                Amount = checkpoint.Amount,
                Result = false
            };

            handler(Client, args);

            return(args.Result
                ? Constants.CheckpointOnSuccess
                : Constants.CheckpointOnFail);
        }
Пример #2
0
        /// <summary>
        /// Call checkpoint handler
        /// </summary>
        /// <param name="checkpoint">Checkpoint item</param>
        /// <returns>Success or fail code based on handler result</returns>
        private int PassCheckpoint(CheckpointMenuItem checkpoint)
        {
            // find handler
            if (_checkpointHandlers.ContainsKey(checkpoint.Text) == false)
            {
                throw new Exception($"No handler found for checkpoints of type {checkpoint.Text}");
            }

            var handler = _checkpointHandlers[checkpoint.Text];
            var args    = new CheckpointHandlerArgs()
            {
                Value  = checkpoint.Value,
                Amount = checkpoint.Amount,
                Result = false
            };

            // call handler
            handler(this, args);

            return(args.Result == true
                                ? Constants.CheckpointOnSuccess
                                : Constants.CheckpointOnFail);
        }
Пример #3
0
        /// <summary>
        ///     Call checkpoint handler
        /// </summary>
        /// <param name="checkpoint">Checkpoint item</param>
        /// <returns>Success or fail code based on handler result</returns>
        private int PassCheckpoint(CheckpointMenuItem checkpoint)
        {
            // find handler
            if (_checkpointHandlers.ContainsKey(checkpoint.Text) == false)
            {
                ServerContext.Log("No Callback for checkpoint: {0}", checkpoint.Text);
                return(Constants.CheckpointOnFail);
            }

            var handler = _checkpointHandlers[checkpoint.Text];
            var args    = new CheckpointHandlerArgs
            {
                Value  = checkpoint.Value,
                Amount = checkpoint.Amount,
                Result = false
            };

            // call handler
            handler(Client, args);

            return(args.Result
                ? Constants.CheckpointOnSuccess
                : Constants.CheckpointOnFail);
        }