Пример #1
0
		/// <summary>
		/// Initialize this has an IxCoreColleague
		/// </summary>
		/// <param name="mediator"></param>
		/// <param name="configurationParameters"></param>
		public void Init(Mediator mediator, XmlNode configurationParameters)
		{
			CheckDisposed();

			m_mediator = mediator;
			mediator.AddColleague(this);
		}
Пример #2
0
        public virtual void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            m_mediator = mediator;
            m_configurationParameters = configurationParameters;
            m_mediator.AddColleague(this);
        }
Пример #3
0
		public void Init(Mediator mediator, 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);
		}
Пример #4
0
		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);
		}
Пример #5
0
        public virtual void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            m_mediator = mediator;
            m_configurationParameters = configurationParameters;
            m_mediator.AddColleague(this);
            m_cache         = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
            m_wordformRepos = m_cache.ServiceLocator.GetInstance <IWfiWordformRepository>();
            m_cache.DomainDataByFlid.AddNotification(this);
            if (IsVernacularSpellingEnabled())
            {
                OnEnableVernacularSpelling();
            }
        }
Пример #6
0
		public void Init(Mediator mediator, XmlNode configurationParameters)
		{
			CheckDisposed();
			this.mediator = mediator; //allows the Cache property to function

			string name = XmlUtils.GetAttributeValue(configurationParameters, "clerk");
			var clerk = RecordClerk.FindClerk(mediator, name);
			m_clerk = (clerk == null || clerk is TemporaryRecordClerk) ?
				(InterlinearTextsRecordClerk)RecordClerkFactory.CreateClerk(mediator, 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 = mediator.PropertyTable.GetStringProperty("currentContentControl", "");
			mediator.SendMessage("AddContextToHistory", new FwLinkArgs(toolName, Guid.Empty), false);
		}
Пример #7
0
		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));
		}
Пример #8
0
		/// <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();
		}
Пример #9
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);
		}
Пример #10
0
        public void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            m_mediator = mediator;
            mediator.AddColleague(this);
            mediator.PropertyTable.SetProperty("LinkListener", this);
            mediator.PropertyTable.SetPropertyPersistence("LinkListener", false);
        }
Пример #11
0
		/// <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();
		}
Пример #12
0
		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);
		}
Пример #13
0
		public virtual void Init(Mediator mediator, XmlNode configurationParameters)
		{
			CheckDisposed();

			m_mediator = mediator;
			m_configurationParameters = configurationParameters;
			m_mediator.AddColleague(this);

			var cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
			cache.DomainDataByFlid.BeginNonUndoableTask();
			var usedWses = new List<IWritingSystem>();
			foreach (IReversalIndex rev in cache.LanguageProject.LexDbOA.ReversalIndexesOC)
			{
				var ws = cache.ServiceLocator.WritingSystemManager.get_Engine(rev.WritingSystem);
				usedWses.Add((IWritingSystem)ws);
				if (rev.PartsOfSpeechOA == null)
					rev.PartsOfSpeechOA = cache.ServiceLocator.GetInstance<ICmPossibilityListFactory>().Create();
				rev.PartsOfSpeechOA.ItemClsid = PartOfSpeechTags.kClassId;
			}
			List<IReversalIndex> corruptReversalIndices = new List<IReversalIndex>();
			foreach (IReversalIndex rev in cache.LanguageProject.LexDbOA.ReversalIndexesOC)
			{
				// Make sure each index has a name, if it is available from the writing system.
				if (string.IsNullOrEmpty(rev.WritingSystem))
				{
					// Delete a bogus IReversalIndex that has no writing system.
					// But, for now only store them for later deletion,
					// as immediate removal will wreck the looping.
					corruptReversalIndices.Add(rev);
					continue;
				}
				IWritingSystem revWs = cache.ServiceLocator.WritingSystemManager.Get(rev.WritingSystem);
				// TODO WS: is DisplayLabel the right thing to use here?
				rev.Name.SetAnalysisDefaultWritingSystem(revWs.DisplayLabel);
			}
			// Delete any corrupt reversal indices.
			foreach (IReversalIndex rev in corruptReversalIndices)
			{
				MessageBox.Show("Need to delete a corrupt reversal index (no writing system)", "Self-correction");
				cache.LangProject.LexDbOA.ReversalIndexesOC.Remove(rev);	// does this accomplish anything?
			}

			// Set up for the reversal index combo box or dropdown menu.
			Guid firstGuid = Guid.Empty;
			List<IReversalIndex> reversalIds = cache.LanguageProject.LexDbOA.CurrentReversalIndices;
			if (reversalIds.Count > 0)
				firstGuid = reversalIds[0].Guid;
			else if (cache.LanguageProject.LexDbOA.ReversalIndexesOC.Count > 0)
				firstGuid = cache.LanguageProject.LexDbOA.ReversalIndexesOC.ToGuidArray()[0];
			if (firstGuid != Guid.Empty)
			{
				SetReversalIndexGuid(firstGuid);
			}
			cache.DomainDataByFlid.EndNonUndoableTask();
		}
