Example #1
0
        //CANDIDO
        //public BatteryLevel batteryId = Microsoft.WindowsMobile.Status.SystemState.PowerBatteryStrength;
        public void anadePoi(string nombre, string tipo,int CoorX, int CoorY, int time)
        {
            //IMAGEN EN SYGIC
            SError err;
            try
            {
                int res = CApplicationAPI.DeletePoiCategory(out err, nombre, "ESP", 1000);//(Borramos Para las pruebas)
                string dirImagen = @nombre + ".bmp";
                res = CApplicationAPI.AddPoiCategory(out err, nombre, dirImagen, "ESP", 1000);
                LONGPOSITION position = new LONGPOSITION(CoorX, CoorY);//X, Y);
                SPoi poi = new SPoi(position,nombre, tipo, 0);
                res = CApplicationAPI.AddPoi(out err, ref poi, time);
            }
            catch { }
               //SONIDO

            //Sound sound = new Sound(Assembly.GetExecutingAssembly().GetManifestResourceStream("SoundSample."+tipo+".wav"));
            //sound.Play();
            //OpenFileDialog dialog1 = new OpenFileDialog();
               //dialog1.ShowDialog()
               // Properties.Resources.

               string _appFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
               string dirSonido = _appFolder + @"\Sounds\" + tipo + ".wav";
               dirSonido =  "\\Tarjeta de almacenamiento\\FLEET_MOBILE_14d\\MisSonidos\\" + tipo + ".wav";//parking.wav";
            try
            {
                //PlaySound((LPCWSTR)dirSonido, 0, SND_LOOP | SND_ASYNC | SND_FILENAME);
                WSounds ws = new WSounds();

                ws.Play(dirSonido, ws.SND_FILENAME | ws.SND_ASYNC);

               /* DriveHandler.SendDriveToForeground(1);
                System.Threading.Thread.Sleep(5000);
                DriveHandler.SendDriveToBackground(1);*/
            }
            catch //()Exception ex)
            {
                //Invoke(myDelegate, new Object[] { "Error: " + ex.Message });
            }
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            cerrar = false;
            Play.Visible = false;
            progressBar1.Maximum = 8;
            progressBar1.Value = 1;
            Invoke(myDelegate, new Object[] { "Loading... Please Wait." });
            Play.Enabled = false;//DESABILITO PLAY

            //byte[] m_soundBytes = new byte[Properties.Resources.iniciando1.Length];
            //Properties.Resources.iniciando1.Read(m_soundBytes, 0, (int)Properties.Resources.iniciando1.Length);
              //  new System.Media.SoundPlayer(
            //System.IO.Stream stream = (System.IO.Stream)Properties.Resources.ResourceManager.BaseName. "iniciando1",false,false);
               // System.Media.SoundPlayer player = new System.Media.SoundPlayer(stream);
               //     Properties.Resources.iniciando1.Play();
            //WSounds ws1 = ;

               // string patch = System.AppDomain.CurrentDomain.BaseDirectory.ToString() BaseDirectory;// BaseDirectory;
            string _appFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
            string dirSonido = _appFolder + @"\Sounds\iniciando.wav";//\Sounds\\Sonidos"\\Tarjeta de almacenamiento\\FLEET_MOBILE_14d\\MisSonidos\\iniciando.wav";//Properties.Resources.ResourceManager.BaseName+"\\// "..\\Resources\\iniciando.wav";//\\Tarjeta de almacenamiento\\FLEET_MOBILE_14d\\MisSonidos\\iniciando.wav";
            dirSonido = "\\Tarjeta de almacenamiento\\FLEET_MOBILE_14d\\MisSonidos\\iniciando.wav";

            try
            {
                WSounds ws = new WSounds();
                ws.Play(dirSonido, ws.SND_FILENAME | ws.SND_ASYNC);
            }
            catch (Exception ex)
            {
                Invoke(myDelegate, new Object[] { "Error: " + ex.Message });
            }

            Hardware detect = new Hardware();
            if (detect.BluetoothOn())//habilita bluetooth
                Invoke(myDelegate, new Object[] { "Enabled Bluetooth successfully." });
            if (detect.WifiOn())// habilita wifi
                Invoke(myDelegate, new Object[] { "Enabled Wifi successfully." });
            if (detect.conectawifi("vaipho"))//conecta a la red vaipho
                Invoke(myDelegate, new Object[] { "VAiPho connected successfully." });
            progressBar1.Value = 2;

            //Si el manos libres del coche se apaga, VAiPho se apagará también (para evitar atascos inexistentes)
            int key = (int)Registry.GetValue(registryKey, "Bluetooth", -1);
            rg = new RegistryState(registryKey, registryValueName);
            rg.Changed += new ChangeEventHandler(bluetooth_Changed);

            progressBar1.Value = 3;
            //LA CREACION DE LA BD NO SE DEBE EJECUTAR EN LA VERSIÓN FINAL
            Invoke(myDelegate, new Object[] { "Generating DB." });
            BD basededatos = new BD(this);
            progressBar1.Value = 4;
               /* if (basededatos.crearTablas())//comentar inserts en crear tablas.
            {
                basededatos.creaActualizaBD();
            }*/

            //if (basededatos.crearBD())
                if (basededatos.crearTablas())
                {
                    progressBar1.Value = 5;
                    Server Servidor = new Server(this);//, 9050);
                    Cliente Cliente1 = new Cliente(this, "9050");
                    string hostName = Dns.GetHostName();
                    progressBar1.Value = 6;
                    IPHostEntry thisHost = Dns.GetHostEntry(hostName);
                    labelPseu.Text = basededatos.recuperamyPseu();
                    labelIP.Text = thisHost.AddressList[0].ToString();
                    labelPseu.Text = basededatos.recuperamyPseu();
                    Thread hiloCliente = new Thread(new ThreadStart(Cliente1.beacon));
                    hiloCliente.Start();
                    progressBar1.Value = 7;
                    DetectaIncidente VigilaCarretera = new DetectaIncidente(this);
                    VigilaCarretera.DetectaIncidenteStart();
                    VigilaCarretera.posibleparking();
                    progressBar1.Value = 8;
                    /*Prueba VigilaCarretera = new Prueba(this);
                    VigilaCarretera.DetectaIncidenteStart();*/
                }
                progressBar1.Value = 0;
        }
Example #3
0
        //Cerramos aplicación y GPS
        private void cerrandoAplicacion()
        {
            try
            {
                cerrar = true;
                Cliente cierracliente = new Cliente(this, "9050");//,"127.0.0.1","bye");
                cierracliente.respuesta("01", Server.myPseudonimo, "-", "127.0.0.1");//,
                 string _appFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                 string dirSonido = _appFolder + @"\Sounds\apagando.wav";
                dirSonido = "\\Tarjeta de almacenamiento\\FLEET_MOBILE_14d\\MisSonidos\\apagando.wav";//parking.wav";

                WSounds ws = new WSounds();
                ws.Play(dirSonido, ws.SND_FILENAME | ws.SND_ASYNC);

                DriveHandler.EndApplication(0);
                DriveHandler.CloseApi();
                Hardware detect = new Hardware();
                detect.WifiOff();

            }
            catch
            {
                //    Formulario.Invoke(Formulario.myDelegate, new Object[] { "Error software GPS: " + e.Message });
            }
        }