Exemplo n.º 1
0
        public override void ExecuteAsync(string typeName, object state, ExecuteStateCompleted executeCompleted, params object[] parameters)
        {
            Assert.ArgumentNotNull(typeName, nameof(typeName));
            Assert.ArgumentNotNull(executeCompleted, nameof(executeCompleted));
            Assert.ArgumentNotNull(parameters, nameof(parameters));

            if (!typeName.StartsWith(Constants.SitecoreRocksServer + @".Requests."))
            {
                typeName = Constants.SitecoreRocksServer + ".Requests." + typeName;
            }

            EventHandler <ExecuteCompletedEventArgs> callback = (sender, args) =>
            {
                Action action = delegate
                {
                    EndCommunication();

                    var executeResult = new ExecuteResult(this, args.Error, args.Cancelled);

                    if (args.Error != null)
                    {
                        executeCompleted(string.Empty, executeResult, state);
                    }
                    else
                    {
                        executeCompleted(args.Result.Trim(), executeResult, state);
                    }
                };

                Dispatcher.CurrentDispatcher.BeginInvoke(new Action(action));
            };

            Action fail = delegate
            {
                var executeResult = new ExecuteResult(this, new Exception(@"No Service"), false);
                executeCompleted(string.Empty, executeResult, state);
            };

            AppHost.Usage.ReportRequest(typeName);
            Execute(() => ExecuteExecuteAsync(typeName, parameters, callback), fail);
        }
Exemplo n.º 2
0
 public abstract void ExecuteAsync([NotNull, Localizable(false)] string typeName, [CanBeNull] object state, [NotNull] ExecuteStateCompleted executeCompleted, [NotNull, Localizable(false)] params object[] parameters);
Exemplo n.º 3
0
 public override void ExecuteAsync(string typeName, object state, ExecuteStateCompleted executeCompleted, params object[] parameters)
 {
     Assert.ArgumentNotNull(typeName, nameof(typeName));
     Assert.ArgumentNotNull(executeCompleted, nameof(executeCompleted));
     Assert.ArgumentNotNull(parameters, nameof(parameters));
 }