示例#1
0
        static void Main(string[] args)
        {
            Iniciar inicialização = new Iniciar();

            inicialização.Configrar();
            Thread.Sleep(1000);
        }
示例#2
0
        public Form1()
        {
            InitializeComponent();
            Iniciar.mostrarValores(cuadroGrid);
            data = new Data();

            //Importar_btn.Enabled = true;
        }
示例#3
0
 private static void CreateDbIfNotExists(IHost host)
 {
     using (var scope = host.Services.CreateScope())
     {
         var services = scope.ServiceProvider;
         try
         {
             var context = services.GetRequiredService <Context>();
             Iniciar.Initialize(context);
         }
         catch (Exception ex)
         {
             var logger = services.GetRequiredService <ILogger <Program> >();
             logger.LogError(ex, "Falha BD.");
         }
     }
 }
示例#4
0
        public MainWindow()
        {
            InitializeComponent();
            fondo1.Source = Extensions.LoadBitmapFromResource("Fondos/47streetFondo.jpg");
            fondo2.Source = Extensions.LoadBitmapFromResource("Fondos/nike_fondo.jpg");
            fondo3.Source = Extensions.LoadBitmapFromResource("Fondos/fravegaFondo.jpg");
            fondo4.Source = Extensions.LoadBitmapFromResource("Fondos/4.jpg");
            fondo5.Source = Extensions.LoadBitmapFromResource("Fondos/5.jpeg");

            selecIcono1.Source = Extensions.LoadBitmapFromResource("Iconos/adidas.png");
            selecIcono2.Source = Extensions.LoadBitmapFromResource("Iconos/iconoFravega.png");
            selecIcono3.Source = Extensions.LoadBitmapFromResource("Iconos/hojas.png");
            selecIcono4.Source = Extensions.LoadBitmapFromResource("Iconos/nike.png");
            selecIcono5.Source = Extensions.LoadBitmapFromResource("Iconos/opera.png");

            this.Background = new ImageBrush(Extensions.LoadBitmapFromResource("Fondos/fondo.png"));

            //onclic de fondos
            fondoBoton1.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownFondo1), true);
            fondoBoton2.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownFondo2), true);
            fondoBoton3.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownFondo3), true);
            fondoBoton4.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownFondo4), true);
            fondoBoton5.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownFondo5), true);

            //onclic de iconos
            iconoBoton1.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownIcono1), true);
            iconoBoton2.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownIcono2), true);
            iconoBoton3.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownIcono3), true);
            iconoBoton4.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownIcono4), true);
            iconoBoton5.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(onMouseDownIcono5), true);

            Iniciar.AddHandler(TabItem.MouseDownEvent, new RoutedEventHandler(iniciarTemplate), true);

            //valores por defecto
            fondoTemplate = new ImageBrush(fondo1.Source);
            iconoTemplate = (BitmapImage)selecIcono1.Source;
        }
 public void Setup()
 {
     IniciadorDelJuego = new GameObject();
     IniciadorDelJuego.AddComponent(typeof(Iniciar));
     inicio = IniciadorDelJuego.GetComponent <Iniciar>();
 }
示例#6
0
 void Start()
 {
     worked = GetComponent <Iniciar>();
     bs     = GetComponent <ButtonSound>();
 }
