Exemplo n.º 1
0
        private void FillGrid()
        {
            LanList     = Lans.GetListForCat(ClassType);
            ListForType = LanguageForeigns.GetListForType(ClassType);
            LanguageForeigns.RefreshCache();
            gridLan.BeginUpdate();
            gridLan.Columns.Clear();
            ODGridColumn column = new ODGridColumn("English", 220);

            gridLan.Columns.Add(column);
            column = new ODGridColumn(CultureInfo.CurrentCulture.DisplayName, 220);
            gridLan.Columns.Add(column);
            column = new ODGridColumn("Other " + CultureInfo.CurrentCulture.Parent.DisplayName + " Translation", 220);
            gridLan.Columns.Add(column);
            column = new ODGridColumn(CultureInfo.CurrentCulture.DisplayName + " Comments", 220);
            gridLan.Columns.Add(column);
            //gridLan.Columns[1].Heading=;
            //gridLan.Columns[2].Heading="Other "+CultureInfo.CurrentCulture.Parent.DisplayName+" Translation";
            //gridLan.Columns[3].Heading=CultureInfo.CurrentCulture.DisplayName+" Comments";
            gridLan.Rows.Clear();
            UI.ODGridRow    row;
            LanguageForeign lanForeign;
            LanguageForeign lanForeignOther;

            for (int i = 0; i < LanList.Length; i++)
            {
                row = new OpenDental.UI.ODGridRow();
                row.Cells.Add(LanList[i].English);
                lanForeign      = LanguageForeigns.GetForCulture(ListForType, LanList[i].English, CultureInfo.CurrentCulture.Name);
                lanForeignOther = LanguageForeigns.GetOther(ListForType, LanList[i].English, CultureInfo.CurrentCulture.Name);
                if (lanForeign == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(lanForeign.Translation);
                }
                if (lanForeignOther == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(lanForeignOther.Translation);
                }
                if (lanForeign == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(lanForeign.Comments);
                }
                gridLan.Rows.Add(row);
            }
            gridLan.EndUpdate();
        }
Exemplo n.º 2
0
        private void butDownload_Click(object sender, System.EventArgs e)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                MessageBox.Show("Not allowed when using client web.");
                return;
            }
            string    remoteUri           = "http://www.opendental.com/cultures/";
            string    fileName            = CultureInfo.CurrentCulture.Name + ".txt";//eg. en-US.txt
            string    myStringWebResource = null;
            WebClient myWebClient         = new WebClient();

            myStringWebResource = remoteUri + fileName;
            Cursor = Cursors.WaitCursor;
            try{
                myWebClient.DownloadFile(myStringWebResource, fileName);
            }
            catch {
                Cursor = Cursors.Default;
                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);
                string content = File.ReadAllText(fileName).Trim();
                Lans.LoadTranslationsFromTextFile(content);
            }
            catch {
                Cursor = Cursors.Default;
                MessageBox.Show("Translations not installed properly.");
                return;
            }
            LanguageForeigns.RefreshCache();
            Cursor = Cursors.Default;
            MessageBox.Show("Done");
        }