Пример #14
0
		/// <summary>
		/// Initialize this has an IxCoreColleague
		/// </summary>
		/// <param name="mediator"></param>
		/// <param name="configurationParameters"></param>
		public void Init(Mediator mediator, XmlNode configurationParameters)
		{
			CheckDisposed();

			this.SuspendLayout();
			this.IsInitializing = true;

			m_configurationParameters = configurationParameters;
			m_mediator = mediator;

			m_fDontCollapseFillPane = XmlUtils.GetOptionalBooleanAttributeValue(
				m_configurationParameters, "dontCollapseFillPane", false);

			XmlNodeList nodes = configurationParameters.SelectNodes("control");
			if (nodes.Count != 2)
				throw new ConfigurationException(
					"Was expecting 2 controls to be defined in the parameters of the Multipane.",
					configurationParameters);

			string id = XmlUtils.GetAttributeValue(configurationParameters, "id", "");
			m_propertyControllingVisibilityOfFirstPane = GetPropertyControllingVisibilityOfFirstPane(nodes[0]);
			if (m_propertyControllingVisibilityOfFirstPane == null)
			{
				m_showingFirstPane = false;
			}
			else
			{
				m_showingFirstPane = true; // default
				// NOTE: we don't actually want to create and persist this property if it's not already loaded.
				object propertyValue;
				if (mediator.PropertyTable.PropertyExists(m_propertyControllingVisibilityOfFirstPane, out propertyValue, PropertyTable.SettingsGroup.LocalSettings))
				{
					m_showingFirstPane = (bool)propertyValue;
				}
			}

			SplitterWidth = 5;
			if (id != "") //must have an id if we're going to persist the value of the splitter
				this.Name = id;//for debugging
			FirstLabel = XmlUtils.GetOptionalAttributeValue(configurationParameters, "firstLabel", "");
			SecondLabel = XmlUtils.GetOptionalAttributeValue(configurationParameters, "secondLabel", "");
			SetFirstCollapseZone(nodes[0]);
			SetSecondCollapseZone(nodes[1]);

			string orientation = XmlUtils.GetOptionalAttributeValue(configurationParameters, "splitterBarOrientation", "vertical");
			if (orientation.ToLowerInvariant() == "horizontal" && Orientation != Orientation.Horizontal)
				Orientation = Orientation.Horizontal;
			else if (Orientation != Orientation.Vertical)
				Orientation = Orientation.Vertical;

			m_prioritySecond = XmlUtils.GetOptionalBooleanAttributeValue(configurationParameters,
				"prioritySecond", false);
			string defaultPrintPaneId = XmlUtils.GetOptionalAttributeValue(configurationParameters,
				"defaultPrintPane", "");
			string defaultFocusControl = XmlUtils.GetOptionalAttributeValue(configurationParameters,
				"defaultFocusControl", "");
			// If we are a subcontrol of a MultiPane, our DefaultPrintPane property may already be set.
			// we don't want to change it, unless it's not an empty string.
			if (!String.IsNullOrEmpty(defaultPrintPaneId))
				m_defaultPrintPaneId = defaultPrintPaneId;
			if (!String.IsNullOrEmpty(defaultFocusControl))
				m_defaultFocusControl = defaultFocusControl;
			Control first = MakeSubControl(nodes[0], Size);
			first.AccessibleName += ".First";
			FirstControl = first;
			Panel1Collapsed = !m_showingFirstPane;
			Control second = MakeSubControl(nodes[1], Size);
			second.AccessibleName += ".Second";
			SecondControl = second;

			//if (m_fDontCollapseFillPane)
			//{
			//    // As of this writing (6 Feb 2007) only two tools (Texts:Edit & Texts:Document)
			//    // used this m_fDontCollapseFillPane feature.
			//    // They had the same fixed size on that date, so no prior layout was needed to get the size.
			//    // We can, then, safely set the Panel2MinSize right now to that known size.
			//    // At some point in the future, some tool may use the 'dontCollapseFillPane'
			//    // to surpress shrinking to the icon,
			//    // which does not know its minimum size before a layout.
			//    // When that happens, we will need to revisit setting it here.
			//    if (Panel2MinSize < 100)
			//        Panel2MinSize = 100;
			//}

			// Need to focus proper child control.
			if (!TrySetFocusInControl(first, m_defaultFocusControl))
				TrySetFocusInControl(second, m_defaultFocusControl);

			if (Parent != null)
			{
				// Set default width of Panel1, since it wasn't done when the parent was set.
				// This happens when the XWindow is in charge of this MultiPane,
				// when loading either of the Text tools (as of 6 Feb 2007).
				SetSplitterDistance();
			}

			this.IsInitializing = false;
			this.ResumeLayout();

			//it's important to do this last, so that we don't go generating property change
			//notifications that we then go trying to cope with before we are ready
			mediator.AddColleague(this);
			m_fOkToPersistSplit = true;
		}
