/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_dlg != null) { m_dlg.Dispose(); } if (m_vc != null) { m_vc.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_dlg = null; m_vc = null; m_pageInfo = null; m_hfSets = null;; base.Dispose(disposing); }
private void TestFeatureStructureContent(IFsFeatStruc featStruct) { FdoOwningCollection <IFsFeatureSpecification> specCol = featStruct.FeatureSpecsOC; Assert.AreEqual(1, specCol.Count, "Count of top level feature specs"); foreach (IFsFeatureSpecification spec in specCol) { IFsComplexValue complex = spec as IFsComplexValue; Assert.IsNotNull(complex, "complex feature value is null and should not be"); Assert.AreEqual("subject agreement", complex.FeatureRA.Name.AnalysisDefaultWritingSystem, "Expected complex feature name"); IFsFeatStruc fsNested = (IFsFeatStruc)complex.ValueOA; FdoOwningCollection <IFsFeatureSpecification> fsNestedCol = fsNested.FeatureSpecsOC; Assert.AreEqual(2, fsNestedCol.Count, "Nested fs has one feature"); foreach (IFsFeatureSpecification specNested in fsNestedCol) { IFsClosedValue closed = specNested as IFsClosedValue; Assert.IsNotNull(closed, "closed feature value is null and should not be"); if (!(((closed.FeatureRA.Name.AnalysisDefaultWritingSystem == "gender") && (closed.ValueRA.Name.AnalysisDefaultWritingSystem == "feminine gender")) || ((closed.FeatureRA.Name.AnalysisDefaultWritingSystem == "person") && (closed.ValueRA.Name.AnalysisDefaultWritingSystem == "first person")))) { Assert.Fail("Unexpected value found: {0}:{1}", closed.FeatureRA.Name.AnalysisDefaultWritingSystem, closed.ValueRA.Name.AnalysisDefaultWritingSystem); } } } }
public void GreaterThanOrEqual() { // Setup test values Cache.LangProject.PeopleOA = new CmPossibilityList(); ICmPossibility person1 = Cache.LangProject.PeopleOA.PossibilitiesOS.Append(new CmPerson()); person1.ForeColor = 4; ICmPossibility person2 = Cache.LangProject.PeopleOA.PossibilitiesOS.Append(new CmPerson()); person2.ForeColor = 5; ICmPossibility person3 = Cache.LangProject.PeopleOA.PossibilitiesOS.Append(new CmPerson()); person3.ForeColor = 10; // Setup filter FdoOwningCollection <ICmFilter> filtersCol = Cache.LangProject.FiltersOC; ICmFilter filter = filtersCol.Add(new CmFilter()); filter.ColumnInfo = CmPossibility.kClassId + "," + (int)CmPossibility.CmPossibilityTags.kflidForeColor; ICmRow row = filter.RowsOS.Append(new CmRow()); ICmCell cell1 = row.CellsOS.Append(new DummyCmCell()); cell1.Contents.Text = ">= 5"; // Check the result ((CmFilter)filter).InitCriteria(); Assert.IsFalse(((CmFilter)filter).MatchesCriteria(person1.Hvo)); Assert.IsTrue(((CmFilter)filter).MatchesCriteria(person2.Hvo)); Assert.IsTrue(((CmFilter)filter).MatchesCriteria(person3.Hvo)); }
public void MergeGuids() { CheckDisposed(); // Use LangProject.Filters. FdoOwningCollection<ICmFilter> filtersCol = Cache.LangProject.FiltersOC; ICmFilter keeper = filtersCol.Add(new CmFilter()); ICmFilter src = filtersCol.Add(new CmFilter()); // Ensure empty (new) guid does not get changed. Assert.IsTrue(keeper.App == Guid.Empty); src.App = Guid.NewGuid(); Guid oldSrcGuid = src.App; keeper.MergeObject(src); Assert.IsTrue(keeper.App == oldSrcGuid); // Should not change extant guid in either of the next two checks. Guid newGuid = Guid.NewGuid(); keeper.App = newGuid; src = filtersCol.Add(new CmFilter()); src.App = Guid.NewGuid(); keeper.MergeObject(src); Assert.IsTrue(keeper.App == newGuid); src = filtersCol.Add(new CmFilter()); src.App = Guid.Empty; keeper.MergeObject(src); Assert.IsTrue(keeper.App == newGuid); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ protected override void CreateTestData() { m_inMemoryCache.InitializeWritingSystemEncodings(); m_inMemoryCache.InitializeLexDb(); m_ldb = Cache.LangProject.LexDbOA; m_entriesCol = m_ldb.EntriesOC; }
public void FdoOwningCollection_AddToOCFromOS() { CheckDisposed(); // Now test to see if something can actually be moved. // We will use subrecords in a RN object for this. // The source flid is a sequence, while the destination is a collection. m_inMemoryCache.InitializeDataNotebook(); IRnResearchNbk rn = Cache.LangProject.ResearchNotebookOA; IRnEvent ev = (IRnEvent)rn.RecordsOC.Add(new RnEvent()); ev.SubRecordsOS.Append(new RnEvent()); ev.SubRecordsOS.Append(new RnEvent()); ev.SubRecordsOS.Append(new RnEvent()); FdoOwningSequence <IRnGenericRec> os = ev.SubRecordsOS; int[] ahvoSrcBefore = (int[])os.HvoArray.Clone(); FdoOwningCollection <IRnGenericRec> oc = Cache.LangProject.ResearchNotebookOA.RecordsOC; int[] ahvoDstBefore = (int[])oc.HvoArray.Clone(); oc.Add(os.HvoArray); // Check data. Assert.AreEqual(0, os.HvoArray.Length); // Not empty, so they didn't all get moved. Assert.AreEqual((ahvoSrcBefore.Length + ahvoDstBefore.Length), oc.HvoArray.Length); // Not the same size, so they didn't get moved. // Make sure everything in ahvoDstBefore is still in cv.HvoArray. // If not, then the test failed. foreach (int i in ahvoDstBefore) { bool fFailed = true; foreach (int j in oc.HvoArray) { if (i == j) { fFailed = false; break; } } Assert.IsFalse(fFailed); } // Make sure everything in ahvoSrcBefore made it into cv.HvoArray. // If not, then the test failed. foreach (int i in ahvoSrcBefore) { bool fFailed = true; foreach (int j in oc.HvoArray) { if (i == j) { fFailed = false; break; } } Assert.IsFalse(fFailed); } }
private void InitializeStylesComboBox() { // ==================================================================== // Set the Style combo box. This one can have a style that isn't defined // yet. If so, it will show in a different color. // (This list only shows the Character styles.) cbStyle.Items.Clear(); cbStyle.Items.Add(NoChange); cbStyle.SelectedItem = NoChange; cbStyle.Text = NoChange; FdoOwningCollection <IStStyle> oc = m_cache.LangProject.LexDbOA.StylesOC; if (oc == null || oc.Count < 1) { System.Diagnostics.Debug.WriteLine("No style info retrieved from the cache."); } foreach (StStyle style in oc) { if (StyleType.kstCharacter == style.Type) { int pos = cbStyle.Items.Add(style.Name); if (style.Name == m_inlineMarker.Style) { cbStyle.SelectedIndex = pos; cbStyle.SelectedItem = style.Name; } } } // if there's a Style in the Marker - select it or set it as unique, otherwise select noChange if (!m_inlineMarker.HasStyle) { cbStyle.SelectedItem = NoChange; } else { int foundPos = cbStyle.FindStringExact(m_inlineMarker.Style); if (foundPos >= 0) { // select the item in the combo that matches cbStyle.SelectedItem = m_inlineMarker.Style; } else { // just put it in the text box and set the color cbStyle.Text = m_inlineMarker.Style; cbStyle.ForeColor = System.Drawing.Color.Blue; } if (cbStyle.Text.Trim().Length == 0) { cbStyle.SelectedItem = NoChange; cbStyle.Text = NoChange; } } }
public void FdoOwningCollection_AddToOC() { CheckDisposed(); FdoOwningCollection <IMoAdhocProhib> oc = Cache.LangProject.MorphologicalDataOA.AdhocCoProhibitionsOC; MoAlloAdhocProhib acp = (MoAlloAdhocProhib)oc.Add(new MoAlloAdhocProhib()); oc.Add(acp); // Try adding it again. // This should work, but it won't actually be moved anywhere. }
public void FdoOwningCollection_AddingNull() { CheckDisposed(); FdoOwningCollection <IMoAdhocProhib> oc = Cache.LangProject.MorphologicalDataOA.AdhocCoProhibitionsOC; // Should throw a null argument exception. IMoAdhocProhib p = null; oc.Add(p); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets a resource matching the specified name from the Owning object from a collection /// of resources specified by the field id. /// </summary> /// <param name="cache">database</param> /// <param name="hvoOwner">id of the owning object</param> /// <param name="flid">field id in the owning object</param> /// <param name="name">name of the specified resource</param> /// <returns>resource with the specified name</returns> /// ------------------------------------------------------------------------------------ public static CmResource GetResource(FdoCache cache, int hvoOwner, int flid, string name) { FdoOwningCollection<ICmResource> resources = new FdoOwningCollection<ICmResource>(cache, hvoOwner, flid); foreach (CmResource resource in resources) { if (resource.Name.Equals(name)) return resource; } return null; }
public void FdoOwningCollection_AddToOC_WithUnownedId() { CheckDisposed(); FdoOwningCollection <IMoAdhocProhib> oc = Cache.LangProject.MorphologicalDataOA.AdhocCoProhibitionsOC; MoAlloAdhocProhib acp = new MoAlloAdhocProhib(); // This should fail, since it has an unowned id in the array. int[] ahvo = new int[2]; ahvo[0] = acp.Hvo; ahvo[1] = 1; // Bad ID, since it isn't owned in source flid. oc.Add(ahvo); }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_inMemoryCache.InitializeLexDb(); m_hfSets = Cache.LangProject.LexDbOA.HeaderFooterSetsOC; IPublication pub = CreateFakeHFSets(); m_dlg = new DummyHeaderFooterSetupDlg(Cache, pub, (CmMajorObject)Cache.LangProject.LexDbOA); m_pageInfo = new HFDialogsPageInfo(true); m_vc = new DummyHFSetupDlgVC(m_pageInfo, Cache.DefaultVernWs, DateTime.Now, Cache); }
private void btnTrace_Click(object sender, System.EventArgs e) { FdoOwningCollection <IWfiWordform> words = m_selectedFdoCache.LangProject.WordformInventoryOA.WordformsOC; if (words.Count == 0) { MessageBox.Show("Can't do that, because there are no wordforms in this project."); return; } IWfiWordform word = WfiWordform.CreateFromDBObject(m_selectedFdoCache, words.HvoArray[0]); m_selectedParserConnection.TryAWordAsynchronously(word.Form.VernacularDefaultWritingSystem, true); }
public void MergeUnicode() { CheckDisposed(); // 15 CmFilter.Name string goodFilter = "Fram"; string junkFilter = "Brand X"; FdoOwningCollection<ICmFilter> filtersCol = Cache.LangProject.FiltersOC; ICmFilter keeper = filtersCol.Add(new CmFilter()); ICmFilter src = filtersCol.Add(new CmFilter()); // Merge content into null original. src.Name = goodFilter; keeper.MergeObject(src); Assert.AreEqual(keeper.Name, goodFilter); // Try to merge empty string into null. keeper.Name = null; src = filtersCol.Add(new CmFilter()); src.Name = ""; keeper.MergeObject(src); Assert.IsNull(keeper.Name); // Try to merge empty string into content. keeper.Name = goodFilter; src = filtersCol.Add(new CmFilter()); src.Name = ""; keeper.MergeObject(src); Assert.AreEqual(keeper.Name, goodFilter); // Try to merge content into content. keeper.Name = goodFilter; src = filtersCol.Add(new CmFilter()); src.Name = junkFilter; keeper.MergeObject(src); Assert.AreEqual(keeper.Name, goodFilter); // Test merge append src = filtersCol.Add(new CmFilter()); src.Name = junkFilter; keeper.MergeObject(src, true); Assert.AreEqual(keeper.Name, goodFilter + ' ' + junkFilter); // But don't append if equal. keeper.Name = goodFilter; src = filtersCol.Add(new CmFilter()); src.Name = goodFilter; keeper.MergeObject(src, true); Assert.AreEqual(keeper.Name, goodFilter); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets a resource matching the specified name from the Owning object from a collection /// of resources specified by the field id. /// </summary> /// <param name="cache">database</param> /// <param name="hvoOwner">id of the owning object</param> /// <param name="flid">field id in the owning object</param> /// <param name="name">name of the specified resource</param> /// <returns>resource with the specified name</returns> /// ------------------------------------------------------------------------------------ public static CmResource GetResource(FdoCache cache, int hvoOwner, int flid, string name) { FdoOwningCollection <ICmResource> resources = new FdoOwningCollection <ICmResource>(cache, hvoOwner, flid); foreach (CmResource resource in resources) { if (resource.Name.Equals(name)) { return(resource); } } return(null); }
public void VectorRemove_OwningCollection() { CheckDisposed(); // Remove an entry from owning collection. FdoOwningCollection <ILexEntry> oc = Cache.LangProject.LexDbOA.EntriesOC; oc.Add(new LexEntry()); oc.Add(new LexEntry()); oc.Add(new LexEntry()); int[] vhvo = oc.HvoArray; oc.Remove(vhvo[1]); Assert.AreEqual(2, oc.Count); }
public void VectorEnumerator() { CheckDisposed(); FdoOwningCollection <IWfiWordform> oc = m_fdoCache.LangProject.WordformInventoryOA.WordformsOC; //do this two times to reduce the interference of which method went first. for (int i = 0; i < 2; i++) { //test using hvos and no pre-caching int[] hvos = oc.HvoArray; foreach (int hvo in hvos) { WfiWordform word; word = new WfiWordform(m_fdoCache, hvo); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets a resource matching the specified name from the Owning object from a collection /// of resources specified by the field id. /// </summary> /// <param name="cache">database</param> /// <param name="hvoOwner">id of the owning object</param> /// <param name="flid">field id in the owning object</param> /// <param name="name">name of the specified resource</param> /// <param name="newVersion">new version number for the resource</param> /// ------------------------------------------------------------------------------------ public static void SetResource(FdoCache cache, int hvoOwner, int flid, string name, Guid newVersion) { CmResource resource = GetResource(cache, hvoOwner, flid, name); if (resource == null) { // Resource does not exist yet. Add it to the collection. FdoOwningCollection<ICmResource> resources = new FdoOwningCollection<ICmResource>(cache, hvoOwner, flid); CmResource newResource = new CmResource(); resources.Add(newResource); newResource.Name = name; newResource.Version = newVersion; return; } resource.Version = newVersion; }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { // Dispose managed resources here. } // Dispose unmanaged resources here, whether disposing is true or false. m_entriesCol = null; m_ldb = null; base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets a resource matching the specified name from the Owning object from a collection /// of resources specified by the field id. /// </summary> /// <param name="cache">database</param> /// <param name="hvoOwner">id of the owning object</param> /// <param name="flid">field id in the owning object</param> /// <param name="name">name of the specified resource</param> /// <param name="newVersion">new version number for the resource</param> /// ------------------------------------------------------------------------------------ public static void SetResource(FdoCache cache, int hvoOwner, int flid, string name, Guid newVersion) { CmResource resource = GetResource(cache, hvoOwner, flid, name); if (resource == null) { // Resource does not exist yet. Add it to the collection. FdoOwningCollection <ICmResource> resources = new FdoOwningCollection <ICmResource>(cache, hvoOwner, flid); CmResource newResource = new CmResource(); resources.Add(newResource); newResource.Name = name; newResource.Version = newVersion; return; } resource.Version = newVersion; }
/// <summary> /// /// </summary> /// <param name="featSys"></param> /// <param name="mediator"></param> /// <param name="launchedFromInsertMenu"></param> /// <param name="sWindowKey">used to store location and size of dialog window</param> /// <param name="sXmlFile">file containing the XML form of the gloss list</param> public void SetDlginfo(IFsFeatureSystem featSys, Mediator mediator, bool launchedFromInsertMenu, string sWindowKey, string sXmlFile) { CheckDisposed(); m_featureSystem = featSys; m_featureList = featSys.FeaturesOC; m_launchedFromInsertMenu = launchedFromInsertMenu; m_mediator = mediator; if (mediator != null) { m_sWindowKeyLocation = sWindowKey + "Location"; m_sWindowKeySize = sWindowKey + "Size"; ResetWindowLocationAndSize(); } m_cache = featSys.Cache; LoadMasterFeatures(sXmlFile); m_tvMasterList.Cache = m_cache; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a new style and add it to the Language Project stylesheet. /// </summary> /// <param name="name">style name</param> /// <param name="context">style context</param> /// <param name="structure">style structure</param> /// <param name="function">style function</param> /// <param name="isCharStyle">true if character style, otherwise false</param> /// <param name="userLevel">The user level.</param> /// <param name="styleCollection">The style collection.</param> /// <returns>The style</returns> /// ------------------------------------------------------------------------------------ public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure, FunctionValues function, bool isCharStyle, int userLevel, FdoOwningCollection <IStStyle> styleCollection) { CheckDisposed(); ITsPropsBldr bldr = TsPropsBldrClass.Create(); StStyle style = new StStyle(); styleCollection.Add(style); style.Name = name; style.Context = context; style.Structure = structure; style.Function = function; style.Rules = bldr.GetTextProps(); style.Type = (isCharStyle ? StyleType.kstCharacter : StyleType.kstParagraph); style.UserLevel = userLevel; return(style); }
protected void AddWords(ParserScheduler.Priority priority) { FdoOwningCollection <IWfiWordform> words = m_selectedFdoCache.LangProject.WordformInventoryOA.WordformsOC; if (words.Count == 0) { MessageBox.Show("Can't do that, because there are no wordforms in this project."); return; } Random r = new Random(); for (int i = 0; i < 10; i++) { int index = r.Next(0, words.Count - 1); int hvo = words.HvoArray[index]; m_selectedParserConnection.Parser.ScheduleOneWordformForUpdate(hvo, priority); } }
public void FdoReferenceCollection() { CheckDisposed(); ILexDb ldb = Cache.LangProject.LexDbOA; ldb.EntriesOC.Add(new LexEntry()); ldb.EntriesOC.Add(new LexEntry()); // Gather up all entries in the DB. int iLESize = Cache.GetVectorSize(ldb.Hvo, (int)LexDb.LexDbTags.kflidEntries); FdoOwningCollection <ILexEntry> ocvLexEntriesOC = ldb.EntriesOC; int[] ahvoLexEntriesOC = ocvLexEntriesOC.HvoArray; // Check sizes. They should be the same. Assert.AreEqual(iLESize, ahvoLexEntriesOC.Length, "Mis-matched number of entries."); FdoReferenceCollection <ILexEntry> rcLexEntriesRCBefore = ldb.LexicalFormIndexRC; int[] ahvoLexEntriesRCBefore = rcLexEntriesRCBefore.HvoArray; int iOldRCSize = ahvoLexEntriesRCBefore.Length; // Add all entries to reference collection. rcLexEntriesRCBefore.Add(ahvoLexEntriesOC); // Make sure they are there now. FdoReferenceCollection <ILexEntry> rcLexEntriesRCAfter = ldb.LexicalFormIndexRC; int[] ahvoLexEntriesRCAfter = rcLexEntriesRCAfter.HvoArray; Assert.AreEqual((ahvoLexEntriesOC.Length + iOldRCSize), ahvoLexEntriesRCAfter.Length, "Mis-matched number of entries in reference collection."); // Size of ahvoLexEntriesRCAfter is right, so quit. // Note: One could check the IDs, but it probably isn't needed, // as long as nobody else was messing with database at the same time. // Try adding a duplicate item to reference collection. // The size should be the same before as after. rcLexEntriesRCAfter.Add(ahvoLexEntriesOC[0]); Assert.AreEqual(ahvoLexEntriesRCAfter.Length, rcLexEntriesRCAfter.HvoArray.Length, "Mis-matched number of entries in reference collection."); }
public override void Exit() { CheckDisposed(); try { if (m_dlg != null) { m_dlg.Dispose(); m_dlg = null; } if (m_vc != null) { m_vc.Dispose(); m_vc = null; } m_hfSets = null; m_pageInfo = null; } finally { base.Exit(); } }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (components != null) { components.Dispose(); } } m_cache = null; m_selFeatDefn = null; m_featureList = null; m_mediator = null; base.Dispose(disposing); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { // Dispose managed resources here. if (m_dlg != null) m_dlg.Dispose(); if (m_vc != null) m_vc.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. m_dlg = null; m_vc = null; m_pageInfo = null; m_hfSets = null;; base.Dispose(disposing); }
internal TextBuilder(FdoOwningCollection<FDO.IText> owner) { m_owner = owner; m_cache = owner.Cache; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a new style and add it to the Language Project stylesheet. /// </summary> /// <param name="name">style name</param> /// <param name="context">style context</param> /// <param name="structure">style structure</param> /// <param name="function">style function</param> /// <param name="isCharStyle">true if character style, otherwise false</param> /// <param name="styleCollection">The style collection.</param> /// <returns>The style</returns> /// ------------------------------------------------------------------------------------ public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure, FunctionValues function, bool isCharStyle, FdoOwningCollection<IStStyle> styleCollection) { return AddTestStyle(name, context, structure, function, isCharStyle, 0, styleCollection); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a new style and add it to the Language Project stylesheet. /// </summary> /// <param name="name">style name</param> /// <param name="context">style context</param> /// <param name="structure">style structure</param> /// <param name="function">style function</param> /// <param name="isCharStyle">true if character style, otherwise false</param> /// <param name="userLevel">The user level.</param> /// <param name="styleCollection">The style collection.</param> /// <returns>The style</returns> /// ------------------------------------------------------------------------------------ public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure, FunctionValues function, bool isCharStyle, int userLevel, FdoOwningCollection<IStStyle> styleCollection) { CheckDisposed(); ITsPropsBldr bldr = TsPropsBldrClass.Create(); StStyle style = new StStyle(); styleCollection.Add(style); style.Name = name; style.Context = context; style.Structure = structure; style.Function = function; style.Rules = bldr.GetTextProps(); style.Type = (isCharStyle ? StyleType.kstCharacter : StyleType.kstParagraph); style.UserLevel = userLevel; return style; }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if( disposing ) { if(components != null) { components.Dispose(); } } m_cache = null; m_selFeatDefn = null; m_featureList = null; m_mediator = null; base.Dispose( disposing ); }
/// <summary> /// /// </summary> /// <param name="featSys"></param> /// <param name="mediator"></param> /// <param name="launchedFromInsertMenu"></param> /// <param name="sWindowKey">used to store location and size of dialog window</param> /// <param name="sXmlFile">file containing the XML form of the gloss list</param> public void SetDlginfo(IFsFeatureSystem featSys, Mediator mediator, bool launchedFromInsertMenu, string sWindowKey, string sXmlFile) { CheckDisposed(); m_featureSystem = featSys; m_featureList = featSys.FeaturesOC; m_launchedFromInsertMenu = launchedFromInsertMenu; m_mediator = mediator; if (mediator != null) { m_sWindowKeyLocation = sWindowKey + "Location"; m_sWindowKeySize = sWindowKey + "Size"; ResetWindowLocationAndSize(); } m_cache = featSys.Cache; LoadMasterFeatures(sXmlFile); m_tvMasterList.Cache = m_cache; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a new style and add it to the Language Project stylesheet. /// </summary> /// <param name="name">style name</param> /// <param name="context">style context</param> /// <param name="structure">style structure</param> /// <param name="function">style function</param> /// <param name="isCharStyle">true if character style, otherwise false</param> /// <param name="styleCollection">The style collection.</param> /// <returns>The style</returns> /// ------------------------------------------------------------------------------------ public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure, FunctionValues function, bool isCharStyle, FdoOwningCollection <IStStyle> styleCollection) { return(AddTestStyle(name, context, structure, function, isCharStyle, 0, styleCollection)); }
public override void Exit() { CheckDisposed(); try { if (m_dlg != null) { m_dlg.Dispose(); m_dlg = null; } if (m_vc != null) { m_vc.Dispose(); m_vc = null; } m_hfSets = null; m_pageInfo = null; } finally { base.Exit(); } }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_inMemoryCache.InitializeLexDb(); m_hfSets = Cache.LangProject.LexDbOA.HeaderFooterSetsOC; IPublication pub = CreateFakeHFSets(); m_dlg = new DummyHeaderFooterSetupDlg(Cache, pub, (CmMajorObject)Cache.LangProject.LexDbOA); m_pageInfo = new HFDialogsPageInfo(true); m_vc = new DummyHFSetupDlgVC(m_pageInfo, Cache.DefaultVernWs, DateTime.Now, Cache); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Load all styles from the XML file and create styles in the database for them. /// </summary> /// <param name="progressDlg">The progress dialog.</param> /// <param name="parameters">The parameters. First parameter is the style objects /// (a FdoOwningCollection<IStStyle>), second is the styles (an XmlNode).</param> /// ------------------------------------------------------------------------------------ protected object CreateStyles(IAdvInd4 progressDlg, params object[] parameters) { Debug.Assert(parameters.Length == 2); m_databaseStyles = (FdoOwningCollection<IStStyle>)parameters[0]; m_sourceStyles = (XmlNode)parameters[1]; m_progressDlg = progressDlg; CreateStyles(); return null; }