protected override Control OnGetViewControl(DocumentViewContent view) { TranslationProject project = null; if (IdeApp.IsInitialized) { foreach (var tp in IdeApp.Workspace.GetAllItems <TranslationProject> ()) { if (tp.BaseDirectory == FilePath.ParentDirectory) { project = tp; } } } catalog = new Catalog(project); poEditorWidget = new POEditorWidget(project); catalog.DirtyChanged += delegate(object sender, EventArgs args) { HasUnsavedChanges = catalog.IsDirty; }; catalog.Load(null, FilePath); poEditorWidget.Catalog = catalog; poEditorWidget.POFileName = fileName; poEditorWidget.UpdateRules(System.IO.Path.GetFileNameWithoutExtension(fileName)); return(poEditorWidget); }
void UpdateTranslationsAsync(object ob) { object[] data = (object[])ob; IProgressMonitor monitor = (IProgressMonitor)data [0]; TranslationProject project = (TranslationProject)data [1]; Translation translation = (Translation)data [2]; try { project.UpdateTranslations(monitor, translation); Gtk.Application.Invoke(delegate { POEditorWidget.ReloadWidgets(); }); } catch (Exception ex) { monitor.ReportError(GettextCatalog.GetString("Translation update failed."), ex); } finally { monitor.Log.WriteLine(); monitor.Log.WriteLine(GettextCatalog.GetString("---------------------- Done ----------------------")); monitor.Dispose(); } }
public CatalogEditorView (TranslationProject project, string poFile) { catalog = new Catalog (project); poEditorWidget = new POEditorWidget (project); catalog.DirtyChanged += delegate (object sender, EventArgs args) { IsDirty = catalog.IsDirty; }; }
public CatalogEditorView(TranslationProject project, string poFile) { catalog = new Catalog(project); poEditorWidget = new POEditorWidget(project); catalog.DirtyChanged += delegate(object sender, EventArgs args) { IsDirty = catalog.IsDirty; }; }
public CatalogEditorView(TranslationProject project, string poFile) { catalog = new Catalog(project); poEditorWidget = new POEditorWidget(project); catalog.DirtyChanged += delegate(object sender, EventArgs args) { IsDirty = catalog.IsDirty; if (sender is CatalogEntry) { this.poEditorWidget.UpdateEntry(sender as CatalogEntry); } }; }
void UpdateTranslationsAsync(ProgressMonitor monitor, TranslationProject project) { try { project.UpdateTranslations(monitor); Gtk.Application.Invoke((o, args) => { POEditorWidget.ReloadWidgets(); }); } catch (Exception ex) { monitor.ReportError(GettextCatalog.GetString("Translation update failed."), ex); } finally { monitor.Log.WriteLine(); monitor.Log.WriteLine(GettextCatalog.GetString("---------------------- Done ----------------------")); monitor.Dispose(); } }