Пример #15
0
        /// <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.AccessibilityObject.Name = "sidepane";
                //m_sidepane.GetType().Name;
            m_sidepane.ItemClicked += SidePaneItemClickedHandler;
            m_sidepane.TabClicked += SidePaneTabClickedHandler;
        }
Пример #16
0
        /// <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);
        }
Пример #17
0
        public virtual void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            m_mediator = mediator;
            m_configurationParameters = configurationParameters;
            m_mediator.AddColleague(this);

            FdoCache cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
            List <ILgWritingSystem> usedWses = new List <ILgWritingSystem>();

            using (new SuppressSubTasks(cache))
            {
                foreach (IReversalIndex rev in cache.LangProject.LexDbOA.ReversalIndexesOC)
                {
                    // This benign looking check of the count appears to do nothing,
                    // but it is very important as it ensures the vector is cached. Without it,
                    // crashes turn up in bulk deletion, as no PropChanged is sent,
                    // as the vector is not in the cache.
                    int entryCount = 0;
                    entryCount = rev.EntriesOC.Count;
                    usedWses.Add(rev.WritingSystemRA);
                    if (rev.PartsOfSpeechOA == null)
                    {
                        (rev as ReversalIndex).InitNewInternal();
                    }
                    if (rev.PartsOfSpeechOA.ItemClsid != PartOfSpeech.kClassId)
                    {
                        rev.PartsOfSpeechOA.ItemClsid = PartOfSpeech.kClassId;
                    }
                }
                List <IReversalIndex> corruptReversalIndices = new List <IReversalIndex>();
                foreach (IReversalIndex rev in cache.LangProject.LexDbOA.ReversalIndexesOC)
                {
                    // Make sure each index has a name, if it is available from the writing system.
                    if (rev.WritingSystemRA == null)
                    {
                        // Delete a bogus ReversalIndex that has no writing system.
                        // But, for now only store them for later deletion,
                        // as immediate removal will wreck the looping.
                        corruptReversalIndices.Add(rev);
                        continue;
                    }
                    ILgWritingSystem revWs = rev.WritingSystemRA;
                    string           sql   = string.Format("SELECT Ws, Txt FROM LgWritingSystem_Name WHERE Obj = {0}", revWs.Hvo);
                    IOleDbCommand    odc   = DbOps.MakeRowSet(cache, sql, null);
                    try
                    {
                        bool fMoreRows;
                        odc.NextRow(out fMoreRows);
                        while (fMoreRows)
                        {
                            int    wsHvo   = DbOps.ReadInt(odc, 0);
                            string nameWs  = DbOps.ReadString(odc, 1);
                            string nameRev = rev.Name.GetAlternative(wsHvo);
                            if ((nameRev == null || nameRev == String.Empty) &&
                                (nameWs != null && nameWs.Length > 0))
                            {
                                rev.Name.SetAlternative(nameWs, wsHvo);
                            }
                            odc.NextRow(out fMoreRows);
                        }
                    }
                    finally
                    {
                        DbOps.ShutdownODC(ref odc);
                    }
                }
                // Delete any corrupt reversal indices.
                foreach (IReversalIndex rev in corruptReversalIndices)
                {
                    rev.DeleteUnderlyingObject();
                }
            }
            // Set up for the reversal index combo box or dropdown menu.
            int        firstId     = 0;
            List <int> reversalIds = cache.LangProject.LexDbOA.CurrentReversalIndices;

            if (reversalIds.Count > 0)
            {
                firstId = reversalIds[0];
            }
            else if (cache.LangProject.LexDbOA.ReversalIndexesOC.Count > 0)
            {
                firstId = cache.LangProject.LexDbOA.ReversalIndexesOC.HvoArray[0];
            }
            if (firstId > 0)
            {
                SetReversalIndexHvo(firstId);
            }
        }