示例#7
0
        private void SendDataToAllLasers()
        {
            experiment.EraseData();// Erase Data of last experiment
            if (checkLaser1.Checked)
            {
                currentLaser = 0;
                LaserConfigRequest laser1ConfigRequest = new LaserConfigRequest();
                laser1ConfigRequest.ID = 1;
                laser1ConfigRequest.MinPowerCurrent    = Convert.ToByte(I1min.Text);
                laser1ConfigRequest.MaxPowerCurrent    = Convert.ToByte(I1max.Text);
                laser1ConfigRequest.Increment          = Convert.ToByte(Inc1.Text);
                laser1ConfigRequest.DesiredTemperature = Convert.ToByte(Temp1.Text);

                experiment.lasers[0].ID                 = 1;                                      //It is the laser ID
                experiment.lasers[0].Current            = laser1ConfigRequest.MinPowerCurrent;    //min value of current
                experiment.lasers[0].DesiredCurrent     = laser1ConfigRequest.MaxPowerCurrent;    //max value of current
                experiment.lasers[0].DesiredTemperature = laser1ConfigRequest.DesiredTemperature; //target temperature
                experiment.lasers[0].InitialRequest     = laser1ConfigRequest;                    //Saving first request to storage on specified laser

                byte[] dataToSend = laser1ConfigRequest.GetByteArray();                           //Get byte array that represents config request that will be sent to laser
                SendUSBData(dataToSend);                                                          //Sending data to laser1
                experiment.lasers[0].ProcessFinishedEvent.WaitOne();                              //Lock program and wait for "singal" to continue
            }

            if (checkLaser2.Checked)
            {
                currentLaser = 1;
                LaserConfigRequest laser2ConfigRequest = new LaserConfigRequest();
                laser2ConfigRequest.ID = 2;
                laser2ConfigRequest.MinPowerCurrent    = Convert.ToByte(I2min.Text);
                laser2ConfigRequest.MaxPowerCurrent    = Convert.ToByte(I2max.Text);
                laser2ConfigRequest.Increment          = Convert.ToByte(Inc2.Text);
                laser2ConfigRequest.DesiredTemperature = Convert.ToByte(Temp2.Text);

                experiment.lasers[1].ID                 = 2;
                experiment.lasers[1].Current            = laser2ConfigRequest.MinPowerCurrent;
                experiment.lasers[1].DesiredCurrent     = laser2ConfigRequest.MaxPowerCurrent;
                experiment.lasers[1].DesiredTemperature = laser2ConfigRequest.DesiredTemperature;
                experiment.lasers[1].InitialRequest     = laser2ConfigRequest;

                byte[] dataToSend = laser2ConfigRequest.GetByteArray();
                SendUSBData(dataToSend);
                experiment.lasers[1].ProcessFinishedEvent.WaitOne();
            }

            if (checkLaser3.Checked)
            {
                currentLaser = 2;
                LaserConfigRequest laser3ConfigRequest = new LaserConfigRequest();
                laser3ConfigRequest.ID = 3;
                laser3ConfigRequest.MinPowerCurrent    = Convert.ToByte(I3min.Text);
                laser3ConfigRequest.MaxPowerCurrent    = Convert.ToByte(I3max.Text);
                laser3ConfigRequest.Increment          = Convert.ToByte(Inc3.Text);
                laser3ConfigRequest.DesiredTemperature = Convert.ToByte(Temp3.Text);

                experiment.lasers[2].ID                 = 3;
                experiment.lasers[2].Current            = laser3ConfigRequest.MinPowerCurrent;
                experiment.lasers[2].DesiredCurrent     = laser3ConfigRequest.MaxPowerCurrent;
                experiment.lasers[2].DesiredTemperature = laser3ConfigRequest.DesiredTemperature;
                experiment.lasers[2].InitialRequest     = laser3ConfigRequest;

                byte[] dataToSend = laser3ConfigRequest.GetByteArray();
                SendUSBData(dataToSend);
                experiment.lasers[2].ProcessFinishedEvent.WaitOne();
            }

            if (checkLaser4.Checked)
            {
                currentLaser = 3;
                LaserConfigRequest laser4ConfigRequest = new LaserConfigRequest();
                laser4ConfigRequest.ID = 4;
                laser4ConfigRequest.MinPowerCurrent    = Convert.ToByte(I4min.Text);
                laser4ConfigRequest.MaxPowerCurrent    = Convert.ToByte(I4max.Text);
                laser4ConfigRequest.Increment          = Convert.ToByte(Inc4.Text);
                laser4ConfigRequest.DesiredTemperature = Convert.ToByte(Temp4.Text);

                experiment.lasers[3].ID                 = 4;
                experiment.lasers[3].Current            = laser4ConfigRequest.MinPowerCurrent;
                experiment.lasers[3].DesiredCurrent     = laser4ConfigRequest.MaxPowerCurrent;
                experiment.lasers[3].DesiredTemperature = laser4ConfigRequest.DesiredTemperature;
                experiment.lasers[3].InitialRequest     = laser4ConfigRequest;

                byte[] dataToSend = laser4ConfigRequest.GetByteArray();
                SendUSBData(dataToSend);
                experiment.lasers[3].ProcessFinishedEvent.WaitOne();
            }

            if (checkLaser5.Checked)
            {
                currentLaser = 4;
                LaserConfigRequest laser5ConfigRequest = new LaserConfigRequest();
                laser5ConfigRequest.ID = 5;
                laser5ConfigRequest.MinPowerCurrent    = Convert.ToByte(I5min.Text);
                laser5ConfigRequest.MaxPowerCurrent    = Convert.ToByte(I5max.Text);
                laser5ConfigRequest.Increment          = Convert.ToByte(Inc5.Text);
                laser5ConfigRequest.DesiredTemperature = Convert.ToByte(Temp5.Text);

                experiment.lasers[4].ID                 = 5;
                experiment.lasers[4].Current            = laser5ConfigRequest.MinPowerCurrent;
                experiment.lasers[4].DesiredCurrent     = laser5ConfigRequest.MaxPowerCurrent;
                experiment.lasers[4].DesiredTemperature = laser5ConfigRequest.DesiredTemperature;
                experiment.lasers[4].InitialRequest     = laser5ConfigRequest;

                byte[] dataToSend = laser5ConfigRequest.GetByteArray();
                SendUSBData(dataToSend);
                experiment.lasers[4].ProcessFinishedEvent.WaitOne();
            }


            Iniciar.Invoke(new Action(() =>
            {
                Iniciar.Enabled = true;
            }));

            Parar.Invoke(new Action(() =>
            {
                Parar.Enabled = false;
            }));

            LaserConfigRequest finalConfigRequest = new LaserConfigRequest();

            SendUSBData(finalConfigRequest.GetByteArray()); // sending last and empty message
            currentLaser = -1;                              // back to non existent laser
            MessageBox.Show("Finished All tests");
        }