Example #1
0
        }//////////////////////////////////////////////////////////////////////////////////

        public void updateProcStart()
        {
            try
            {
                if (pingHost(AppConfs.serverName))
                {
                    //this.addStatusTextBoxLine("No se tiene permisos sobre la carpeta de la aplicacion : " + ex.GetType() + " ; " + ex.Message);
                    this.addStatusTextBoxLine("********* INICIANDO PROCESO DE ACTUALIZACIÓN *********");
                    FixProc fp = new FixProc(this.mw);

                    if (!checkFiles())
                    {
                        this.addStatusTextBoxLine("*** ERROR: No se encuentra  el archivo dll en " + AppConfs.AppFolder + " necesario para la descompresión.");
                        return;
                    }

                    if (fp.fixProcess())
                    {
                        try
                        {
                            this.addStatusTextBoxLine("- Terminando proceso de Elara...");
                            UpdateProc.EndEVentasProcess();
                            this.addStatusTextBoxLine("\tProceso de Elara terminado exitosamente.");
                        }
                        catch (Exception ex0)
                        {
                            this.addStatusTextBoxLine("\tElara no se encuentra en ejecución.");
                        }


                        this.addStatusTextBoxLine("- Reemplazando archivos en carpeta de la aplicación...");
                        this.copyToAppFolder();

                        //borrando IsolatedStorage
                        //************************************
                        try
                        {
                            string appdata = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                            string pathIso = appdata + "\\IsolatedStorage";
                            if (Directory.Exists(pathIso))
                            {
                                Directory.Delete(pathIso, true);
                            }
                            this.addStatusTextBoxLine("- IsoletedStorage borrada.");
                        }catch (Exception ex) {
                            this.addStatusTextBoxLine("Isolate: " + ex.Message);
                        }
                        //***********************************

                        this.addStatusTextBoxLine("- Borrando carpeta temporal...");
                        this.deleteTmpFolder();

                        this.addStatusTextBoxLine("\n*** PROCESO DE ACTUALIZACIÓN FINALIZADO EXITOSAMENTE ***");
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    this.addStatusTextBoxLine("*** ERROR: NO ESTÁ CONECTADO A LA RED DE ELARA.\nConéctese a la red de Elara y vuelva a intentar.");
                }
            }
            catch (Exception ex1)
            {
                this.addStatusTextBoxLine("*** No se pudo completar la actualización de archivos. " + ex1.Message);
                throw new Exception("No se pudo completar la actualización de archivos. " + ex1.Message);
            }
            //}
        }//////////////////////////////////////////////////////////////////////////////////
Example #2
0
        public void updateProcess()
        {
            //string _serverUpdateFilesFolder = AppConfs.updateFilesFolder;   //ConfigurationManager.AppSettings["UpdateFilesFolder"].ToString();
            //string _finalFolder = AppConfs.eVentasAppFolder;    // ConfigurationManager.AppSettings["AppFolder"].ToString();
            //string appDataFolder = AppConfs.eVentasAppFolder;    // ConfigurationManager.AppSettings["AppFolder"].ToString();
            //string _tmpFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\eVentas\appupp\";

            /*
             * Se mata al proceso eVentasWPF.exe
             */
            try
            {
                this.addStatusTextBoxLine("-Verificando estado el proceso de e-Territory...");
                Process p = new Process();
                p.StartInfo = new ProcessStartInfo();
                p.StartInfo.UseShellExecute = true;
                p.StartInfo.FileName = "taskkill.exe";
                p.StartInfo.Arguments = "/F /IM " + AppConfs.ProcessName;
                p.Start();
                p.WaitForExit();
                this.addStatusTextBoxLine("\tVerificado completo.");
            }
            catch (Exception ex)
            {
                this.addStatusTextBoxLine("\tVerificado completo. " + ex.Message);
            }

            new Thread(delegate()
            {
                MainWindow mW = this;
                string[] arr;
                //string serverUpdateFilesFolder = _serverUpdateFilesFolder;
                //string finalFolder = _finalFolder;
                //string tmpFolder = _tmpFolder;

                try
                {
                    bool errorProcess = false;
                    //UI update
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("- Inicia proceso de actualización...")));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("\tPor favor espere... ")));

                    UpdateProc up = new UpdateProc(mW);
                    /*
                     * Se inicia el proceso de actualización
                     */
                    string fin = "";
                    try
                    {

                        up.updateProcStart();
                        //fin = "- El proceso de actualización ha finalizado. ";

                    }
                    catch (Exception ex)
                    {
                        mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("***\nNO SE HA PODIDO ACTUALIZAR\nValide:"
                            + "\n1. Conexión estable a la red de PMI"
                            + "\n2. Permisos de su usuario en la carpeta compartida \ny vuelva a intentar.")));
                        upFail = true;
                        return;
                    }

                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addProgressValue()));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("\n" + fin + "- Haga clic en Terminar para salir de éste actualizador...")));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.disableCancelButton()));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.enableButton()));

                }
                catch (Exception ex)
                {
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("*** La actualizacion no ha podido ser concluída. " + ex.Message.ToString())));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.disableCancelButton()));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.enableButton()));
                    upFail = true;
                    return;
                }
            }).Start();
        }
        }//////////////////////////////////////////////////////////

        public void updateProcess()
        {
            //string _serverUpdateFilesFolder = AppConfs.updateFilesFolder;   //ConfigurationManager.AppSettings["UpdateFilesFolder"].ToString();
            //string _finalFolder = AppConfs.eVentasAppFolder;    // ConfigurationManager.AppSettings["AppFolder"].ToString();
            //string appDataFolder = AppConfs.eVentasAppFolder;    // ConfigurationManager.AppSettings["AppFolder"].ToString();
            //string _tmpFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\eVentas\appupp\";


            /*
             * Se mata al proceso eVentasWPF.exe
             */
            try
            {
                this.addStatusTextBoxLine("-Verificando estado el proceso de Elara...");
                Process p = new Process();
                p.StartInfo = new ProcessStartInfo();
                p.StartInfo.UseShellExecute = true;
                p.StartInfo.FileName        = "taskkill.exe";
                p.StartInfo.Arguments       = "/F /IM " + AppConfs.ProcessName;
                p.Start();
                p.WaitForExit();
                this.addStatusTextBoxLine("\tVerificado completo.");
            }
            catch (Exception ex)
            {
                this.addStatusTextBoxLine("\tVerificado completo. " + ex.Message);
            }

            new Thread(delegate()
            {
                MainWindow mW = this;
                string[] arr;
                //string serverUpdateFilesFolder = _serverUpdateFilesFolder;
                //string finalFolder = _finalFolder;
                //string tmpFolder = _tmpFolder;

                try
                {
                    bool errorProcess = false;
                    //UI update
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("- Inicia proceso de actualización...")));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("\tPor favor espere... ")));

                    UpdateProc up = new UpdateProc(mW);

                    /*
                     * Se inicia el proceso de actualización
                     */
                    string fin = "";
                    try
                    {
                        up.updateProcStart();
                        //fin = "- El proceso de actualización ha finalizado. ";
                    }
                    catch (Exception ex)
                    {
                        mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("***\nNO SE HA PODIDO ACTUALIZAR\nValide:"
                                                                                           + "\n1. Conexión estable a la red de Elara"
                                                                                           + "\n2. Permisos de su usuario en la carpeta compartida \ny vuelva a intentar.")));
                        upFail = true;
                        return;
                    }

                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addProgressValue()));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("\n" + fin + "- Haga clic en Terminar para salir de éste actualizador...")));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.disableCancelButton()));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.enableButton()));
                }
                catch (Exception ex)
                {
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.addStatusTextBoxLine("*** La actualización no ha podido ser concluida. " + ex.Message.ToString())));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.disableCancelButton()));
                    mW.Dispatcher.BeginInvoke(new Action(() => mW.enableButton()));
                    upFail = true;
                    return;
                }
            }).Start();
        }//////////////////////////////////////////////////////////