Пример #18
0
		/// <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);

		}
Пример #19
0
		/// <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;
			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();
		}
Пример #20
0
		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);

		}
Пример #21
0
        /// <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", new FwLinkArgs(toolName, Guid.Empty), false);
        }
Пример #22
0
		/// ------------------------------------------------------------------------------------
		/// <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);
		}
Пример #23
0
		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.");
			}
		}
Пример #24
0
		/// <summary>
		///
		/// </summary>
		/// <param name="smallImages"></param>
		/// <param name="mediator"></param>
		/// <returns></returns>
		public void  Init (IImageCollection smallImages, IUIMenuAdapter menuBarAdapter, Mediator mediator)
		{
			m_mediator = mediator;
			mediator.AddColleague(this);
			m_smallImages = smallImages;
			m_menuBarAdapter = menuBarAdapter;
		}
Пример #25
0
		public virtual void Init(Mediator mediator, XmlNode configurationParameters)
		{
			CheckDisposed();

			m_mediator = mediator;
			m_configurationParameters = configurationParameters;
			m_mediator.AddColleague(this);
			m_cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
			m_wordformRepos = m_cache.ServiceLocator.GetInstance<IWfiWordformRepository>();
			m_cache.DomainDataByFlid.AddNotification(this);
			if (IsVernacularSpellingEnabled())
				OnEnableVernacularSpelling();
		}
