Exemple #1
0
 public override void Execute(ExecuteInput input)
 {
     foreach (string name in input.MethodNames)
     {
         var splitName = name.Split('|');
         if (splitName != null && splitName.Length > 0)
         {
             string methodName = splitName[0];
             string doccoment  = "";
             if (splitName.Length > 1)
             {
                 doccoment = splitName[1];
             }
             try
             {
                 AddMethodToClass(_serviceClass, methodName, doccoment, input.IsAsync);
                 AddMethodToInterface(_serviceInterface, methodName, doccoment, input.IsAsync);
                 CreateDtoFiles(_document, methodName, doccoment);
             }
             catch (Exception e)
             {
                 MessageBox("Generation failed.\r\nMethod name: {0}\r\nException: {1}", MessageBoxButton.OK, MessageBoxImage.Exclamation, name, e.Message);
             }
         }
     }
 }
Exemple #2
0
        public async Task Handle(JupyterRequestContext context)
        {
            var executeRequest = GetJupyterRequest(context);

            context.RequestHandlerStatus.SetAsBusy();
            var executionCount = executeRequest.Silent ? _executionCount : Interlocked.Increment(ref _executionCount);

            var executeInputPayload = new ExecuteInput(executeRequest.Code, executionCount);
            var executeReply        = Message.Create(executeInputPayload, context.Request.Header);

            context.ServerChannel.Send(executeReply);

            var command = new SubmitCode(executeRequest.Code);

            var openRequest = new InflightRequest(context, executeRequest, executionCount);

            InFlightRequests[command] = openRequest;

            try
            {
                await Kernel.SendAsync(command);
            }
            catch (Exception e)
            {
                OnCommandFailed(new CommandFailed(e, command));
            }
        }
Exemple #3
0
        public async Task Handle(JupyterRequestContext context)
        {
            var executeRequest = GetJupyterRequest(context);

            _executionCount = executeRequest.Silent ? _executionCount : Interlocked.Increment(ref _executionCount);

            var executeInputPayload = new ExecuteInput(executeRequest.Code, _executionCount);

            context.JupyterMessageSender.Send(executeInputPayload);

            var command = new SubmitCode(executeRequest.Code);

            await SendAsync(context, command);
        }
        public async Task Handle(JupyterRequestContext context)
        {
            var executeRequest = GetJupyterRequest(context);

            _executionCount = executeRequest.Silent ? _executionCount : Interlocked.Increment(ref _executionCount);

            var executeInputPayload = new ExecuteInput(executeRequest.Code, _executionCount);
            var executeReply        = Message.Create(executeInputPayload, context.Request.Header, identifiers: new [] { Message.Topic("execute_input", context.KernelIdent) });

            context.IoPubChannel.Send(executeReply);

            var command = new SubmitCode(executeRequest.Code);

            await SendTheThingAndWaitForTheStuff(context, command);
        }
        public async Task Handle(JupyterRequestContext context)
        {
            var    executeRequest   = GetJupyterRequest(context);
            string targetKernelName = context.GetLanguage();

            _executionCount = executeRequest.Silent ? _executionCount : Interlocked.Increment(ref _executionCount);

            FrontendEnvironment.AllowStandardInput = executeRequest.AllowStdin;

            var executeInputPayload = new ExecuteInput(executeRequest.Code, _executionCount);

            context.JupyterMessageSender.Send(executeInputPayload);

            var command = new SubmitCode(executeRequest.Code, targetKernelName);

            await SendAsync(context, command);
        }
        private void Generate_OnClick(object sender, RoutedEventArgs e)
        {
            var helper = new AddNewServiceMethodHelper(_serviceProvider);
            var names  = Regex.Split(txtNames.Text, @"\r\n");

            if (HelperBase.MessageBox("{0} method{1} will be generated. OK?", MessageBoxButton.OKCancel, MessageBoxImage.Question, names.Length, (names.Length > 1 ? "s" : string.Empty)) == MessageBoxResult.Cancel)
            {
                return;
            }
            var input = new ExecuteInput
            {
                MethodNames = names,
                IsAsync     = chkAsync.IsChecked ?? true
            };

            if (helper.CanExecute(input))
            {
                helper.Execute(input);
            }
        }
Exemple #7
0
        public override bool CanExecute(ExecuteInput input)
        {
            _document = _dte.ActiveDocument;
            if (_document == null || _document.ProjectItem == null || _document.ProjectItem.FileCodeModel == null)
            {
                MessageBox(ErrMessage);
                return(false);
            }

            _serviceClass = GetClass(_document.ProjectItem.FileCodeModel.CodeElements);
            if (_serviceClass == null)
            {
                MessageBox(ErrMessage);
                return(false);
            }

            _serviceInterface = GetServiceInterface(_serviceClass as CodeElement);
            if (_serviceInterface == null)
            {
                MessageBox(ErrMessage);
                return(false);
            }
            return(true);
        }
 public abstract void Execute(ExecuteInput input);
 public abstract bool CanExecute(ExecuteInput input);