public StageView()
        {
            InitializeComponent();
            StageViewModel vm = new StageViewModel();

            BindingContext = vm;
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Stages([FromBody] StageViewModel model)
        {
            ProjectStage stage = Mapper.Map <ProjectStage>(model);

            await _projectService.SaveStage(stage);

            return(Ok());
        }
Ejemplo n.º 3
0
        public AnalisisSensibilidadSimulacionPopUp(string simulationPath, List <string> vicPaths, AnalisisSensibilidadPopUp analisisSensibilidadPopUp)
        {
            InitializeComponent();
            this.simulationPath            = simulationPath;
            this.simulationStoped          = false;
            this.vicPaths                  = vicPaths;
            this.analisisSensibilidadPopUp = analisisSensibilidadPopUp;
            this.mustPrint                 = false;
            this.stagesFinished            = new List <string>();
            double totalValue = 0;

            this.stages = new ObservableCollection <StageViewModelBase>();
            this.simulationStartedTime = DateTime.Now;
            this.conTiempoFinal        = false;

            foreach (string vicPath in vicPaths)
            {
                string simulationFile = File.ReadAllText(vicPath);
                var    simulation     = XMLParser.GetSimulation(simulationFile);
                if (simulation.Stages.Any())
                {
                    var            s     = simulation.Stages.First();
                    StageViewModel stage = new StageViewModel(simulation, s)
                    {
                        Name = s.Name
                    };
                    this.stages.Add(stage);
                    Variable tiempoFinal = stage.Simulation.GetVariables().First(v => v.Name == "TF");
                    if (tiempoFinal != null && tiempoFinal.InitialValue > 0)
                    {
                        this.conTiempoFinal = true;
                        totalValue          = totalValue + stage.Simulation.GetVariables().First(v => v.Name == "TF").InitialValue;
                        stage.Variables.First(v => v.Name == "T").PropertyChanged += VariableTChanged;
                    }
                    stage.Simulation.SimulationStatusChanged += OnSimulationStatusChanged;
                    //stage.ExecuteStageCommand.Execute(null);
                }
            }
            if (this.conTiempoFinal)
            {
                barraProgreso.Minimum   = 0;
                barraProgreso.Maximum   = totalValue;
                barraProgreso.Value     = 0;
                this.barraProgresoValue = 0;
                this.updatePbDelegate   = new UpdateProgressBarDelegate(barraProgreso.SetValue);
            }
            else
            {
                barraProgreso.IsIndeterminate = true;
            }
            // Despues que quedó configurada la barra y eso, mando a ejecutar
            foreach (StageViewModel stage in this.stages)
            {
                stage.ExecuteStageCommand.Execute(null);
            }
        }
Ejemplo n.º 4
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var array      = Convert.FromBase64String(e.InitParams["simulacion"]);
            var simulacion = Encoding.UTF8.GetString(array, 0, array.Count());

            var newStage = new StageViewModel(XMLParser.GetSimulation(simulacion))
            {
                Name = "Simulación Web"
            };

            var mainPage = new MainPage();

            mainPage.DataContext = newStage;
            this.RootVisual      = mainPage;
        }
Ejemplo n.º 5
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StageViewModel stage = db.Stages
                                   .ProjectTo <StageViewModel>()
                                   .SingleOrDefault(q => q.ID == id);

            if (stage == null)
            {
                return(HttpNotFound());
            }
            return(View(stage));
        }
Ejemplo n.º 6
0
        public StageViewModel Map(Stage model)
        {
            var viewModel = new StageViewModel
            {
                Description = model.Description,
                Index       = model.Index,
                RecipeId    = model.RecipeId
            };

            if (model.Image != null)
            {
                viewModel.Image = new ImageViewModel
                {
                    Base64    = Convert.ToBase64String(model.Image.Content),
                    Extension = model.Image.Extension
                };
            }
            return(viewModel);
        }
Ejemplo n.º 7
0
        public void ViewModelToModelTest()
        {
            var viewModel = new StageViewModel
            {
                Name    = "c",
                StageId = Guid.NewGuid(),
                MimimumPointsToCompleteStage = 1,
                Number = 2,
                Points = new List <PointViewModel>(),
                RaceId = Guid.NewGuid()
            };

            var result = _Sut.Map <Stage>(viewModel);

            Assert.AreEqual(viewModel.Name, result.Name);
            Assert.AreEqual(viewModel.StageId, result.StageId);
            Assert.AreEqual(viewModel.MimimumPointsToCompleteStage, result.MimimumPointsToCompleteStage);
            Assert.AreEqual(viewModel.Number, result.Number);
            Assert.IsNotNull(result.Points);
            Assert.AreEqual(viewModel.RaceId, result.RaceId);
        }