Пример #26
0
		public void Init(Mediator mediator, XmlNode configurationParameters)
		{
			CheckDisposed();

			this.SuspendLayout();
			Panel1.SuspendLayout();
			Panel2.SuspendLayout();
			this.IsInitializing = true;

			m_configurationParameters = configurationParameters;
			m_mediator = mediator;
			var toolNode = configurationParameters.SelectSingleNode("ancestor::tool");
			toolName = toolNode == null ? "" : toolNode.Attributes["value"].Value;
//			m_fDontCollapseFillPane = XmlUtils.GetOptionalBooleanAttributeValue(
//				m_configurationParameters, "dontCollapseFillPane", false);

			XmlNodeList nodes = configurationParameters.SelectNodes("control");
			if (nodes.Count != 2)
				throw new ConfigurationException(
					"Was expecting 2 controls to be defined in the parameters of the Multipane.",
					configurationParameters);

			string id = XmlUtils.GetAttributeValue(configurationParameters, "id", "");
			m_propertyControllingVisibilityOfFirstPane = GetPropertyControllingVisibilityOfFirstPane(nodes[0]);
			if (m_propertyControllingVisibilityOfFirstPane == null)
			{
				m_showingFirstPane = false;
			}
			else
			{
				m_showingFirstPane = true; // default
				// NOTE: we don't actually want to create and persist this property if it's not already loaded.
				object propertyValue;
				if (mediator.PropertyTable.PropertyExists(m_propertyControllingVisibilityOfFirstPane, out propertyValue, PropertyTable.SettingsGroup.LocalSettings))
				{
					m_showingFirstPane = (bool)propertyValue;
				}
			}

			SplitterWidth = 5;
			if (id != "") //must have an id if we're going to persist the value of the splitter
				this.Name = id;//for debugging
			FirstLabel = XmlUtils.GetOptionalAttributeValue(configurationParameters, "firstLabel", "");
			SecondLabel = XmlUtils.GetOptionalAttributeValue(configurationParameters, "secondLabel", "");
			SetFirstCollapseZone(nodes[0]);
			SetSecondCollapseZone(nodes[1]);

			string orientation = XmlUtils.GetOptionalAttributeValue(configurationParameters, "splitterBarOrientation", "vertical");
			if (orientation.ToLowerInvariant() == "horizontal" && Orientation != Orientation.Horizontal)
				Orientation = Orientation.Horizontal;
			else if (Orientation != Orientation.Vertical)
				Orientation = Orientation.Vertical;

			m_prioritySecond = XmlUtils.GetOptionalBooleanAttributeValue(configurationParameters,
				"prioritySecond", false);
			string defaultPrintPaneId = XmlUtils.GetOptionalAttributeValue(configurationParameters,
				"defaultPrintPane", "");
			string defaultFocusControl = XmlUtils.GetOptionalAttributeValue(configurationParameters,
				"defaultFocusControl", "");
			// If we are a subcontrol of a MultiPane, our DefaultPrintPane property may already be set.
			// we don't want to change it, unless it's not an empty string.
			if (!String.IsNullOrEmpty(defaultPrintPaneId))
				m_defaultPrintPaneId = defaultPrintPaneId;
			if (!String.IsNullOrEmpty(defaultFocusControl))
				m_defaultFocusControl = defaultFocusControl;
			MakeSubControl(nodes[0], Size, true);
			Panel1Collapsed = !m_showingFirstPane;
			MakeSubControl(nodes[1], Size, false);

			// Attempt to focus the default child control if there is one configured
			// TODO: Things are not yet in a suitable state, hooking onto a later event should work
			// TODO: But if you switch between tools in an area there is sometimes an extra
			// TODO: WM_LBUTTON_DOWN event which steals focus back into the ListViewItemArea
			SetFocusInDefaultControl();

			IsInitializing = false;
			Panel2.ResumeLayout(false);
			Panel1.ResumeLayout(false);
			ResumeLayout(false);

			//it's important to do this last, so that we don't go generating property change
			//notifications that we then go trying to cope with before we are ready
			mediator.AddColleague(this);
			m_fOkToPersistSplit = true;
		}
Пример #27
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="DiffDialog"/> class.
		/// </summary>
		/// <param name="bookMerger"></param>
		/// <param name="cache"></param>
		/// <param name="stylesheet"></param>
		/// <param name="zoomFactorDraft">The zoom percentage to be used for the "draft" (i.e.,
		/// main Scripture) view</param>
		/// <param name="zoomFactorFootnote">The zoom percentage to be used for the "footnote"
		/// view</param>
		/// <param name="fDoCollapseUndo">true if we want to collapse to a single Undo item on close.</param>
		/// -----------------------------------------------------------------------------------
		public DiffDialog(BookMerger bookMerger, FdoCache cache, IVwStylesheet stylesheet,
			float zoomFactorDraft, float zoomFactorFootnote,
			bool fDoCollapseUndo)
		{
			Debug.Assert(cache != null);
			m_viewHelper = new ActiveViewHelper(this);
			m_fDoCollapseUndo = fDoCollapseUndo;

			// Required for Windows Form Designer support
			InitializeComponent();

			// just as fallback in case the Designer replaced FwContainer with Container
			// in InitializeComponent()...
			if (!(components is FwContainer))
				components = new FwContainer(components);

			// the last column of the table layout manager in the last row should have the
			// width of the scroll bar
			TableLayoutPanel tablePanel = tableLayoutPanel.GetControlFromPosition(0, 3)
				as TableLayoutPanel;
			tablePanel.ColumnStyles[3].Width = SystemInformation.VerticalScrollBarWidth -
				SystemInformation.FixedFrameBorderSize.Width;
			tablePanel = tableLayoutPanel.GetControlFromPosition(1, 3)
							as TableLayoutPanel;
			tablePanel.ColumnStyles[3].Width = SystemInformation.VerticalScrollBarWidth -
				SystemInformation.FixedFrameBorderSize.Width;

			m_msgMediator = new Mediator();
			m_msgMediator.AddColleague(this);
			components.Add(m_msgMediator);

			m_bookMerger = bookMerger;
			m_differences = bookMerger.Differences;
			m_cache = cache;
			m_scr = m_cache.LangProject.TranslatedScriptureOA;
			m_stylesheet = stylesheet;
			m_zoomFactorDraft = zoomFactorDraft;
			m_zoomFactorFootnote = zoomFactorFootnote;

			// Don't start out in edit mode
			m_editMode = false;

			// If the diff is a comparison of the current against a normal saved version, then
			// change the label text.
			ScrDraft draft = new ScrDraft(m_cache, m_bookMerger.BookRev.OwnerHVO);
			if (draft.Type == ScrDraftType.SavedVersion)
			{
				lblSavedVersion.Text = string.Format(TeDiffViewResources.kstidSavedVersion,
					draft.Description);
			}
			else
				lblSavedVersion.Text = string.Format(lblSavedVersion.Text, draft.Description);

			CreateUndoMark();
		}
