private void butDownload_Click(object sender, System.EventArgs e) { string remoteUri = "http://www.open-dent.com/cultures/"; string fileName = CultureInfo.CurrentCulture.Name + ".sql";//eg. en-US.sql string myStringWebResource = null; WebClient myWebClient = new WebClient(); myStringWebResource = remoteUri + fileName; try{ myWebClient.DownloadFile(myStringWebResource, fileName); } catch { MessageBox.Show("Either you do not have internet access, or no translations are available for " + CultureInfo.CurrentCulture.DisplayName); return; } ClassConvertDatabase ConvertDB = new ClassConvertDatabase(); try{ ConvertDB.ExecuteFile(fileName); } catch { MessageBox.Show("Translations not installed properly."); return; } LanguageForeigns.Refresh(CultureInfo.CurrentCulture); MessageBox.Show("Done"); }
///<summary>This ONLY runs when first opening the program. It returns true if either no conversion is necessary, or if conversion was successful. False for other situations like corrupt db, trying to convert to older version, etc. Silent mode is ONLY used for internal tools, NEVER with the main program.</summary> public static bool ConvertDB(bool silent,string toVersion) { ClassConvertDatabase ClassConvertDatabase2=new ClassConvertDatabase(); string pref=PrefC.GetString(PrefName.DataBaseVersion); //(Pref)PrefC.HList["DataBaseVersion"]; //Debug.WriteLine(pref.PrefName+","+pref.ValueString); if(ClassConvertDatabase2.Convert(pref,toVersion,silent)) { //((Pref)PrefC.HList["DataBaseVersion"]).ValueString)) { return true; } else { Application.Exit(); return false; } }
///<summary>This ONLY runs when first opening the program</summary> public static bool ConvertDB() { ClassConvertDatabase ClassConvertDatabase2 = new ClassConvertDatabase(); string pref = PrefB.GetString("DataBaseVersion"); //(Pref)PrefB.HList["DataBaseVersion"]; //Debug.WriteLine(pref.PrefName+","+pref.ValueString); if (ClassConvertDatabase2.Convert(pref)) { //((Pref)PrefB.HList["DataBaseVersion"]).ValueString)) { return(true); } else { Application.Exit(); return(false); } }