private void _ActualizareProgram_Click(object sender, RoutedEventArgs e) { string numeFisierVers = string.Empty; string sPath = string.Empty; numeFisierVers = UpdatesHelper.Verifica_Update_Versiune(Assembly.GetExecutingAssembly().GetName().Version.ToString()); if (numeFisierVers != "0") { if (MessageBoxResult.Yes == MessageBox.Show("Exista o versiune noua pentru descarcare\nDoriti descarcarea si instalarea noii versiuni?", "Info", MessageBoxButton.YesNo)) { sPath = Environment.CurrentDirectory + @"UpdateWEB\UpdateWEB.exe"; ClasaSuport.StartProgramByFileName(sPath, true); Application.Current.Shutdown(); return; } } else { MessageBox.Show("Nu este necesara actualizarea programului", "Info", MessageBoxButton.OK); } }
private void Frm_Pornire_Loaded(object sender, RoutedEventArgs e) { string formatNrScurt = "##,##0"; string formatNrLung = "##,##0.00"; // string Settings_XML_File = string.Empty; string sPath = string.Empty; string numeFisierVers = string.Empty; try { // Determin locatia unde este fisierul Settings.XML string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); // Settings_XML_File = Environment.CurrentDirectory + @"\E_Intrastat'Settings.xml"; CONSTANTE.Setting_XML_file = path + @"\E_Intrastat\Settings.xml"; // if (!XML_Operatii.Verifica_Fisier(Settings_XML_File)) // { // MessageBox.Show("EROARE identificare fisier setari: " + Settings_XML_File + " nu exista"); // return; // } XML_Setari_Default.Setari_Default_XML(); EU_Registrii_Operatii.EU_Registrii(); XML_Public_Citeste.Citeste_CUlori(); XML_Public_Citeste.Citeste_Zecimale(); XML_Public_Citeste.Citeste_FileLocation(); XML_Public_Citeste.Citeste_Diverse(); if (Diverse.VerificaUpdate == true) { string versionFilePath = FileLocation.System + "vers.txt"; string[] versionFileLines = File.ReadAllLines(versionFilePath); numeFisierVers = UpdatesHelper.Verifica_Update_Versiune(versionFileLines[0]); if (numeFisierVers != "0") { if (MessageBoxResult.Yes == MessageBox.Show("Exista o versiune noua pentru descarcare\nDoriti descarcarea si instalarea noii versiuni?", "Info", MessageBoxButton.YesNo)) { sPath = Environment.CurrentDirectory + @"UpdateWEB\UpdateWEB.exe"; ClasaSuport.StartProgramByFileName(sPath, true); Application.Current.Shutdown(); return; } } } string comunpath = "C:\\E_Intrastat\\System\\DataBase\\Comun.mdb"; bool flag = false; if (!Verifica_Exista_Fisier.Verifica_Fisier(comunpath)) { foreach (var drive in DriveInfo.GetDrives()) { if (Verifica_Exista_Fisier.Verifica_Fisier(drive + "E_Intrastat\\System\\DataBase\\Comun.mdb")) // MessageBox.Show("FIșierul a fost gasit!"); { XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "DataBase", drive + "E_Intrastat\\System\\DataBase\\", true); XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "System", drive + "E_Intrastat\\System\\", true); XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "DirectorSalvare", drive + "E_Intrastat\\System\\DeclaratiiXML\\", true); XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "ReportDefinitionPath", drive + "E_Intrastat\\System\\RaportDefinition", true); flag = true; } } } else { flag = true; } if (flag == false) { MessageBox.Show("Baza de date NU a fost gasita! Exemplu locatie : D:\\E-Intrastat\\System"); Application.Current.Shutdown(); } else { Update_Curs(); Open_Conection_Common(); this.Hide(); } } catch (Exception exp) { MessageBox.Show("Frm_Pornire_Loaded Error: " + exp.Message); Application.Current.Shutdown(); } }