コード例 #1
0
 private void btnOpenSimulation_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         //logger.Info("Abrir Simulacion");
         using (var openFileDialog = new OpenFileDialog())
         {
             openFileDialog.Filter           = "Vic files (*.vic)|*.vic";
             openFileDialog.Title            = "Abrir Simulacion";
             openFileDialog.InitialDirectory = Environment.CurrentDirectory;
             if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 SimulationXML = openFileDialog.FileName;
                 var mainWindow = new MainWindow(SimulationXML, false);
                 mainWindow.Show();
                 logger.Info(String.Format("Se abrio la simulacion alojada en el archivo {0}", openFileDialog.FileName));
             }
         }
     }
     catch (Exception ex)
     {
         var viewExpection = new AlertPopUp("Se produjo un error al abrir la silumación. Para ver detalles, despliegue el control correspondiente.");
         viewExpection.ShowDialog();
         //logger.Error("Se produjo un error al abrir la silumación: "+ex.Message);
     }
 }
コード例 #2
0
        public void BtnEditAnimation_OnClick(object sender, RoutedEventArgs e)
        {
            AnimationViewModel animationViewModel = (AnimationViewModel)((Button)sender).DataContext;
            Button             dataContext        = (Button)sender;
            ItemsControl       itemsControl       = VisualTreeHelpers.FindAncestor <ItemsControl>(dataContext);

            var dllConfigurationsClone = new List <AnimationConfigurationBase>();

            foreach (var config in ((StageViewModel)itemsControl.DataContext).DllConfigurations)
            {
                var newDllConfig = Activator.CreateInstance(config.GetType(), config.Variables) as AnimationConfigurationBase;
                dllConfigurationsClone.Add(newDllConfig);
            }

            try
            {
                var addAnimationPopUp = new AddAnimationPopUp(animationViewModel, dllConfigurationsClone);

                addAnimationPopUp.ShowDialog();
                switch (addAnimationPopUp.Result)
                {
                case UI.SharedWPF.DialogResult.Accept:
                {
                    var newAnimationFromDlls = ((StageViewModel)itemsControl.DataContext).DllAnimations.Where(x => x.ConfigurationType == addAnimationPopUp.ResultConfig.GetType().Name).First();
                    var newAnimation         = Activator.CreateInstance(newAnimationFromDlls.GetType()) as AnimationViewModel;
                    newAnimation.InitializeAnimation(addAnimationPopUp.ResultConfig);
                    newAnimation.BindSimulationVariableValues();
                    newAnimation.X = animationViewModel.X;                                            //NO funciona
                    newAnimation.Y = animationViewModel.Y;                                            //NO funciona
                    ((StageViewModel)itemsControl.DataContext).Animations.Remove(animationViewModel); //borro y creo nueva
                    ((StageViewModel)itemsControl.DataContext).Animations.Add(newAnimation);
                }
                break;
                }
            }
            catch (Exception ex)
            {
                var viewException = new AlertPopUp("Se produjo un error al editar una animacion. Para ver detalles, despliegue el control correspondiente.");
                viewException.ShowDialog();
            }
        }
コード例 #3
0
        private void GenerarAlerta(string s)
        {
            AlertPopUp Alert = new AlertPopUp(s);

            Alert.Show();
        }