public Initialize ( FdoCache cache, bool fHasSplitter, Inventory layouts, Inventory parts ) : void | ||
cache | FdoCache | The cache. |
fHasSplitter | bool | if set to |
layouts | Inventory | The layouts. |
parts | Inventory | The parts. |
Результат | void |
/// <summary>Helper</summary> private static Slice GenerateSlice(FdoCache cache, DataTree datatree) { var slice = new Slice(); var parts = DataTreeTests.GenerateParts(); var layouts = DataTreeTests.GenerateLayouts(); datatree.Initialize(cache, false, layouts, parts); slice.Parent = datatree; return slice; }
public void OwnedObjects() { m_dtree.Initialize(Cache, false, m_layouts, m_parts); m_dtree.ShowObject(m_entry, "OptSensesEty", null, m_entry, false); // With no etymology or senses, this view contains nothing at all. Assert.AreEqual(0, m_dtree.Controls.Count); m_parent.Close(); m_parent.Dispose(); m_parent = null; ILexSense sense1 = Cache.ServiceLocator.GetInstance<ILexSenseFactory>().Create(); m_entry.SensesOS.Add(sense1); ILexSense sense2 = Cache.ServiceLocator.GetInstance<ILexSenseFactory>().Create(); m_entry.SensesOS.Add(sense2); Cache.MainCacheAccessor.SetString(sense2.Hvo, LexSenseTags.kflidScientificName, TsStringUtils.MakeTss("blah blah", Cache.DefaultAnalWs)); m_parent = new Form(); m_dtree = new DataTree(); m_parent.Controls.Add(m_dtree); m_dtree.Initialize(Cache, false, m_layouts, m_parts); m_dtree.ShowObject(m_entry, "OptSensesEty", null, m_entry, false); // With two senses, we get a header slice, a gloss slice for // sense 1 (not optional), and both gloss and Scientific name // slices for sense 2. Assert.AreEqual(3, m_dtree.Controls.Count); //Assert.AreEqual("Senses", (m_dtree.Controls[0] as Slice).Label); Assert.AreEqual("Gloss", (m_dtree.Controls[0] as Slice).Label); Assert.AreEqual("Gloss", (m_dtree.Controls[1] as Slice).Label); Assert.AreEqual("ScientificName", (m_dtree.Controls[2] as Slice).Label); m_parent.Close(); m_parent.Dispose(); m_parent = null; ILexEtymology lm = Cache.ServiceLocator.GetInstance<ILexEtymologyFactory>().Create(); m_entry.EtymologyOA = lm; m_parent = new Form(); m_dtree = new DataTree(); m_parent.Controls.Add(m_dtree); m_dtree.Initialize(Cache, false, m_layouts, m_parts); m_dtree.ShowObject(m_entry, "OptSensesEty", null, m_entry, false); // Adding an etymology gets us just no more slices so far, // because it doesn't have a form or source Assert.AreEqual(3, m_dtree.Controls.Count); //Assert.AreEqual("Etymology", (m_dtree.Controls[3] as Slice).Label); m_parent.Close(); m_parent.Dispose(); m_parent = null; lm.Source = "source"; // Again set both because I'm not sure which it really // should be. lm.Form.VernacularDefaultWritingSystem = TsStringUtils.MakeTss("rubbish", Cache.DefaultVernWs); lm.Form.AnalysisDefaultWritingSystem = TsStringUtils.MakeTss("rubbish", Cache.DefaultAnalWs); m_parent = new Form(); m_dtree = new DataTree(); m_parent.Controls.Add(m_dtree); m_dtree.Initialize(Cache, false, m_layouts, m_parts); m_dtree.ShowObject(m_entry, "OptSensesEty", null, m_entry, false); // When the etymology has something we get two more. Assert.AreEqual(5, m_dtree.Controls.Count); Assert.AreEqual("Form", (m_dtree.Controls[3] as Slice).Label); Assert.AreEqual("Source", (m_dtree.Controls[4] as Slice).Label); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create the client windows and add correspnding stuff to the sidebar, View menu, /// etc. Subclasses must override this. /// </summary> /// ------------------------------------------------------------------------------------ public void InitAndShowClient() { CheckDisposed(); m_dataEntryForm = new DataTree(); SuspendLayout(); string partDirectory = Path.Combine(SIL.FieldWorks.Common.Utils.DirectoryFinder.FWCodeDirectory, @"Language Explorer\Configuration\Parts"); Dictionary<string, string[]> keyAttrs = new Dictionary<string, string[]>(); keyAttrs["layout"] = new string[] {"class", "type", "mode", "name" }; keyAttrs["group"] = new string[] {"label"}; keyAttrs["part"] = new string[] {"ref"}; Inventory layouts = new Inventory(new string[] {partDirectory}, "*Parts.xml", "/layoutInventory/*", keyAttrs); keyAttrs = new Dictionary<string, string[]>(); keyAttrs["part"] = new string[] {"id", "type", "mode"}; Inventory parts = new Inventory(new string[] {partDirectory}, "*Layouts.xml", "/PartInventory/*", keyAttrs); m_dataEntryForm.Initialize(m_cache, true, layouts, parts); m_dataEntryForm.Dock = System.Windows.Forms.DockStyle.Fill; Controls.Add(m_dataEntryForm); ResumeLayout(false); }