public void OnPropertyChanged(string name) { CheckDisposed(); switch (name) { default: break; /* remember, what XCore thinks of as a "Content Control", is what this AreaManager sees as a "tool". * with that in mind, this case is invoked when the user chooses a different tool. * the purpose of this code is to then store the name of that tool so that * next time we come back to this area, we can remember to use this same tool. */ case "currentContentControlObject": string toolName = m_propertyTable.GetStringProperty("currentContentControl", ""); var c = m_propertyTable.GetValue <IxCoreContentControl>("currentContentControlObject"); var propName = "ToolForAreaNamed_" + c.AreaName; m_propertyTable.SetProperty(propName, toolName, true); Logger.WriteEvent("Switched to " + toolName); // Should we report a tool change? if (m_lastToolChange.Date != DateTime.Now.Date) { // new day has dawned (or just started up). Reset tool reporting. m_toolsReportedToday.Clear(); m_lastToolChange = DateTime.Now; } string areaNameForReport = m_propertyTable.GetStringProperty("areaChoice", null); if (!string.IsNullOrWhiteSpace(areaNameForReport) && !m_toolsReportedToday.Contains(toolName)) { m_toolsReportedToday.Add(toolName); UsageReporter.SendNavigationNotice("SwitchToTool/{0}/{1}", areaNameForReport, toolName); } break; case "areaChoice": string areaName = m_propertyTable.GetStringProperty("areaChoice", null); if (string.IsNullOrEmpty(areaName)) { break; //this can happen when we use this property very early in the initialization } //for next startup m_propertyTable.SetProperty("InitialArea", areaName, true); ActivateToolForArea(areaName); break; } }
public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters) { CheckDisposed(); _mediator = mediator; //allows the Cache property to function _propertyTable = propertyTable; _cache = _propertyTable.GetValue <LcmCache>("cache"); string name = XmlUtils.GetAttributeValue(configurationParameters, "clerk"); var clerk = RecordClerk.FindClerk(_propertyTable, name); m_clerk = (clerk == null || clerk is TemporaryRecordClerk) ? (InterlinearTextsRecordClerk)RecordClerkFactory.CreateClerk(mediator, _propertyTable, configurationParameters, true) : (InterlinearTextsRecordClerk)clerk; // There's no record bar for it to control, but it should control the staus bar (e.g., it should update if we change // the set of selected texts). m_clerk.ActivateUI(true); _areaName = XmlUtils.GetOptionalAttributeValue(configurationParameters, "area", "unknown"); RebuildStatisticsTable(); //add ourselves so that we can receive messages (related to the text selection currently misnamed AddTexts) mediator.AddColleague(this); //add our current state to the history system string toolName = _propertyTable.GetStringProperty("currentContentControl", ""); mediator.SendMessage("AddContextToHistory", new FwLinkArgs(toolName, Guid.Empty), false); }
/// <summary> /// When a user selects a Reversal Index configuration in the Reversal Indexes area /// to describe how to arrange and show their /// reversal index entries, or in the /// Bulk Edit Reversal Entries area, we also need to set the Reversal Index Guid property to set which /// set of reversal index entries should be shown in the XhtmlDocView. /// Do that. /// </summary> public static void SetReversalIndexGuidBasedOnReversalIndexConfiguration(PropertyTable propertyTable, LcmCache cache) { var reversalIndexConfiguration = propertyTable.GetStringProperty("ReversalIndexPublicationLayout", string.Empty); if (string.IsNullOrEmpty(reversalIndexConfiguration)) { return; } var model = new DictionaryConfigurationModel(reversalIndexConfiguration, cache); var reversalIndexConfigWritingSystemLanguage = model.WritingSystem; var currentAnalysisWsList = cache.LanguageProject.AnalysisWritingSystems; var wsObj = currentAnalysisWsList.FirstOrDefault(ws => ws.Id == reversalIndexConfigWritingSystemLanguage); if (wsObj == null || wsObj.DisplayLabel.ToLower().Contains("audio")) { return; } var riRepo = cache.ServiceLocator.GetInstance <IReversalIndexRepository>(); var mHvoRevIdx = riRepo.FindOrCreateIndexForWs(wsObj.Handle).Hvo; var revGuid = cache.ServiceLocator.GetInstance <ICmObjectRepository>().GetObject(mHvoRevIdx).Guid; propertyTable.SetProperty("ReversalIndexGuid", revGuid.ToString(), true); propertyTable.SetPropertyPersistence("ReversalIndexGuid", true); }
/// <summary> /// Fetches the GUID value of the given property, having checked it is a valid object. /// If it is not a valid object, the property is removed. /// </summary> /// <param name="propertyTable"></param> /// <param name="key">Property name</param> /// <returns>The ReversalIndexGuid, or empty GUID if there is a problem</returns> public static Guid GetObjectGuidIfValid(PropertyTable propertyTable, string key) { var sGuid = propertyTable.GetStringProperty(key, ""); if (string.IsNullOrEmpty(sGuid)) { return(Guid.Empty); } Guid guid; try { guid = new Guid(sGuid); } catch { return(Guid.Empty); } var cache = propertyTable.GetValue <LcmCache>("cache"); if (!cache.ServiceLocator.ObjectRepository.IsValidObjectId(guid)) { propertyTable.RemoveProperty(key); return(Guid.Empty); } return(guid); }
/// <summary> /// Initialize. /// </summary> /// <param name="mediator"></param> /// <param name="propertyTable"></param> /// <param name="configurationParameters"></param> public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; m_propertyTable = propertyTable; m_previousShowTreeBarValue = m_propertyTable.GetBoolProperty("ShowRecordList", true); m_propertyTable.SetProperty("ShowRecordList", false, true); m_configurationParameters = configurationParameters; mediator.AddColleague(this); m_propertyTable.SetProperty("StatusPanelRecordNumber", "", true); m_propertyTable.SetPropertyPersistence("StatusPanelRecordNumber", false); #if notnow m_htmlControl.Browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Browser_DocumentCompleted); #endif SetStrings(); ReadParameters(); DetermineNumberOfPrompts(); DetermineNumberOfTransforms(); SetAlsoSaveInfo(); ReadRegistry(); ShowSketch(); //add our current state to the history system string toolName = m_propertyTable.GetStringProperty("currentContentControl", ""); m_mediator.SendMessage("AddContextToHistory", new FwLinkArgs(toolName, Guid.Empty), false); }
private void InitializeInfoView(RecordClerk clerk) { if (m_mediator == null) { return; } if (m_propertyTable == null) { return; } var xnWindow = m_propertyTable.GetValue <XmlNode>("WindowConfiguration"); if (xnWindow == null) { return; } XmlNode xnControl = xnWindow.SelectSingleNode( "controls/parameters/guicontrol[@id=\"TextInformationPane\"]/control/parameters"); if (xnControl == null) { return; } var activeClerk = m_propertyTable.GetValue <RecordClerk>("ActiveClerk"); var toolChoice = m_propertyTable.GetStringProperty("currentContentControl", null); if (m_xrev != null) { //when re-using the infoview we want to remove and dispose of the old recordeditview and //associated datatree. (LT-13216) Controls.Remove(m_xrev); m_xrev.Dispose(); } m_xrev = new InterlinearTextsRecordEditView(this); if (clerk.GetType().Name == "InterlinearTextsRecordClerk") { m_xrev.Clerk = clerk; } else { //We want to make sure that the following initialization line will initialize this //clerk if we haven't already set it. Without this assignment to null, the InfoPane //misbehaves in the Concordance view (it uses the filter from the InterlinearTexts view) m_xrev.Clerk = null; } m_xrev.Init(m_mediator, m_propertyTable, xnControl); // <-- This call will change the ActiveClerk DisplayCurrentRoot(); m_xrev.Dock = DockStyle.Fill; Controls.Add(m_xrev); // There are times when moving to the InfoPane causes the wrong ActiveClerk to be set. // See FWR-3390 (and InterlinearTextsRecordClerk.OnDisplayInsertInterlinText). var activeClerkNew = m_propertyTable.GetValue <RecordClerk>("ActiveClerk"); if (toolChoice != "interlinearEdit" && activeClerk != null && activeClerk != activeClerkNew) { m_propertyTable.SetProperty("ActiveClerk", activeClerk, true); activeClerk.ActivateUI(true); } }
public bool OnDisplayExport(object commandObject, ref UIItemDisplayProperties display) { CheckDisposed(); // In order for this menu to be visible and enabled it has to be in the correct area (lexicon) // and the right tool(s). // Tools that allow this menu, as far as I (RickM) can tell, as of 10 Aug 2007: // (areaChoice == "lexicon" or "words" or "grammar" or "lists" RecordClerk clerk = Clerk; string areaChoice = m_propertyTable.GetStringProperty("areaChoice", null); //uncomment the following line if we need to turn on or off the Export menu item //for specific tools in the various areas of the application. //string toolChoice = m_mediator.PropertyTable.GetStringProperty("ToolForAreaNamed_lexicon", null); //string toolChoice = m_mediator.PropertyTable.GetStringProperty("grammarSketch_grammar", null); bool inFriendlyTerritory = (areaChoice == "lexicon" || areaChoice == "notebook" || clerk.Id == "concordanceWords" || areaChoice == "grammar" || areaChoice == "lists"); if (inFriendlyTerritory) { display.Enabled = display.Visible = true; } else { display.Enabled = display.Visible = false; } return(true); }
/// <summary> /// Restore any appropriate settings which have values in the property table /// </summary> public static void RestoreSettings(IFdoServiceLocator services, PropertyTable propertyTable) { var hcSettings = propertyTable.GetStringProperty(khomographconfiguration, null); if (hcSettings != null) { var hc = services.GetInstance <HomographConfiguration>(); hc.PersistData = hcSettings; } }
private HashSet <Guid> ExcludedCoreTextIdList() { var idList = m_propertyTable.GetStringProperty(ExcludeCoreTextPropertyName, "").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var excludedGuids = new HashSet <Guid>(); foreach (string id in idList) { Guid guid; try { guid = new Guid(Convert.FromBase64String(id)); } catch (FormatException) { // Just ignore this one. (I'd like to Assert, but a unit test verifies we can handle garbage). Debug.WriteLine(PersistPropertyName + "contains invalid guid " + id); continue; } excludedGuids.Add(guid); } return(excludedGuids); }
/// <returns>true iff activation was needed (the requested Reversal Index was not already active)</returns> private static bool ActivateReversalIndexIfNeeded(string newReversalGuid, PropertyTable propertyTable, RecordClerk clerk, out string oldReversalGuid) { oldReversalGuid = propertyTable.GetStringProperty("ReversalIndexGuid", null); if (newReversalGuid == null || newReversalGuid == oldReversalGuid) { return(false); } // Set the reversal index guid property so that the right guid is found down in DictionaryPublicationDecorater.GetEntriesToPublish, // and manually call OnPropertyChanged to cause LexEdDll ReversalClerk.ChangeOwningObject(guid) to be called. This causes the // right reversal content to be exported, fixing LT-17011. propertyTable.SetProperty("ReversalIndexGuid", newReversalGuid, true); if (clerk != null) { clerk.OnPropertyChanged("ReversalIndexGuid"); } return(true); }
/// <summary> /// This routine encapsulates the process for looking at the spec node of a tool (specifically the /// parameters node controlling the tool for a RecordDocView) and determining the layout that should /// be used as the root of the view. /// Three attributes contribute to this. First, if "layoutProperty" is present, it gives the name of /// a property to be looked up in the mediator to get the desired layout name. /// If nothing is found in the mediator, we fall back to using the "layout" attribute, which is /// mandatory, to determine the view. /// Then, if layoutSuffix is specified, it will be appended to whatever we got from the process above, /// typically appended to the end, but if there is a # suffix already, it goes before that. /// For example: The main dictionary view and the dictionary preview both use views like "publishRoot" /// and "publishStem", and optionally user-defined views like publishRoot#root-612, and both use the /// mediator property DictionaryPublicationLayout to record which view the user has selected. However, /// the preview specifies layoutSuffix "Preview" to indicate that the layout it actually uses /// is (e.g.) publishStemPreview. (This view wraps publishStem with some conditional logic to ensure /// that we display things like "Not published" if the entry is excluded from all publications.) /// </summary> public static string GetLayoutName(XmlNode xnSpec, Mediator mediator, PropertyTable propertyTable) { string sLayout = null; string sProp = XmlUtils.GetOptionalAttributeValue(xnSpec, "layoutProperty", null); if (!String.IsNullOrEmpty(sProp)) { sLayout = propertyTable.GetStringProperty(sProp, null); } if (String.IsNullOrEmpty(sLayout)) { sLayout = XmlUtils.GetMandatoryAttributeValue(xnSpec, "layout"); } var parts = sLayout.Split('#'); parts[0] += XmlUtils.GetOptionalAttributeValue(xnSpec, "layoutSuffix", ""); return(string.Join("#", parts)); }
private void m_btnBrowse_Click(object sender, EventArgs e) { using (var dlg = new SaveFileDialogAdapter()) { dlg.AddExtension = true; dlg.DefaultExt = String.IsNullOrEmpty(m_defaultExt) ? ".xml" : m_defaultExt; dlg.Filter = String.IsNullOrEmpty(m_filter) ? "*.xml" : m_filter; dlg.Title = String.Format(xWorksStrings.ExportTo0, String.IsNullOrEmpty(m_titleFrag) ? "Translated List" : m_titleFrag); dlg.InitialDirectory = m_propertyTable.GetStringProperty("ExportDir", Environment.GetFolderPath(Environment.SpecialFolder.Personal)); if (dlg.ShowDialog(this) != DialogResult.OK) { return; } m_tbFilepath.Text = dlg.FileName; EnableExportButton(); } }
public void MigrateBrowseColumns() { var input = "<root version=\"12\">" + "<column layout=\"Unknown Test\"/>" + "<column label=\"Headword\" sortmethod=\"FullSortKey\" ws=\"$ws=vernacular\" editable=\"false\" width=\"96000\"><span><properties><editable value=\"false\" /></properties><string field=\"MLHeadWord\" ws=\"vernacular\" /></span></column>" + "<column layout=\"Weather\" rubbish=\"nonsense\"/>" + "<column layout=\"IsAHeadwordForEntry\" label=\"Is a Headword\" visibility=\"dialog\"/>" + "<column layout=\"IsAbstractFormForEntry\" label=\"Is Abstract Form\" visibility=\"dialog\" bulkEdit=\"integerOnSubfield\" bulkDelete=\"false\" field=\"LexEntry.LexemeForm\" subfield=\"MoForm.IsAbstract\" items=\"0:no;1:yes\" blankPossible=\"false\" sortType=\"YesNo\"/>" + "<column layout=\"ExceptionFeatures\" label=\"'Exception' Features\" multipara=\"true\" width=\"25%\"/>" + "<column layout=\"PictureCaptionForSense\" label=\"Picture-Caption\" multipara=\"true\" editable=\"false\" visibility=\"dialog\" />" + "<column layout=\"AcademicDomainsForSense\" label=\"Academic Domains\" displayNameProperty=\"ShortNameTSS\" displayWs=\"analysis\" visibility=\"dialog\" />" + "<column layout=\"StatusForSense\" label=\"Status\" field=\"LexSense.Status\" list=\"LexDb.Status\" visibility=\"dialog\"/>" + "<column layout=\"ComplexEntryTypesBrowse\" ws=\"$ws=analysis\" label=\"Complex Form Types\" multipara=\"true\" />" + "<column layout=\"VariantEntryTypesBrowse\" ws=\"$ws=analysis\" label=\"Variant Types\" multipara=\"true\" />" + "<column layout=\"CustomIntegerForEntry_MyField\" label=\"$label\" visibility=\"menu\"/>" + "<column layout=\"CustomGenDateForEntry_SomeField\" label=\"$label\" visibility=\"menu\"/>" + "<column layout=\"CustomPossVectorForEntry_MyField\" label=\"$label\" multipara=\"true\" visibility=\"menu\"/>" + "<column layout=\"CustomPossAtomForEntry_AField\" label=\"$label\" visibility=\"menu\"/>" + "<column layout=\"CustomIntegerForSense_SenseField\" label=\"$label\" visibility=\"menu\"/>" + "<column layout=\"CustomPossVectorForSense_SenseVec\" label=\"$label\" multipara=\"true\" visibility=\"menu\"/>" + "<column layout=\"CustomPossAtomForSense_SenseAtom\" label=\"$label\" visibility=\"menu\"/>" + "<column layout=\"CustomGenDateForAllomorph_MorphDate\" label=\"$label\" visibility=\"menu\"/>" + "<column layout=\"CustomPossAtomForExample_ExAtom\" label=\"$label\" visibility=\"menu\"/>" + "</root>"; using (var mediator = new Mediator()) using (var propertyTable = new PropertyTable(mediator)) { var output = XmlBrowseViewBaseVc.GetSavedColumns(input, mediator, propertyTable, "myKey"); Assert.That(XmlUtils.GetOptionalAttributeValue(output.DocumentElement, "version"), Is.EqualTo(BrowseViewer.kBrowseViewVersion.ToString())); var headwordNode = output.SelectSingleNode("//column[@label='Headword']"); Assert.That(headwordNode, Is.Not.Null); Assert.That(XmlUtils.GetOptionalAttributeValue(headwordNode, "layout"), Is.EqualTo("EntryHeadwordForFindEntry")); Assert.That(propertyTable.GetStringProperty("myKey", ""), Contains.Substring("EntryHeadwordForFindEntry")); var weatherNode = output.SelectSingleNode("//column[@layout='Weather']"); Assert.That(weatherNode, Is.Null); Assert.That(propertyTable.GetStringProperty("myKey", ""), Contains.Substring("EntryHeadwordForFindEntry")); // Should not affect other nodes var unknownNode = output.SelectSingleNode("//column[@layout='Unknown Test']"); Assert.That(unknownNode, Is.Not.Null); var abstractFormNode = output.SelectSingleNode("//column[@layout='IsAbstractFormForEntry']"); Assert.That(abstractFormNode, Is.Not.Null); Assert.That(XmlUtils.GetOptionalAttributeValue(abstractFormNode, "bulkEdit"), Is.EqualTo("booleanOnSubfield")); Assert.That(XmlUtils.GetOptionalAttributeValue(abstractFormNode, "visibility"), Is.EqualTo("dialog")); Assert.That(XmlUtils.GetOptionalAttributeValue(abstractFormNode, "bulkDelete"), Is.EqualTo("false")); VerifyColumn(output, "ExceptionFeatures", "label", "Exception 'Features'"); VerifyColumn(output, "PictureCaptionForSense", "ws", "$ws=vernacular analysis"); VerifyColumn(output, "PictureCaptionForSense", "visibility", "dialog"); VerifyColumn(output, "AcademicDomainsForSense", "displayWs", "best analysis"); VerifyColumn(output, "StatusForSense", "list", "LangProject.Status"); VerifyColumn(output, "ComplexEntryTypesBrowse", "ghostListField", "LexDb.AllComplexEntryRefPropertyTargets"); VerifyColumn(output, "VariantEntryTypesBrowse", "ghostListField", "LexDb.AllVariantEntryRefPropertyTargets"); VerifyColumn(output, "CustomIntegerForEntry_MyField", "sortType", "integer"); VerifyColumn(output, "CustomGenDateForEntry_SomeField", "sortType", "genDate"); VerifyColumn(output, "CustomPossVectorForEntry_MyField", "bulkEdit", "complexListMultiple"); VerifyColumn(output, "CustomPossVectorForEntry_MyField", "field", "LexEntry.$fieldName"); VerifyColumn(output, "CustomPossVectorForEntry_MyField", "list", "$targetList"); VerifyColumn(output, "CustomPossVectorForEntry_MyField", "displayNameProperty", "ShortNameTSS"); VerifyColumn(output, "CustomPossAtomForEntry_AField", "bulkEdit", "atomicFlatListItem"); VerifyColumn(output, "CustomPossAtomForEntry_AField", "field", "LexEntry.$fieldName"); VerifyColumn(output, "CustomPossAtomForEntry_AField", "list", "$targetList"); VerifyColumn(output, "CustomIntegerForSense_SenseField", "sortType", "integer"); VerifyColumn(output, "CustomPossVectorForSense_SenseVec", "field", "LexSense.$fieldName"); VerifyColumn(output, "CustomPossAtomForSense_SenseAtom", "field", "LexSense.$fieldName"); VerifyColumn(output, "CustomGenDateForAllomorph_MorphDate", "sortType", "genDate"); VerifyColumn(output, "CustomPossAtomForExample_ExAtom", "field", "LexExampleSentence.$fieldName"); // version 15 var isAHeadwordNode = output.SelectSingleNode("//column[@layout='IsAHeadwordForEntry']"); Assert.That(isAHeadwordNode, Is.Null); var publishAsHeadwordNode = output.SelectSingleNode("//column[@layout='PublishAsHeadword']"); Assert.That(publishAsHeadwordNode, Is.Not.Null); // version 14 // Todo! // Just version 15 input = "<root version=\"14\">" + "<column layout=\"Unknown Test\"/>" + "<column layout=\"IsAHeadwordForEntry\" label=\"Is a Headword\" visibility=\"dialog\"/>" + "</root>"; output = XmlBrowseViewBaseVc.GetSavedColumns(input, mediator, propertyTable, "myKey"); Assert.That(XmlUtils.GetOptionalAttributeValue(output.DocumentElement, "version"), Is.EqualTo(BrowseViewer.kBrowseViewVersion.ToString())); isAHeadwordNode = output.SelectSingleNode("//column[@layout='IsAHeadwordForEntry']"); Assert.That(isAHeadwordNode, Is.Null); publishAsHeadwordNode = output.SelectSingleNode("//column[@layout='PublishAsHeadword']"); Assert.That(publishAsHeadwordNode, Is.Not.Null); Assert.That(propertyTable.GetStringProperty("myKey", ""), Contains.Substring("PublishAsHeadword")); } }
private void VerifyScriptureList(InterestingTextList testObj, List <IStText> expectedScripture, string comment) { VerifyList(expectedScripture, testObj.ScriptureTexts, comment); Assert.AreEqual(InterestingTextList.MakeIdList(expectedScripture.Cast <ICmObject>()), m_propertyTable.GetStringProperty(InterestingTextList.PersistPropertyName, null)); }
/// <summary> /// Returns the path to the current Dictionary or ReversalIndex configuration file, based on client specification or the current tool /// Guarantees that the path is set to an existing configuration file, which may cause a redisplay of the XHTML view if fUpdate is true. /// </summary> public static string GetCurrentConfiguration(PropertyTable propertyTable, bool fUpdate, string innerConfigDir = null) { // Since this is used in the display of the title and XWorksViews sometimes tries to display the title // before full initialization (if this view is the one being displayed on startup) test the propertyTable before continuing. if (propertyTable == null) { return(null); } if (innerConfigDir == null) { innerConfigDir = GetInnermostConfigurationDirectory(propertyTable); if (innerConfigDir == null) { innerConfigDir = ReversalIndexServices.RevIndexDir; } } var isDictionary = innerConfigDir == DictionaryConfigurationDirectoryName; var pubLayoutPropName = isDictionary ? "DictionaryPublicationLayout" : "ReversalIndexPublicationLayout"; var currentConfig = propertyTable.GetStringProperty(pubLayoutPropName, string.Empty); var cache = propertyTable.GetValue <LcmCache>("cache"); if (!string.IsNullOrEmpty(currentConfig) && File.Exists(currentConfig)) { SetConfigureHomographParameters(currentConfig, cache); return(currentConfig); } var defaultPublication = isDictionary ? "Root" : "AllReversalIndexes"; var defaultConfigDir = GetDefaultConfigurationDirectory(innerConfigDir); var projectConfigDir = GetProjectConfigurationDirectory(propertyTable, innerConfigDir); // If no configuration has yet been selected or the previous selection is invalid, // and the value is "publishSomething", try to use the new "Something" config if (currentConfig != null && currentConfig.StartsWith("publish", StringComparison.Ordinal)) { var selectedPublication = currentConfig.Replace("publish", string.Empty); if (!isDictionary) { var languageCode = selectedPublication.Replace("Reversal-", string.Empty); selectedPublication = cache.ServiceLocator.WritingSystemManager.Get(languageCode).DisplayLabel; } // ENHANCE (Hasso) 2016.01: handle copied configs? Naww, the selected configs really should have been updated on migration currentConfig = Path.Combine(projectConfigDir, selectedPublication + DictionaryConfigurationModel.FileExtension); if (!File.Exists(currentConfig)) { currentConfig = Path.Combine(defaultConfigDir, selectedPublication + DictionaryConfigurationModel.FileExtension); } } if (!File.Exists(currentConfig)) { if (defaultPublication == "AllReversalIndexes") { // check in projectConfigDir for files whose name = default analysis ws if (TryMatchingReversalConfigByWritingSystem(projectConfigDir, cache, out currentConfig)) { propertyTable.SetProperty(pubLayoutPropName, currentConfig, fUpdate); return(currentConfig); } } // select the project's Root configuration if available; otherwise, select the default Root configuration currentConfig = Path.Combine(projectConfigDir, defaultPublication + DictionaryConfigurationModel.FileExtension); if (!File.Exists(currentConfig)) { currentConfig = Path.Combine(defaultConfigDir, defaultPublication + DictionaryConfigurationModel.FileExtension); } } if (File.Exists(currentConfig)) { propertyTable.SetProperty(pubLayoutPropName, currentConfig, fUpdate); } else { propertyTable.RemoveProperty(pubLayoutPropName); } return(currentConfig); }
private void tvSource_AfterSelect(object sender, TreeViewEventArgs e) { using (new WaitCursor(this, true)) { // Swap out the browse view. if (m_currentBrowseView != null) { // Get rid of old one. m_currentBrowseView.Hide(); m_pnlConcBrowseHolder.Controls.Remove(m_currentBrowseView); m_currentBrowseView.Dispose(); m_currentBrowseView = null; } XmlNode configurationNode; RecordClerk clerk; var selObj = (IAnalysis)tvSource.SelectedNode.Tag; switch (selObj.ClassID) { default: throw new InvalidOperationException("Class not recognized."); case WfiWordformTags.kClassId: configurationNode = m_configurationNodes[WfiWordformTags.kClassId]; clerk = m_recordClerks[WfiWordformTags.kClassId]; break; case WfiAnalysisTags.kClassId: configurationNode = m_configurationNodes[WfiAnalysisTags.kClassId]; clerk = m_recordClerks[WfiAnalysisTags.kClassId]; break; case WfiGlossTags.kClassId: configurationNode = m_configurationNodes[WfiGlossTags.kClassId]; clerk = m_recordClerks[WfiGlossTags.kClassId]; break; } clerk.OwningObject = selObj; m_currentBrowseView = new RecordBrowseView(); m_currentBrowseView.Init(m_mediator, m_propertyTable, configurationNode); // Ensure that the list gets updated whenever it's reloaded. See LT-8661. var sPropName = clerk.Id + "_AlwaysRecomputeVirtualOnReloadList"; m_propertyTable.SetProperty(sPropName, true, false); m_propertyTable.SetPropertyPersistence(sPropName, false); m_currentBrowseView.Dock = DockStyle.Fill; m_pnlConcBrowseHolder.Controls.Add(m_currentBrowseView); m_currentBrowseView.CheckBoxChanged += m_currentBrowseView_CheckBoxChanged; m_currentBrowseView.BrowseViewer.SelectionChanged += BrowseViewer_SelectionChanged; m_currentBrowseView.BrowseViewer.FilterChanged += BrowseViewer_FilterChanged; SetRecordStatus(); m_specialSda = m_currentBrowseView.BrowseViewer.SpecialCache; var specialMdc = m_specialSda.MetaDataCache; int[] concordanceItems; switch (selObj.ClassID) { default: throw new InvalidOperationException("Class not recognized."); case WfiWordformTags.kClassId: m_currentSourceFakeFlid = specialMdc.GetFieldId2(WfiWordformTags.kClassId, "ExactOccurrences", false); concordanceItems = m_specialSda.VecProp(selObj.Hvo, m_currentSourceFakeFlid); break; case WfiAnalysisTags.kClassId: m_currentSourceFakeFlid = specialMdc.GetFieldId2(WfiAnalysisTags.kClassId, "ExactOccurrences", false); concordanceItems = m_specialSda.VecProp(selObj.Hvo, m_currentSourceFakeFlid); break; case WfiGlossTags.kClassId: m_currentSourceFakeFlid = specialMdc.GetFieldId2(WfiGlossTags.kClassId, "ExactOccurrences", false); concordanceItems = m_specialSda.VecProp(selObj.Hvo, m_currentSourceFakeFlid); break; } // (Re)set selected state in cache, so default behavior of checked is used. foreach (var concId in concordanceItems) { m_specialSda.SetInt(concId, XMLViewsDataCache.ktagItemSelected, 1); } // Set the initial value for the filtering status. var sFilterMsg = m_propertyTable.GetStringProperty("DialogFilterStatus", String.Empty); if (sFilterMsg != null) { sFilterMsg = sFilterMsg.Trim(); } SetFilterStatus(!String.IsNullOrEmpty(sFilterMsg)); CheckAssignBtnEnabling(); } }
public PublicationActivator(PropertyTable propertyTable) { m_currentPublication = propertyTable.GetStringProperty("SelectedPublication", null); m_propertyTable = propertyTable; }