public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Description")] ControllerFunction controllerFunction)
        {
            if (id != controllerFunction.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(controllerFunction);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ControllerFunctionExists(controllerFunction.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(controllerFunction));
        }
        public async Task <IActionResult> Create([Bind("ID,Name,Description")] ControllerFunction controllerFunction)
        {
            if (ModelState.IsValid)
            {
                _context.Add(controllerFunction);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(controllerFunction));
        }
Ejemplo n.º 3
0
        private Task <byte[]> Send(Function function, byte[] payload, Func <ControllerFunctionMessage, bool> predicate, CancellationToken cancellationToken)
        {
            return(Exchange(async() =>
            {
                var request = new ControllerFunction(function, payload);
                _transmitQueue.Add(request);

                var response = await WaitForResponse((message) => predicate((ControllerFunctionMessage)message), cancellationToken).ConfigureAwait(false);

                return ((ControllerFunctionMessage)response).Payload;
            }, $"{function} {(payload != null ? BitConverter.ToString(payload) : string.Empty)}", cancellationToken));
        }
Ejemplo n.º 4
0
        private void BtnEnter_Click(object sender, EventArgs e)
        {
            ControllerFunction controller = new ControllerFunction();

            formHome home = new formHome();

            home.Dato = controller.datos(Convert.ToInt32(poblacionNumUD.Value), Convert.ToInt32(iteracionesNumUD.Value), Convert.ToDecimal(probCruceNumUD.Value), Convert.ToDecimal(probMutacionNumUD.Value));

            Hide();
            home.ShowDialog(this);
            Show();
        }
Ejemplo n.º 5
0
        public ControllerFunctionViewModel(Dispatcher dispatcher, ControllerFunction controllerFunction) : base(dispatcher)
        {
            _controllerFunction = controllerFunction;
            Assignable          = controllerFunction.Assignable;
            Controller          = new ControllerViewModel(dispatcher, controllerFunction.Controller);
            HasFunction         = controllerFunction.HasFunction;
            Function            = controllerFunction.Function != null
                ? new FunctionViewModel(dispatcher, controllerFunction.Function)
                : null;

            _controllerFunction.PropertyChanged += ControllerFunctionOnPropertyChanged;
        }
Ejemplo n.º 6
0
        public Task <byte[]> Send(Function function, params byte[] payload)
        {
            return(Exchange(async() =>
            {
                var request = new ControllerFunction(function, payload);
                _transmitQueue.Add(request);

                var response = await WaitForResponse((message) =>
                {
                    return (message is ControllerFunctionCompleted && ((ControllerFunctionCompleted)message).Function == function);
                }).ConfigureAwait(false);

                return ((ControllerFunctionCompleted)response).Payload;
            }, $"{function} {(payload != null ? BitConverter.ToString(payload) : string.Empty)}"));
        }
Ejemplo n.º 7
0
 public ControllerFunctionConfiguration(ControllerFunction controllerFunction)
 {
     ControllerKey = new ControllerConfigurationKey(controllerFunction.Controller);
     FunctionKey   = controllerFunction.Function?.Key;
 }