public void TestTeardown() { m_extender = null; m_manager = null; var localAppDataDir = Directory.GetParent(Path.GetDirectoryName(m_translationPath)); Directory.Delete(localAppDataDir.FullName, true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="LocTreeNode{T}"/> class. /// </summary> /// ------------------------------------------------------------------------------------ internal LocTreeNode(ILocalizationManagerInternal <T> manager, string text, string id, string key) { Manager = manager; Text = text; Id = id; Name = key; SavedTranslationInfo = new Dictionary <string, LocalizingInfo>(); }
/// ------------------------------------------------------------------------------------ internal static DialogResult ShowDialog(ILocalizationManagerInternal <T> callingManager, string id, bool runInReadonlyMode) { if (callingManager != null && !callingManager.CanCustomizeLocalizations) { runInReadonlyMode = true; } var viewModel = new LocalizeItemDlgViewModel <T>(runInReadonlyMode); using (var dlg = new LocalizeItemDlg <T>(viewModel, id, callingManager)) return(dlg.ShowDialog()); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Setup for each test. /// </summary> /// ------------------------------------------------------------------------------------ protected void TestSetup(TranslationMemory kind, string installedTranslationDir) { var dir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); m_manager = LocalizationManager.Create(kind, "en", "Test", "Test", "1.0", Path.Combine(dir, installedTranslationDir), "", null, "") as ILocalizationManagerInternal <T>; m_translationPath = m_manager.GetPathForLanguage("en", true); m_extender = new L10NSharpExtender { LocalizationManagerId = "Test" }; }
/// ------------------------------------------------------------------------------------ internal static DialogResult ShowDialog(ILocalizationManagerInternal <T> callingManager, IComponent component, bool runInReadonlyMode) { if (callingManager != null && !callingManager.CanCustomizeLocalizations) { runInReadonlyMode = true; } var viewModel = new LocalizeItemDlgViewModel <T>(runInReadonlyMode); var id = (callingManager == null ? viewModel.GetObjIdFromAnyCache(component) : callingManager.ComponentCache.FirstOrDefault(kvp => kvp.Key == component).Value); using (var dlg = new LocalizeItemDlg <T>(viewModel, id, callingManager)) return(dlg.ShowDialog()); }
/// ------------------------------------------------------------------------------------ private LocalizeItemDlg(LocalizeItemDlgViewModel <T> viewModel, string id, ILocalizationManagerInternal <T> callingManager) : this() { _viewModel = viewModel; _callingManager = callingManager; Initialize(); if (id == null) { return; } var node = _viewModel.FindNode(id, _treeView.Nodes); if (node == null) { return; } _viewModel.CurrentNode = node; _treeView.SelectedNode = node; UpdateSingleItemView(); }
/// ------------------------------------------------------------------------------------ private IEnumerable <IComponent> GetComponentsForId(ILocalizationManagerInternal <T> lm, string id) { return(lm.ComponentCache.Where(kvp => kvp.Value == id).Select(kvp => kvp.Key)); }