Ejemplo n.º 8
0
        public static ObservableCollection <StageViewModel> LoadDataBaseStageFromXML()
        {
            ObservableCollection <StageViewModel> items = new ObservableCollection <StageViewModel>();
            XDocument      xdoc     = XDocument.Load("Content/Stage.xml");
            var            dataEnum = xdoc.Descendants("Stage");
            StageViewModel ivm      = new StageViewModel();

            foreach (XElement e in dataEnum)
            {
                //ivm.IdStage = (string)e.Element("Id").Value;
                if ((string)e.Element("Id").Value == "1")
                {
                    ivm.ContentStage1 = (string)e.Element("Content").Value;
                }
                else if ((string)e.Element("Id").Value == "2")
                {
                    ivm.ContentStage2 = (string)e.Element("Content").Value;
                }
                else if ((string)e.Element("Id").Value == "3")
                {
                    ivm.ContentStage3 = (string)e.Element("Content").Value;
                }
                else if ((string)e.Element("Id").Value == "4")
                {
                    ivm.ContentStage4 = (string)e.Element("Content").Value;
                }
                else if ((string)e.Element("Id").Value == "5")
                {
                    ivm.ContentStage5 = (string)e.Element("Content").Value;
                }
                else
                {
                    ivm.ContentStage6 = (string)e.Element("Content").Value;
                }
            }
            items.Add(ivm);

            return(items);
        }
        private static PipelineViewModel GetPipeline(Project projectpipe)
        {
            var stages = new List <StageViewModel>();

            var firstStage = new StageViewModel {
                Jobs = new List <JobViewModel> {
                    JobViewModelBuilder.From(projectpipe).Build()
                }
            };

            stages.Add(firstStage);

            var stage = GetNextStage(firstStage.Jobs);

            while (stage != null)
            {
                stages.Add(stage);
                stage = GetNextStage(stage.Jobs);
            }

            return(new PipelineViewModel {
                Stages = stages
            });
        }
        private static PipelineViewModel GetPipeline(Project projectpipe)
        {
            var stages = new List<StageViewModel>();

            var firstStage = new StageViewModel { Jobs = new List<JobViewModel> { JobViewModelBuilder.From(projectpipe).Build() } };
            stages.Add(firstStage);

            var stage = GetNextStage(firstStage.Jobs);
            while (stage != null)
            {
                stages.Add(stage);
                stage = GetNextStage(stage.Jobs);
            }

            return new PipelineViewModel { Stages = stages };
        }
        private IList <StageViewModelBase> generateSensibilityStages()
        {
            IList <StageViewModelBase> stages = new ObservableCollection <StageViewModelBase>();

            List <GroupBox> groupBoxes = this.GetAllGroupBoxes();

            foreach (var groupBox in groupBoxes)
            {
                List <TextBox> txtBoxList = new List <TextBox>();
                txtBoxList.AddRange(((WrapPanel)groupBox.Content).Children.OfType <TextBox>());

                // ACTUALIZO VALORES DE VARIABLES DE CONTROL
                Simulation      newSimulation     = XMLParser.GetSimulation(this.simulationFile);
                List <Variable> originalVariables = newSimulation.GetVariables();
                List <Variable> variables         = new List <Variable>();
                foreach (var variable in originalVariables)
                {
                    if (variable.Type == VariableType.Control)
                    {
                        TextBox txtBox = txtBoxList.Find(element => element.Name.Equals("TxtBox_" + variable.Name));
                        if (txtBox != null)
                        {
                            double value = Convert.ToDouble(txtBox.Text);
                            variable.InitialValue = value;
                        }
                    }
                    variables.Add(variable);
                }
                // AHORA ACTUALIZO TAMAÑO DE LAS VARIABLES VECTORES
                foreach (var variable in variables)
                {
                    if (variable is VariableArray)
                    {
                        var    variableArray = (VariableArray)variable;
                        int    actualLength  = variableArray.Variables.Count();
                        double newLength     = variables.Find(aux => aux.Name == variableArray.Dimension).InitialValue;
                        if (actualLength < newLength)
                        {
                            int      index                 = actualLength;
                            Variable exampleVariable       = variableArray.Variables.First();
                            string   nombre                = exampleVariable.Name;
                            var      indexFirstParenthesis = nombre.LastIndexOf('(');
                            var      indexLastParenthesis  = nombre.LastIndexOf(')');
                            var      nombreItem            = nombre.Remove(indexFirstParenthesis, nombre.Length - indexFirstParenthesis);

                            for (var i = 0; i < newLength - actualLength; i++)
                            {
                                index++;
                                Variable newVariable = new Variable();
                                newVariable.Name         = new StringBuilder(nombreItem).Append('(').Append(index).Append(')').ToString();
                                newVariable.Type         = exampleVariable.Type;
                                newVariable.InitialValue = exampleVariable.InitialValue;
                                newVariable.ActualValue  = exampleVariable.ActualValue;
                                variableArray.Variables.Add(newVariable);
                            }
                        }
                        else if (actualLength > newLength)
                        {
                            variableArray.Variables.RemoveRange(Convert.ToInt32(newLength), Convert.ToInt32(actualLength - newLength));
                        }
                        //Actualizo el nombre de la variable vector
                        variableArray.Name = variableArray.Variables.Last().Name;
                    }
                }
                // seteo las nuevas variables a la simulacion para su correcta ejecucion
                newSimulation.SetVariables(variables);
                var stage = new StageViewModel(newSimulation)
                {
                    Name = groupBox.Header.ToString()
                };
                stages.Add(stage);
            }

            return(stages);
        }