Пример #28
0
		public virtual void Init(Mediator mediator, XmlNode configurationParameters)
		{
			CheckDisposed();

			m_mediator = mediator;
			m_configurationParameters = configurationParameters;
			m_mediator.AddColleague(this);

			FdoCache cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
			List<ILgWritingSystem> usedWses = new List<ILgWritingSystem>();
			using (new SuppressSubTasks(cache))
			{
				foreach (IReversalIndex rev in cache.LangProject.LexDbOA.ReversalIndexesOC)
				{
					// This benign looking check of the count appears to do nothing,
					// but it is very important as it ensures the vector is cached. Without it,
					// crashes turn up in bulk deletion, as no PropChanged is sent,
					// as the vector is not in the cache.
					int entryCount = 0;
					entryCount = rev.EntriesOC.Count;
					usedWses.Add(rev.WritingSystemRA);
					if (rev.PartsOfSpeechOA == null)
						(rev as ReversalIndex).InitNewInternal();
					if (rev.PartsOfSpeechOA.ItemClsid != PartOfSpeech.kClassId)
						rev.PartsOfSpeechOA.ItemClsid = PartOfSpeech.kClassId;
				}
				List<IReversalIndex> corruptReversalIndices = new List<IReversalIndex>();
				foreach (IReversalIndex rev in cache.LangProject.LexDbOA.ReversalIndexesOC)
				{
					// Make sure each index has a name, if it is available from the writing system.
					if (rev.WritingSystemRA == null)
					{
						// Delete a bogus ReversalIndex that has no writing system.
						// But, for now only store them for later deletion,
						// as immediate removal will wreck the looping.
						corruptReversalIndices.Add(rev);
						continue;
					}
					ILgWritingSystem revWs = rev.WritingSystemRA;
					string sql = string.Format("SELECT Ws, Txt FROM LgWritingSystem_Name WHERE Obj = {0}", revWs.Hvo);
					IOleDbCommand odc = DbOps.MakeRowSet(cache, sql, null);
					try
					{
						bool fMoreRows;
						odc.NextRow(out fMoreRows);
						while (fMoreRows)
						{
							int wsHvo = DbOps.ReadInt(odc, 0);
							string nameWs = DbOps.ReadString(odc, 1);
							string nameRev = rev.Name.GetAlternative(wsHvo);
							if ((nameRev == null || nameRev == String.Empty)
								&& (nameWs != null && nameWs.Length > 0))
							{
								rev.Name.SetAlternative(nameWs, wsHvo);
							}
							odc.NextRow(out fMoreRows);
						}
					}
					finally
					{
						DbOps.ShutdownODC(ref odc);
					}
				}
				// Delete any corrupt reversal indices.
				foreach (IReversalIndex rev in corruptReversalIndices)
				{
					rev.DeleteUnderlyingObject();
				}
			}
			// Set up for the reversal index combo box or dropdown menu.
			int firstId = 0;
			List<int> reversalIds = cache.LangProject.LexDbOA.CurrentReversalIndices;
			if (reversalIds.Count > 0)
				firstId = reversalIds[0];
			else if (cache.LangProject.LexDbOA.ReversalIndexesOC.Count > 0)
				firstId = cache.LangProject.LexDbOA.ReversalIndexesOC.HvoArray[0];
			if (firstId > 0)
			{
				SetReversalIndexHvo(firstId);
			}
		}