/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="EmptyScripture"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public EmptyScripture(ITMAdapter adapter, FdoCache fdoCache, IHelpTopicProvider helpTopicProvider) { InitializeComponent(); m_helpTopicProvider = helpTopicProvider; if (adapter == null || adapter.MessageMediator == null) { btnBook.Enabled = false; } else { m_tmAdapter = adapter; // Save the adapter's message mediator so it can be restored when the // dialog closes. m_savMsgMediator = adapter.MessageMediator; // Create a new mediator for this dialog and set // the adapter's mediator to it. Mediator mediator = new Mediator(); mediator.AddColleague(this); m_tmAdapter.MessageMediator = mediator; } string projectName = fdoCache.ProjectId.Name; lblTopLabel.Text = string.Format(lblTopLabel.Text, projectName); }
/// <summary> /// Initialize. /// </summary> /// <param name="mediator"></param> /// <param name="configurationParameters"></param> public void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; m_previousShowTreeBarValue = m_mediator.PropertyTable.GetBoolProperty("ShowRecordList", true); m_mediator.PropertyTable.SetProperty("ShowRecordList", false); m_configurationParameters = configurationParameters; mediator.AddColleague(this); m_mediator.PropertyTable.SetProperty("StatusPanelRecordNumber", ""); m_mediator.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_mediator.PropertyTable.GetStringProperty("currentContentControl", ""); FdoCache cache = Cache; m_mediator.SendMessage("AddContextToHistory", FwLink.Create(toolName, Guid.Empty, cache.ServerName, cache.DatabaseName), false); }
/// <summary> /// Initialize the IxCoreColleague object. /// </summary> public void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; m_mediator.AddColleague(this); }
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); }
public override void FinishInit() { CheckDisposed(); base.FinishInit(); Mediator.AddColleague(this); }
/// <summary> /// /// </summary> /// <param name="smallImages"></param> /// <param name="mediator"></param> /// <returns></returns> public void Init(ImageCollection smallImages, IUIMenuAdapter menuBarAdapter, Mediator mediator) { m_mediator = mediator; mediator.AddColleague(this); m_smallImages = smallImages; m_menuBarAdapter = menuBarAdapter; }
public override void FixtureSetup() { base.FixtureSetup(); FwRegistrySettings.Init(); m_application = new MockFwXApp(new MockFwManager { Cache = Cache }, null, null); var configFilePath = Path.Combine(FwDirectoryFinder.CodeDirectory, m_application.DefaultConfigurationPathname); m_window = new MockFwXWindow(m_application, configFilePath); ((MockFwXWindow)m_window).Init(Cache); // initializes Mediator values m_mediator = m_window.Mediator; m_mediator.AddColleague(new StubContentControlProvider()); m_window.LoadUI(configFilePath); // set up clerk to allow DictionaryPublicationDecorator to be created during the UploadToWebonaryController driven export const string reversalIndexClerk = @"<?xml version='1.0' encoding='UTF-8'?> <root> <clerks> <clerk id='entries'> <recordList owner='LexDb' property='Entries'/> </clerk> </clerks> <tools> <tool label='Dictionary' value='lexiconDictionary' icon='DocumentView'> <control> <dynamicloaderinfo assemblyPath='xWorks.dll' class='SIL.FieldWorks.XWorks.XhtmlDocView'/> <parameters area='lexicon' clerk='entries' layout='Bartholomew' layoutProperty='DictionaryPublicationLayout' editable='false' configureObjectName='Dictionary'/> </control> </tool> </tools> </root>" ; var doc = new XmlDocument(); doc.LoadXml(reversalIndexClerk); XmlNode clerkNode = doc.SelectSingleNode("//tools/tool[@label='Dictionary']//parameters[@area='lexicon']"); m_Clerk = RecordClerkFactory.CreateClerk(m_mediator, clerkNode, false); m_mediator.PropertyTable.SetProperty("ActiveClerk", m_Clerk); m_mediator.PropertyTable.SetProperty("ToolForAreaNamed_lexicon", "lexiconDictionary"); Cache.ProjectId.Path = Path.Combine(FwDirectoryFinder.SourceDirectory, "xWorks/xWorksTests/TestData/"); // setup style sheet and style to allow the css to generate during the UploadToWebonaryController driven export m_styleSheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator); m_owningTable = new StyleInfoTable("AbbySomebody", (IWritingSystemManager)Cache.WritingSystemFactory); var fontInfo = new FontInfo(); var letHeadStyle = new TestStyle(fontInfo, Cache) { Name = CssGenerator.LetterHeadingStyleName, IsParagraphStyle = false }; var dictNormStyle = new TestStyle(fontInfo, Cache) { Name = CssGenerator.DictionaryNormal, IsParagraphStyle = true }; m_styleSheet.Styles.Add(letHeadStyle); m_styleSheet.Styles.Add(dictNormStyle); m_owningTable.Add(CssGenerator.LetterHeadingStyleName, letHeadStyle); m_owningTable.Add(CssGenerator.DictionaryNormal, dictNormStyle); }
/// <summary> /// Initialize the IxCoreColleague object. /// </summary> public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; m_propertyTable = propertyTable; m_mediator.AddColleague(this); }
public void Prioritize() { using (Mediator mediator = new Mediator()) { mediator.AddColleague(new LowColleague()); mediator.AddColleague(new HighColleague()); mediator.AddColleague(new MedColleague()); ArrayList testList = new ArrayList(); ArrayList expectedResult = new ArrayList() { "High", "Medium", "Low" }; mediator.SendMessage("AddTestItem", testList); CollectionAssert.AreEqual(testList, expectedResult, "Mediator message Prioritization is broken."); } }
public void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; mediator.AddColleague(this); mediator.PropertyTable.SetProperty("LinkListener", this); mediator.PropertyTable.SetPropertyPersistence("LinkListener", false); }
/// <summary> /// Initialize the IxCoreColleague object. /// </summary> public virtual void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; mediator.AddColleague(this); m_configurationParameters = configurationParameters; m_persistProvider = new XCore.PersistenceProvider(PersistentLabel, m_mediator.PropertyTable); }
public void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; mediator.AddColleague(this); m_ctotalLists = 0; m_ccustomLists = 0; }
/// <summary> /// Initialize the IxCoreColleague object. /// </summary> public void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; mediator.AddColleague(this); if (m_mediator.PropertyTable != null) { m_persistProvider = new PersistenceProvider(m_ksTryAWord, m_mediator.PropertyTable); } }
/// <summary> /// Initialize. /// </summary> /// <param name="mediator"></param> /// <param name="configurationParameters"></param> public virtual void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; base.m_configurationParameters = configurationParameters; mediator.AddColleague(this); string urlAttr = XmlUtils.GetManditoryAttributeValue(m_configurationParameters, "URL"); m_htmlControl.URL = GetInstallSubDirectory(urlAttr); }
public void Init(Mediator mediator, System.Xml.XmlNode configurationParameters) { CheckDisposed(); _mediator = mediator; Cache = (FdoCache)_mediator.PropertyTable.GetValue("cache"); _mediator.PropertyTable.SetProperty("FLExBridgeListener", this); _mediator.PropertyTable.SetPropertyPersistence("FLExBridgeListener", false); _parentForm = (Form)_mediator.PropertyTable.GetValue("window"); mediator.AddColleague(this); }
/// <summary></summary> public void Init(Mediator mediator, XmlNode configurationParameters) { m_mediator = mediator; mediator.AddColleague(this); areasLabel = m_mediator.StringTbl.LocalizeAttributeValue("Areas"); m_sidepane = new SidePane(MyControl, SidePaneItemAreaStyle.List); m_sidepane.ItemClicked += SidePaneItemClickedHandler; m_sidepane.TabClicked += SidePaneTabClickedHandler; }
public void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; m_cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache"); mediator.AddColleague(this); m_sda = m_cache.MainCacheAccessor; m_sda.AddNotification(this); }
public bool Join(Mediator medi) // mediator에 해당 colleague 정보를 알려줌 { if (medi == null) { return(false); } Debug.Log("Join:" + this); this.mediator = medi; return(mediator.AddColleague(this)); }
public void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; mediator.AddColleague(this); FdoCache cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache"); //don't know just what good having this default is, but it's at least safer mediator.PropertyTable.SetProperty("WritingSystemHvo", cache.LangProject.DefaultAnalysisWritingSystem.ToString()); mediator.PropertyTable.SetPropertyPersistence("WritingSystemHvo", false); }
/// <summary> /// Initialize. /// </summary> /// <param name="mediator"></param> /// <param name="propertyTable"></param> /// <param name="configurationParameters"></param> public virtual void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; m_propertyTable = propertyTable; m_configurationParameters = configurationParameters; mediator.AddColleague(this); string urlAttr = XmlUtils.GetMandatoryAttributeValue(m_configurationParameters, "URL"); var uri = new Uri(GetInstallSubDirectory(urlAttr)); m_htmlControl.URL = uri.AbsoluteUri; }
public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; m_propertyTable = propertyTable; m_mediator.AddColleague(this); LcmCache cache = m_propertyTable.GetValue <LcmCache>("cache"); //don't know just what good having this default is, but it's at least safer m_propertyTable.SetProperty("WritingSystemHvo", cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle.ToString(), true); m_propertyTable.SetPropertyPersistence("WritingSystemHvo", false); }
/// <summary></summary> public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters) { m_mediator = mediator; m_propertyTable = propertyTable; areasLabel = StringTable.Table.LocalizeAttributeValue("Areas"); m_sidepane = new SidePane(MyControl, SidePaneItemAreaStyle.List); m_sidepane.AccessibilityObject.Name = "sidepane"; //m_sidepane.GetType().Name; m_sidepane.ItemClicked += SidePaneItemClickedHandler; m_sidepane.TabClicked += SidePaneTabClickedHandler; mediator.AddColleague(this); }
/// <summary> /// Initialize this as an IxCoreColleague /// </summary> /// <remarks> subclasses must call this from their Init. /// This was done, rather than providing an Init() here in the normal way, /// to drive home the point that the subclass must set m_fullyInitialized /// to true when it is fully initialized.</remarks> /// <param name="mediator"></param> /// <param name="configurationParameters"></param> protected void InitBase(Mediator mediator, XmlNode configurationParameters) { Debug.Assert(m_fullyInitialized == false, "No way we are fully initialized yet!"); m_mediator = mediator; base.m_configurationParameters = configurationParameters; ReadParameters(); m_mediator.AddColleague(this); m_mediator.PropertyTable.SetProperty("ShowRecordList", false); SetupDataContext(); ShowRecord(); }
public override void FixtureSetup() { base.FixtureSetup(); Cache.ProjectId.Path = Path.Combine(Path.GetTempPath(), Cache.ProjectId.Name, Cache.ProjectId.Name + @".junk"); FwRegistrySettings.Init(); m_application = new MockFwXApp(new MockFwManager { Cache = Cache }, null, null); m_configFilePath = Path.Combine(FwDirectoryFinder.CodeDirectory, m_application.DefaultConfigurationPathname); m_window = new MockFwXWindow(m_application, m_configFilePath); m_window.Init(Cache); // initializes Mediator values m_mediator = m_window.Mediator; m_mediator.AddColleague(new StubContentControlProvider()); m_window.LoadUI(m_configFilePath); // actually loads UI here; needed for non-null stylesheet LayoutCache.InitializePartInventories(Cache.ProjectId.Name, m_application, Cache.ProjectId.Path); }
/// <summary> /// Initialize this as an IxCoreColleague /// </summary> /// <remarks> subclasses must call this from their Init. /// This was done, rather than providing an Init() here in the normal way, /// to drive home the point that the subclass must set m_fullyInitialized /// to true when it is fully initialized.</remarks> /// <param name="mediator"></param> /// <param name="configurationParameters"></param> protected void InitBase(Mediator mediator, XmlNode configurationParameters) { Debug.Assert(m_fullyInitialized == false, "No way we are fully initialized yet!"); m_mediator = mediator; m_configurationParameters = configurationParameters; ReadParameters(); RecordClerk clerk = ExistingClerk; if (clerk == null) { // NOTE: new clerks do not typically complete ReloadList() // until Clerk.ActivateUI() is set (eg. here in SetupDataContext()). // however, we should further delay loading the list // if the subclass is initializing sorters/filters. // so we use ListUpdateHelper below to delay reloading the list. clerk = Clerk; Debug.Assert(clerk != null); } // suspend any loading of the Clerk's list items until after a // subclass (possibly) initializes sorters/filters // in SetupDataContext() using (RecordClerk.ListUpdateHelper luh = new RecordClerk.ListUpdateHelper(clerk)) { luh.ClearBrowseListUntilReload = true; clerk.UpdateOwningObjectIfNeeded(); SetTreebarAvailability(); AddPaneBar(); // NB: It is critical that we get added *after* our RecordClerk, // so that it will get messages, for example about a change of cache, before we do. mediator.AddColleague(this); SetupDataContext(); } // In case it hasn't yet been loaded, load it! See LT-10185. if (!Clerk.ListLoadingSuppressed && Clerk.RequestedLoadWhileSuppressed) { Clerk.UpdateList(true, true); } ShowRecord(); }
public Window() { InitializeComponent(); m_mainPaneText = new Label(); m_mainPaneText.Text = "No item was yet clicked."; m_mainPaneText.Dock = DockStyle.Right; string[] iconLabels = { "iconName" }; var imagelist = new ImageList(); var itemIcon = new Bitmap(32, 32); for (int x = 0; x < itemIcon.Width; ++x) { for (int y = 0; y < itemIcon.Height; ++y) { itemIcon.SetPixel(x, y, Color.Blue); } } imagelist.Images.Add(itemIcon); m_smallImages.AddList(imagelist, iconLabels); m_largeImages.AddList(imagelist, iconLabels); m_mediator = new Mediator(); m_mediator.StringTbl = new SIL.Utils.StringTable("../../DistFiles/Language Explorer/Configuration"); m_sidebarAdapter = new SidebarAdapter(); m_sidebar = m_sidebarAdapter.Init(this, m_smallImages, m_largeImages, m_mediator); m_sidebarChoiceGroupCollection = new MyChoiceGroupCollection(m_mediator, m_sidebarAdapter, null); m_sidebarChoiceGroupCollection.Init(); this.Controls.Add(m_sidebar); this.Controls.Add(m_mainPaneText); m_sidebarAdapter.FinishInit(); ((IUIAdapter)m_sidebarAdapter).OnIdle(); m_mediator.SendMessage("Idle", null); m_mediator.AddColleague(new MyCoreColleague(m_mainPaneText)); }
internal void LoadList(SplitterPanel parent, ICmObject mainObject) { parent.FindForm().UseWaitCursor = true; parent.SuspendLayout(); m_mediator.RemoveColleague(this); if (m_currentControl != null) { m_currentControl.SuspendLayout(); m_currentControl.Parent.Controls.Remove(m_currentControl); m_currentControl.Dispose(); m_currentControl = null; } // Add the new browse view, if available in the config node. if (m_configurationNode.HasChildNodes) { XmlNode parms = m_configurationNode.SelectSingleNode("parameters"); if (mainObject != null) { RecordClerk clerk = (RecordClerk)m_mediator.PropertyTable.GetValue("RecordClerk-" + parms.Attributes["clerk"].Value); if (clerk == null) { clerk = RecordClerkFactory.CreateClerk(m_mediator, parms); } clerk.OwningObject = mainObject; } RecordBrowseView browseView = new RecordBrowseView(); browseView.SuspendLayout(); browseView.Dock = DockStyle.Fill; m_currentControl = browseView; parent.Controls.Add(browseView); browseView.Init(m_mediator, parms); m_mediator.RemoveColleague(browseView); browseView.BringToFront(); browseView.ResumeLayout(); m_mediator.AddColleague(this); } parent.ResumeLayout(); parent.FindForm().UseWaitCursor = false; }
public void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; mediator.AddColleague(this); mediator.PropertyTable.SetProperty("ContextHelper", this, false); mediator.PropertyTable.SetPropertyPersistence("ContextHelper", false); this.ParentControl = (Control)m_mediator.PropertyTable.GetValue("window"); m_document = new XmlDocument(); //we use the directory of the file which held are parameters as the starting point //of the path we were given. string path = XmlUtils.GetManditoryAttributeValue(configurationParameters, "contextHelpPath"); path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(configurationParameters.BaseURI), path); m_document.Load(path); //m_items = m_document.SelectNodes("strings/item"); ShowAlways = m_mediator.PropertyTable.GetBoolProperty("ShowBalloonHelp", true); }
public Colleague(Mediator mediator) { _mediator = mediator; _mediator.AddColleague(this); }
/// <summary> /// Initialize this as an IxCoreColleague /// </summary> /// <remarks> subclasses must call this from their Init. /// This was done, rather than providing an Init() here in the normal way, /// to drive home the point that the subclass must set m_fullyInitialized /// to true when it is fully initialized.</remarks> /// <param name="mediator"></param> /// <param name="propertyTable"></param> /// <param name="configurationParameters"></param> protected void InitBase(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters) { Debug.Assert(m_fullyInitialized == false, "No way we are fully initialized yet!"); m_mediator = mediator; m_propertyTable = propertyTable; m_configurationParameters = configurationParameters; ReadParameters(); RecordClerk clerk = ExistingClerk; bool fClerkAlreadySuppressed = false; bool fClerkWasCreated = false; if (clerk == null) { // We do NOT want to load the list as part of creating the clerk. // At earliest, we want to do so only when the ListUpdateHelper is disposed, // after the clerk and list are sufficiently initialized (e.g., with saved sorting and filtering // information) to sort correctly. This is part of a fairly convoluted attempt to prevent // sorting the list repeatedly during startup, even though startup involves many events // that normally require it to be resorted. // In this case the clerk will be created with its list already in the ListLoadingSuppressed state, // and already set to indicate that loading is necessary when suppression ends; // we want to pass FALSE to the ListUpdateHelper constructor, however, to pretend that the // list was NOT suppressed when the helper was created, so it will duly be sorted when // the helper is disposed. fClerkWasCreated = true; clerk = CreateClerk(false); Debug.Assert(clerk != null); } else { fClerkAlreadySuppressed = clerk.ListLoadingSuppressed; // If we didn't create the clerk, someone else might have suppressed it. } // suspend any loading of the Clerk's list items until after a // subclass (possibly) initializes sorters/filters // in SetupDataContext() bool didRestoreFromPersistence = false; using (var luh = new RecordClerk.ListUpdateHelper(clerk, fClerkAlreadySuppressed)) { luh.ClearBrowseListUntilReload = true; clerk.UpdateOwningObjectIfNeeded(); SetTreebarAvailability(); AddPaneBar(); //Historical comments here indicated that the Clerk should be processed by the mediator before the //view. This is handled by Priority now, RecordView is by default just after RecordClerk in the processing. mediator.AddColleague(this); SetupDataContext(); // Only if it was just now created should we try to restore from what we persisted. // Otherwise (e.g., FWR-1128) we may miss changes made to the list in other tools. if (fClerkWasCreated) { didRestoreFromPersistence = RestoreSortSequence(); } if (didRestoreFromPersistence) { luh.ListWasRestored(); } } // In case it hasn't yet been loaded, load it! See LT-10185. if (!didRestoreFromPersistence && !Clerk.ListLoadingSuppressed && Clerk.RequestedLoadWhileSuppressed) { Clerk.UpdateList(true, true); // sluggishness culprit for LT-12844 was in here } Clerk.SetCurrentFromRelatedClerk(); // See if some other clerk wants to influence our current object. ShowRecord(); }