/// <summary> /// Update the data in the viewmodels /// </summary> void UpdateProjectData() { var vmGrps = Groups.ToList(); foreach (var group in Project.Groups) { var vmGrp = vmGrps.FirstOrDefault(g => String.Equals(g.Name, group.Name, StringComparison.OrdinalIgnoreCase)); if (vmGrp == null) { vmGrp = new GroupViewModel(this, group.Name); Groups.Add(vmGrp); } vmGrp.Caption = group.Caption; vmGrp.UpdateFiles(group.Files); vmGrps.Remove(vmGrp); } // Remove the viewmodel groups not found in the project data foreach (var grp in vmGrps) Groups.Remove(grp); }
/// <summary> /// New translation file /// </summary> public TranslationFileViewModel(GroupViewModel group, TranslationFile file) { this.Group = group; this.File = file; if (this.File.IsNeutral) { this.Caption = Locales.SR.NeutralLanguageFile_Caption; } else { try { this.Culture = CultureInfo.GetCultureInfo(file.Language); } catch { } if (this.Culture == null) this.Caption = String.Format(Locales.SR.UnknownLanguageFile_Caption, this.File.Language); else this.Caption = this.Culture.DisplayName; } }