示例#1
0
		public MakeInflAffixEntryChooserCommand(FdoCache cache, bool fCloseBeforeExecuting,
			string sLabel, bool fPrefix, IMoInflAffixSlot slot, Mediator mediator)
			: base(cache, fCloseBeforeExecuting, sLabel, mediator)
		{
			m_fPrefix = fPrefix;
			m_slot = slot;
		}
示例#2
0
		internal InterAreaBookmark(InterlinMaster interlinMaster, Mediator mediator, FdoCache cache)	// For restoring
		{
			// Note: resist any temptation to save mediator in a memer variable. Bookmarks are kept in a static dictionary
			// and may well have a longer life than the mediator. There is danger of using if after it is disposed. See LT-12435.
			Init(interlinMaster, cache);
			Restore(interlinMaster.IndexOfTextRecord, mediator);
		}
示例#3
0
        public void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            m_mediator = mediator;
            mediator.AddColleague(this);
        }
		public void Init(Mediator mediator, XmlNode configurationNode, ICmObject sourceObject)
		{
			CheckDisposed();

			m_cache = sourceObject.Cache;

			// Find the sense we want examples for, which depends on the kind of source object.
			if (sourceObject is ILexExampleSentence)
			{
				m_les = sourceObject as ILexExampleSentence;
				m_owningSense = (ILexSense)m_les.Owner;
			}
			else if (sourceObject is ILexSense)
			{
				m_owningSense = sourceObject as ILexSense;
			}
			else
			{
				throw new ArgumentException("Invalid object type for sourceObject.");
			}

			m_mediator = mediator;
			m_configurationNode = configurationNode;

			helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
			helpProvider.SetShowHelp(this, true);
			if (m_mediator.HelpTopicProvider != null)
			{
				helpProvider.HelpNamespace = m_mediator.HelpTopicProvider.HelpFile;
				helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(m_helpTopic));
				btnHelp.Enabled = true;
			}

			AddConfigurableControls();
		}
示例#5
0
		public void SetDlgInfo(FdoCache cache, Mediator mediator, ICmObject owner)
		{
			CheckDisposed();

			m_cache = cache;
			m_owner = owner;

			m_helpTopic = "khtpDataNotebook-InsertRecordDlg";

			m_helpTopicProvider = mediator.HelpTopicProvider;
			if (m_helpTopicProvider != null) // Will be null when running tests
			{
				m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
				m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(m_helpTopic));
				m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
			}

			IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
			m_titleTextBox.StyleSheet = stylesheet;
			m_titleTextBox.WritingSystemFactory = m_cache.WritingSystemFactory;
			m_titleTextBox.WritingSystemCode = m_cache.DefaultAnalWs;
			AdjustControlAndDialogHeight(m_titleTextBox, m_titleTextBox.PreferredHeight);

			m_typeCombo.StyleSheet = stylesheet;
			m_typeCombo.WritingSystemFactory = m_cache.WritingSystemFactory;
			m_typeCombo.WritingSystemCode = m_cache.DefaultAnalWs;
			AdjustControlAndDialogHeight(m_typeCombo, m_typeCombo.PreferredHeight);

			ICmPossibilityList recTypes = m_cache.LanguageProject.ResearchNotebookOA.RecTypesOA;
			m_typePopupTreeManager = new PossibilityListPopupTreeManager(m_typeCombo, m_cache, mediator,
				recTypes, cache.DefaultAnalWs, false, this);
			m_typePopupTreeManager.LoadPopupTree(m_cache.ServiceLocator.GetObject(RnResearchNbkTags.kguidRecObservation).Hvo);
			// Ensure that we start out focused in the Title text box.  See FWR-2731.
			m_titleTextBox.Select();
		}
		protected virtual void Dispose(bool disposing)
		{
			System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			if (!IsDisposed)
			{
				if (disposing)
				{
					if (m_mediator != null)
						m_mediator.RemoveColleague(m_window);


					if (m_window != null && !m_window.IsDisposed)
						m_window.Dispose();
					m_window = null;

					if (m_mediator != null && !m_mediator.IsDisposed)
						m_mediator.Dispose();
					m_mediator = null;

					if (m_allReversalEntriesRecordList != null && !m_allReversalEntriesRecordList.IsDisposed)
						m_allReversalEntriesRecordList.Dispose();
					m_allReversalEntriesRecordList = null;
				}
				IsDisposed = true;
			}
		}
示例#7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Prepares the selected files to be uploaded to REAP using RAMP.
		/// </summary>
		/// <param name="owner">RAMP dialog owner</param>
		/// <param name="dialogFont">RAMP dialog font (for localization and consistency)</param>
		/// <param name="localizationDialogIcon"></param>
		/// <param name="filesToArchive"></param>
		/// <param name="mediator"></param>
		/// <param name="thisapp"></param>
		/// <param name="cache"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		public bool ArchiveNow(Form owner, Font dialogFont, Icon localizationDialogIcon,
			IEnumerable<string> filesToArchive, Mediator mediator, FwApp thisapp, FdoCache cache)
		{
			var viProvider = new VersionInfoProvider(Assembly.LoadFile(thisapp.ProductExecutableFile), false);
			var wsMgr = cache.ServiceLocator.GetInstance<IWritingSystemManager>();
			var appName = thisapp.ApplicationName;
			var title = cache.LanguageProject.ShortName;
			var uiLocale = wsMgr.Get(cache.DefaultUserWs).IcuLocale;
			var projectId = cache.LanguageProject.ShortName;

			var model = new RampArchivingDlgViewModel(Application.ProductName, title, projectId, /*appSpecificArchivalProcessInfo:*/ string.Empty, SetFilesToArchive(filesToArchive), GetFileDescription);

			// image files should be labeled as Graphic rather than Photograph (the default).
			model.ImagesArePhotographs = false;

			// show the count of media files, not the duration
			model.ShowRecordingCountNotLength = true;

			// set the general description, in each available language
			IMultiString descr = cache.LanguageProject.Description;
			var descriptions = new Dictionary<string, string>();
			foreach (int wsid in descr.AvailableWritingSystemIds)
			{
				var descrText = descr.get_String(wsid).Text;
				if ((!string.IsNullOrEmpty(descrText)) && (descrText != "***"))
					descriptions[wsMgr.Get(wsid).GetIso3Code()] = descrText;
			}

			if (descriptions.Count > 0)
				model.SetDescription(descriptions);

			AddMetsPairs(model, viProvider.ShortNumericAppVersion, cache);

			const string localizationMgrId = "Archiving";

			if (s_localizationMgr == null)
			{
				s_localizationMgr = LocalizationManager.Create(
					uiLocale,
					localizationMgrId, viProvider.ProductName, viProvider.NumericAppVersion,
					FwDirectoryFinder.GetCodeSubDirectory("ArchivingLocalizations"),
					Path.Combine(Application.CompanyName, appName),
					localizationDialogIcon, "*****@*****.**", "SIL.Archiving");
			}
			else
			{
				LocalizationManager.SetUILanguage(uiLocale, true);
			}

			// create the dialog
			using (var dlg = new ArchivingDlg(model, localizationMgrId, dialogFont, new FormSettings()))
			using (var reportingAdapter = new PalasoErrorReportingAdapter(dlg, mediator))
			{
				ErrorReport.SetErrorReporter(reportingAdapter);
				dlg.ShowDialog(owner);
				ErrorReport.SetErrorReporter(null);
			}

			return true;
		}
示例#8
0
		/// <summary>
		/// Look for a simple writing system spec as part of a node...currently either 'analysis' or 'vernacular'.
		/// If not found, answer 0.
		/// If found, answer the ID of the appropriate writing system, or throw exception if not valid.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="node"></param>
		/// <returns></returns>
		static int GetWs(Mediator mediator, FdoCache cache, XmlNode node)
		{
			string wsSpec = XmlUtils.GetOptionalAttributeValue(node, "ws");
			if (wsSpec != null)
			{
				int ws = 0;
				switch (wsSpec)
				{
					case "vernacular":
						ws = cache.LangProject.DefaultVernacularWritingSystem;
						break;
					case "analysis":
						ws = cache.LangProject.DefaultAnalysisWritingSystem;
						break;
					case "pronunciation":
						ws = cache.LangProject.DefaultPronunciationWritingSystem;
						break;
					case "reversal":
						int rih = int.Parse((string)mediator.PropertyTable.GetValue("ReversalIndexHvo"));
						if (rih > 0)
						{
							IReversalIndex ri = ReversalIndex.CreateFromDBObject(cache, rih);
							ws = ri.WritingSystemRAHvo;
						}
						else
							throw new ApplicationException("Couldn't find current reversal index.");
						break;
					default:
						throw new ApplicationException("ws must be 'vernacular', 'analysis', 'pronunciation',  or 'reversal';" + " it said '" + wsSpec + "'.");
				}
				return ws;
			}
			else
				return 0;
		}
示例#9
0
		/// <summary>
		/// Constructor.
		/// </summary>
		public MSAPopupTreeManager(PopupTree popupTree, FdoCache cache, ICmPossibilityList list,
			int ws, bool useAbbr, Mediator mediator, Form parent)
			: base(popupTree,  cache, list, ws, useAbbr, parent)
		{
			m_mediator = mediator;
			LoadStrings();
		}
示例#10
0
        /// <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 virtual void Dispose(bool disposing)
        {
            System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources here.
                if (m_mediator != null)
                {
                    m_mediator.RemoveColleague(this);
                }
                if (m_cache != null && !m_cache.IsDisposed && m_cache.DomainDataByFlid != null)
                {
                    m_cache.DomainDataByFlid.RemoveNotification(this);
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_mediator = null;
            m_configurationParameters = null;

            m_isDisposed = true;
        }
示例#11
0
		/// <summary>
		/// Initialize this as an IxCoreColleague
		/// </summary>
		/// <param name="mediator"></param>
		/// <param name="configurationParameters"></param>
		public override void Init(Mediator mediator, XmlNode configurationParameters)
		{
			CheckDisposed();

			InitBase(mediator, configurationParameters);
			m_fullyInitialized = true;
		}
示例#12
0
		public ImportWordSetDlg(Mediator mediator)
		{
			InitializeComponent();
			m_mediator = mediator;
			m_cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
			helpSetup();
		}
        /// <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 virtual void Dispose(bool disposing)
        {
            System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources here.
                if (m_clb != null)
                {
                    m_clb.Dispose();
                    m_clb = null;
                }
                m_rgfmi = null;
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_inflAffixTemplateCtrl = null;
            m_mediator = null;

            m_isDisposed = true;
        }
示例#14
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",
                                   FwLink.Create(toolName, Guid.Empty, cache.ServerName, cache.DatabaseName), false);
        }
示例#15
0
		public void Init(Mediator mediator, XmlNode configurationNode, ICmObject sourceObject)
		{
			CheckDisposed();

			m_cache = sourceObject.Cache;

			// Find the sense owning our LexExampleSentence
			if (sourceObject is LexExampleSentence)
			{
				m_les = sourceObject as LexExampleSentence;
				m_owningSense = LexSense.CreateFromDBObject(m_cache, m_les.OwnerHVO);
			}
			else if (sourceObject is LexSense)
			{
				m_owningSense = sourceObject as ILexSense;
			}
			else
			{
				throw new ArgumentException("Invalid object type for sourceObject.");
			}

			m_mediator = mediator;
			m_configurationNode = configurationNode;
			AddConfigurableControls();

			m_virtFlidReference = BaseVirtualHandler.GetInstalledHandlerTag(m_cache, "CmBaseAnnotation", "Reference");
		}
		/// <summary>
		/// when calling the dialog from an "Insert Variant" context this
		/// constructor is used to indicate that m_startingEntry is a componentLexeme
		/// rather than the variant
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="mediator"></param>
		/// <param name="componentLexeme">the entry we wish to find or create a variant for.</param>
		protected void SetDlgInfoForComponentLexeme(FdoCache cache, Mediator mediator, IVariantComponentLexeme componentLexeme)
		{
			m_fBackRefToVariant = true;
			ILexEntry startingEntry = null;
			if (componentLexeme.ClassID == LexEntry.kclsidLexEntry)
			{
				startingEntry = componentLexeme as LexEntry;
			}
			else
			{
				int hvoEntry = cache.GetOwnerOfObjectOfClass(componentLexeme.Hvo, LexEntry.kclsidLexEntry);
				if (hvoEntry != 0)
					startingEntry = LexEntry.CreateFromDBObject(cache, hvoEntry);
			}
			base.SetDlgInfo(cache, mediator, startingEntry);
			// we are looking for an existing variant form
			// so hide the Entry/Sense radio group box.
			grplbl.Visible = false;
			// also hide variant type.
			tcVariantTypes.Visible = false;
			lblVariantType.Visible = false;
			m_fGetVariantEntryTypeFromTreeCombo = false;
			lblCreateEntry.Visible = false;

			// The dialog title and other labels need to reflect "Insert Variant" context.
			m_formLabel.Text = LexTextControls.ks_Variant;
			this.Text = LexTextControls.ksFindVariant;
			btnInsert.Text = LexTextControls.ks_Create;
			// We disable the "Create" button when we don't have text in the Find textbox.
			UpdateButtonCreateNew();
		}
示例#17
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged
        /// resources; <c>false</c> to release only unmanaged resources.
        /// </param>
        /// -----------------------------------------------------------------------------------
        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();
                }
                if (ExistingClerk != null)
                {
                    ExistingClerk.BecomeInactive();
                }
                if (m_mediator != null)
                {
                    m_mediator.RemoveColleague(this);
                }
                if (m_mpParent != null)
                {
                    m_mpParent.ShowFirstPaneChanged -= new EventHandler(mp_ShowFirstPaneChanged);
                    m_mpParent.ShowFirstPaneChanged -= new EventHandler(mp_ShowFirstPaneChanged);
                }
            }
            m_mediator       = null;
            m_informationBar = null;             // Should be disposed automatically, since it is in the Controls collection.
            m_mpParent       = null;

            base.Dispose(disposing);
        }
示例#18
0
		/// <summary>non-undoable task because setting up an StText must be done in a Unit of Work</summary>
		private void DoSetupFixture()
		{
			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;

			// set up default vernacular ws.
			m_wsDefaultVern = Cache.ServiceLocator.WritingSystemManager.Get("fr");
			m_wsOtherVern = Cache.ServiceLocator.WritingSystemManager.Get("es");
			m_wsEn = Cache.ServiceLocator.WritingSystemManager.Get("en");
			Cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Add(m_wsOtherVern);
			Cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Add(m_wsOtherVern);
			Cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Add(m_wsDefaultVern);
			Cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Insert(0, m_wsDefaultVern);

			// set up an StText with an empty paragraph with default Contents (empty English TsString)
			m_sttNoExplicitWs = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create();
			Cache.ServiceLocator.GetInstance<ITextFactory>().Create().ContentsOA = m_sttNoExplicitWs;
			m_sttNoExplicitWs.AddNewTextPara(null);
			Assert.AreEqual(m_wsEn.Handle, m_sttNoExplicitWs.MainWritingSystem, "Our code counts on English being the defualt WS for very empty texts");

			// set up an StText with an empty paragraph with an empty TsString in a non-default vernacular
			m_sttEmptyButWithWs = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create();
			Cache.ServiceLocator.GetInstance<ITextFactory>().Create().ContentsOA = m_sttEmptyButWithWs;
			m_sttEmptyButWithWs.AddNewTextPara(null);
			((IStTxtPara)m_sttEmptyButWithWs.ParagraphsOS[0]).Contents = TsStringUtils.MakeTss(string.Empty, m_wsOtherVern.Handle);
		}
示例#19
0
		public InfoPane(FdoCache cache, Mediator mediator, RecordClerk clerk)
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			Initialize(cache, mediator, clerk);
		}
示例#20
0
		public ChoiceRelatedClass(Mediator mediator,  IUIAdapter adapter, XmlNode configurationNode)
		{
			m_adapter = adapter;
			m_mediator = mediator;
			m_configurationNode = configurationNode;
			m_defaultVisible= XmlUtils.GetOptionalBooleanAttributeValue(m_configurationNode, "defaultVisible", true);
		}
示例#21
0
		public void Initialize(ICmObject rootObj, int rootFlid, string rootFieldName, FdoCache cache, string displayNameProperty,
			Mediator mediator, string displayWs)
		{
			CheckDisposed();
			m_displayWs = displayWs;
			Initialize(rootObj, rootFlid, rootFieldName, cache, displayNameProperty, mediator);
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// a factory method for RecordFilterListProvider
		/// </summary>
		/// <param name="mediator">The mediator.</param>
		/// <param name="configuration">The configuration.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		static public RecordFilterListProvider Create(Mediator mediator, XmlNode configuration)
		{
			RecordFilterListProvider p = (RecordFilterListProvider)DynamicLoader.CreateObject(configuration);
			if (p != null)
				p.Init(mediator, configuration);
			return p;
		}
		public PossibilityAutoComplete(FdoCache cache, Mediator mediator, ICmPossibilityList list, Control control,
			string displayNameProperty, string displayWs)
		{
			m_cache = cache;
			m_mediator = mediator;
			m_control = control;
			m_displayNameProperty = displayNameProperty;
			m_displayWs = displayWs;

			m_listBox = new ComboListBox {DropDownStyle = ComboBoxStyle.DropDownList, ActivateOnShow = false};
			m_listBox.SelectedIndexChanged += HandleSelectedIndexChanged;
			m_listBox.SameItemSelected += HandleSameItemSelected;
			m_listBox.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
			m_listBox.WritingSystemFactory = cache.WritingSystemFactory;
			m_searcher = new StringSearcher<ICmPossibility>(SearchType.Prefix, cache.ServiceLocator.WritingSystemManager);
			m_possibilities = new List<ICmPossibility>();
			var stack = new Stack<ICmPossibility>(list.PossibilitiesOS);
			while (stack.Count > 0)
			{
				ICmPossibility poss = stack.Pop();
				m_possibilities.Add(poss);
				foreach (ICmPossibility child in poss.SubPossibilitiesOS)
					stack.Push(child);
			}

			m_control.KeyDown += HandleKeyDown;
			m_control.KeyPress += HandleKeyPress;
		}
示例#24
0
		/// <summary>
		/// Set up the dlg in preparation to showing it.
		/// </summary>
		/// <param name="cache">FDO cache.</param>
		/// <param name="wp">Strings used for various items in this dialog.</param>
		public void SetDlgInfo(FdoCache cache, Mediator mediator, WindowParams wp, DummyCmObject mainObj, List<DummyCmObject> mergeCandidates,
			string guiControl, string helpTopic)
		{
			CheckDisposed();

			Debug.Assert(cache != null);

			m_mediator = mediator;
			m_cache = cache;
			m_mainObj = mainObj;
			m_tsf = cache.TsStrFactory;

			m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.WritingSystemFactory;
			m_fwTextBoxBottomMsg.WritingSystemCode = m_cache.WritingSystemFactory.UserWs;

			InitBrowseView(guiControl, mergeCandidates);

			Text = wp.m_title;
			label2.Text = wp.m_label;

			m_helpTopic = helpTopic;

			if(m_helpTopic != null && m_helpTopicProvider != null) // m_helpTopicProvider could be null for testing
			{
				helpProvider = new HelpProvider();
				helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
				helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(m_helpTopic));
				helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
			}

			MoveWindowToPreviousPosition();
		}
示例#25
0
		/// <summary>
		/// From IFwExtension
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="mediator"></param>
		void IFwExtension.Init(FdoCache cache, Mediator mediator)
		{
			m_cache = cache;
			m_mediator = mediator;
			string sPrevFile = m_mediator.PropertyTable.GetStringProperty(FilePropertyName, null);
			if (!String.IsNullOrEmpty(sPrevFile))
			{
				tbPath.Text = sPrevFile;
				UpdateButtons();
			}
			string sMergeStyle = m_mediator.PropertyTable.GetStringProperty(MergeStylePropertyName, null);
			if (!String.IsNullOrEmpty(sMergeStyle))
			{
				m_msImport = (FlexLiftMerger.MergeStyle)Enum.Parse(typeof(FlexLiftMerger.MergeStyle), sMergeStyle, true);
				switch (m_msImport)
				{
					case FlexLiftMerger.MergeStyle.MsKeepOld:
						m_rbKeepCurrent.Checked = true;
						break;
					case FlexLiftMerger.MergeStyle.MsKeepNew:
						m_rbKeepNew.Checked = true;
						break;
					case FlexLiftMerger.MergeStyle.MsKeepBoth:
						m_rbKeepBoth.Checked = true;
						break;
					default:
						m_rbKeepCurrent.Checked = true;
						break;
				}
			}
		}
示例#26
0
		public MGAHtmlHelpDialog(FdoCache cache, Mediator mediator, string sMorphemeForm) : base(cache, mediator, sMorphemeForm)
		{
#if __MonoCS__
			m_browser = new GeckoWebBrowser
						{
							Dock = DockStyle.Fill,
							Location = new Point(0, 0),
							TabIndex = 1,
							MinimumSize = new Size(20, 20),
							NoDefaultContextMenu = true
						};
			splitContainerHorizontal.Panel2.Controls.Add(m_browser);
#else
			m_webBrowserInfo = new WebBrowser
								{
									Dock = DockStyle.Fill,
									Location = new Point(0, 0),
									TabIndex = 1,
									IsWebBrowserContextMenuEnabled = false,
									MinimumSize = new Size(20, 20),
									Name = "webBrowserInfo",
									WebBrowserShortcutsEnabled = false
								};

			splitContainerHorizontal.Panel2.Controls.Add(m_webBrowserInfo);
#endif
		}
示例#27
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);
		}
示例#28
0
		/// <summary>
		/// Set up the dlg in preparation to showing it.
		/// </summary>
		/// <param name="cache">FDO cache.</param>
		/// <param name="mediator">Mediator used to restore saved siz and location info.</param>
		/// <param name="startingEntry">Entry that cannot be used as a match in this dlg.</param>
		public void SetDlgInfo(FdoCache cache, Mediator mediator, ILexEntry startingEntry)
		{
			CheckDisposed();

			Debug.Assert(startingEntry != null);
			m_startingEntry = startingEntry;

			SetDlgInfo(cache, null, mediator);

			// Relocate remaining three buttons.
			Point pt = m_btnHelp.Location;
			// Make the Help btn 20 off the right edge of the dlg
			pt.X = Width - m_btnHelp.Width - 20;
			m_btnHelp.Location = pt;
			// Make the Cancel btn 10 from the left of the Help btn
			pt.X -= (m_btnClose.Width + 10);
			m_btnClose.Location = pt;
			// Make the Merge Entry btn 10 from the left of the Cancel btn.
			pt.X -= (m_btnOK.Width + 10);
			m_btnOK.Location = pt;
			SetBottomMessage();

			SetHelpTopic("khtpMergeEntry");

			//LT-3017 Launch the dialog with the Lexeme that is currently selected.
			Form = m_startingEntry.HomographForm;
		}
示例#29
0
		/// <summary>
		/// Create a new one.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="ss"></param>
		/// <param name="choices"></param>
		/// <param name="analysis"></param>
		/// <param name="mediator"></param>
		public TryAWordSandbox(FdoCache cache, Mediator mediator, IVwStylesheet ss, InterlinLineChoices choices,
			IAnalysis analysis)
			: base(cache, mediator, ss, choices)
		{
			SizeToContent = true;
			LoadForWordBundleAnalysis(analysis.Hvo);
		}
示例#30
0
		/// <summary>
		/// Create and initialize the browse view, storing the data it will display.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="stylesheet">The stylesheet.</param>
		/// <param name="mediator">The mediator.</param>
		/// <param name="xnConfig">The config node.</param>
		/// <param name="objs">The objs.</param>
		public void Initialize(FdoCache cache, IVwStylesheet stylesheet, Mediator mediator,
			XmlNode xnConfig, IEnumerable<ICmObject> objs)
		{
			CheckDisposed();
			m_cache = cache;
			m_stylesheet = stylesheet;
			m_mediator = mediator;
			m_configNode = xnConfig;
			SuspendLayout();
			m_listPublisher = new ObjectListPublisher(cache.DomainDataByFlid as ISilDataAccessManaged, ObjectListFlid);

			StoreData(objs);
			m_bvList = new BrowseViewer(m_configNode, m_cache.LanguageProject.Hvo, ObjectListFlid, m_cache, m_mediator,
				null, m_listPublisher);
			m_bvList.Location = new Point(0, 0);
			m_bvList.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom |
				AnchorStyles.Right;
			m_bvList.Name = "m_bvList";
			m_bvList.Sorter = null;
			m_bvList.TabStop = true;
			m_bvList.StyleSheet = m_stylesheet;
			m_bvList.Dock = DockStyle.Fill;
			m_bvList.SelectionChanged += m_bvList_SelectionChanged;
			Controls.Add(m_bvList);
			ResumeLayout(false);
		}
示例#31
0
        /// <summary>
        /// From IFwExtension
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        public void Init(FdoCache cache, XCore.Mediator mediator)
        {
            CheckDisposed();

            m_cache    = cache;
            m_mediator = mediator;
            m_sRootDir = DirectoryFinder.FWCodeDirectory;
            if (!m_sRootDir.EndsWith("\\"))
            {
                m_sRootDir += "\\";
            }
            m_sRootDir += "Language Explorer\\Import\\";

            m_sTempDir = Path.Combine(Path.GetTempPath(), "LanguageExplorer\\");
            if (!Directory.Exists(m_sTempDir))
            {
                Directory.CreateDirectory(m_sTempDir);
            }
            m_sLastXmlFileName = "";

            if (m_mediator.HelpTopicProvider != null)            // FwApp.App could be null during tests
            {
                helpProvider = new HelpProvider();
                helpProvider.HelpNamespace = m_mediator.HelpTopicProvider.HelpFile;
                helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(s_helpTopic));
                helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }
        }
示例#32
0
		public RegRuleFormulaVc(FdoCache cache, Mediator mediator)
			: base(cache, mediator)
		{
			ITsPropsBldr tpb = TsPropsBldrClass.Create();
			tpb.SetIntPropValues((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
			tpb.SetIntPropValues((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault,
				(int)ColorUtil.ConvertColorToBGR(Color.Gray));
			tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter);
			m_ctxtProps = tpb.GetTextProps();

			tpb = TsPropsBldrClass.Create();
			tpb.SetIntPropValues((int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, 20000);
			tpb.SetIntPropValues((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault,
				(int)ColorUtil.ConvertColorToBGR(Color.Gray));
			tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter);
			tpb.SetIntPropValues((int)FwTextPropType.ktptPadLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
			tpb.SetIntPropValues((int)FwTextPropType.ktptPadTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
			tpb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, MiscUtils.StandardSansSerif);
			tpb.SetIntPropValues((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable);
			m_charProps = tpb.GetTextProps();

			ITsStrFactory tsf = m_cache.TsStrFactory;
			int userWs = m_cache.DefaultUserWs;
			m_arrow = tsf.MakeString("\u2192", userWs);
			m_slash = tsf.MakeString("/", userWs);
			m_underscore = tsf.MakeString("__", userWs);
		}
示例#33
0
        /// <summary>
        /// From IFwExtension
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        public void Init(FdoCache cache, XCore.Mediator mediator)
        {
            CheckDisposed();

            m_cache    = cache;
            m_mediator = mediator;
            m_sRootDir = SIL.FieldWorks.Common.Utils.DirectoryFinder.FWCodeDirectory;
            if (!m_sRootDir.EndsWith("\\"))
            {
                m_sRootDir += "\\";
            }
            m_sRootDir += "Language Explorer\\Import\\";

            m_sTempDir = Path.Combine(Path.GetTempPath(), "LanguageExplorer\\");
            if (!Directory.Exists(m_sTempDir))
            {
                Directory.CreateDirectory(m_sTempDir);
            }
            m_sLastXmlFileName = "";

            if (FwApp.App != null)            // FwApp.App could be null during tests
            {
                this.helpProvider = new System.Windows.Forms.HelpProvider();
                this.helpProvider.HelpNamespace = FwApp.App.HelpFile;
                this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0));
                this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);
            }
        }
示例#34
0
        /// <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 virtual void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources here.
                if (m_mediator != null)
                {
                    // Not sure why this is retrieved from the mediator and not used,
                    // so commenting out for now.
                    // FdoCache cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
                    m_mediator.RemoveColleague(this);
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_mediator = null;
            m_configurationParameters = null;

            m_isDisposed = true;
        }
		/// <summary>
		/// Initialize the launcher.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="obj"></param>
		/// <param name="flid"></param>
		/// <param name="fieldName"></param>
		public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName,
			IPersistenceProvider persistProvider, Mediator mediator, string displayNameProperty, string displayWs)
		{
			CheckDisposed();

			base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs);
			m_msaInflectionFeatureListDlgLauncherView.Init(mediator, obj as IFsFeatStruc);
		}
示例#36
0
 public AddPrimaryLexemeChooserCommand(FdoCache cache, bool fCloseBeforeExecuting,
                                       string sLabel, XCore.Mediator mediator, ICmObject lexEntryRef, /* Why ICmObject? */
                                       Form parentWindow)
     : base(cache, fCloseBeforeExecuting, sLabel, mediator)
 {
     m_lexEntryRef  = lexEntryRef as ILexEntryRef;
     m_parentWindow = parentWindow;
 }
		protected override BrowseViewer CreateBrowseViewer(XmlNode nodeSpec, int hvoRoot, int fakeFlid, FdoCache cache, Mediator mediator,
			ISortItemProvider sortItemProvider, ISilDataAccessManaged sda)
		{
			var viewer = new FdoUi.BrowseViewerPhonologicalFeatures(nodeSpec,
						 hvoRoot, fakeFlid,
						 cache, mediator, sortItemProvider, sda);
			return viewer;
		}
示例#38
0
 protected override void SetDlgInfo(FdoCache cache, WindowParams wp, XCore.Mediator mediator, int wsVern)
 {
     WritingSystemAndStylesheetHelper.SetupWritingSystemAndStylesheetInfo(tcVariantTypes,
                                                                          cache, mediator, cache.DefaultUserWs);
     base.SetDlgInfo(cache, wp, mediator, wsVern);
     // load the variant type possibilities.
     LoadVariantTypes();
 }
示例#39
0
        public override void Init(XCore.Mediator mediator, PropertyTable propertyTable, XmlNode viewConfiguration)
        {
            base.Init(mediator, propertyTable, viewConfiguration);
            XmlNode clerkConfiguration = ToolConfiguration.GetClerkNodeFromToolParamsNode(viewConfiguration);
            var     subitemNames       = XmlUtils.GetMandatoryAttributeValue(clerkConfiguration, "field").Split('.');

            SubitemFlid = Cache.MetaDataCacheAccessor.GetFieldId(subitemNames[0].Trim(), subitemNames[1].Trim(), true);
        }
 public AddComponentChooserCommand(FdoCache cache, bool fCloseBeforeExecuting,
                                   string sLabel, XCore.Mediator mediator, ICmObject obj,
                                   Form form)
     : base(cache, fCloseBeforeExecuting, sLabel, mediator)
 {
     m_ler  = obj as ILexEntryRef;
     m_form = form;
 }
		/// <summary>
		/// setup the given control's WritingSystem[Factory] and Stylesheet related functionality
		/// </summary>
		/// <param name="control"></param>
		/// <param name="cache"></param>
		/// <param name="mediator">used to get stylesheet</param>
		/// <param name="wsDefault">used to set WritingSytemCode and Font for the control</param>
		public static void SetupWritingSystemAndStylesheetInfo(IWritingSystemAndStylesheet control,
			FdoCache cache, Mediator mediator, int wsDefault)
		{
			control.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor;
			control.WritingSystemCode = wsDefault;
			control.Font = new System.Drawing.Font(cache.LangProject.GetDefaultFontForWs(wsDefault), 10);
			control.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
		}
示例#42
0
		public WebPageInteractor(HtmlControl htmlControl, Mediator mediator, FwTextBox tbWordForm)
		{
			m_htmlControl = htmlControl;
			m_mediator = mediator;
			m_cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
			m_tbWordForm = tbWordForm;
			m_htmlControl.Browser.DomClick += HandleDomClick;
		}
示例#43
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Constructor for multiple matching LexEntry objects.
        /// </summary>
        /// <param name="rghvo">The rghvo.</param>
        /// <param name="tssForm">The TSS form.</param>
        /// <param name="helpProvider">The help provider.</param>
        /// <param name="helpFileKey">The help file key.</param>
        /// <param name="styleSheet">The stylesheet.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="mediator">The mediator.</param>
        /// ------------------------------------------------------------------------------------
        internal SummaryDialogForm(List <int> rghvo, ITsString tssForm, IHelpTopicProvider helpProvider,
                                   string helpFileKey, IVwStylesheet styleSheet, FdoCache cache, Mediator mediator)
        {
            InitializeComponent();
            AccessibleName = GetType().Name;

            Debug.Assert(rghvo != null && rghvo.Count > 0);
            m_rghvo    = rghvo;
            m_cache    = cache;
            m_mediator = mediator;
            Initialize(tssForm, helpProvider, helpFileKey, styleSheet);
        }
示例#44
0
        private bool m_fOtherClicked;       // set true by btnOther_Click, caller should call OtherButtonClicked after dialog closes.
        #endregion

        #region Constructor/destructor
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Constructor for a single LexEntry object.
        /// </summary>
        /// <param name="leui">The lex entry ui.</param>
        /// <param name="tssForm">The TSS form.</param>
        /// <param name="helpProvider">The help provider.</param>
        /// <param name="helpFileKey">string key to get the help file name</param>
        /// <param name="styleSheet">The stylesheet.</param>
        /// ------------------------------------------------------------------------------------
        internal SummaryDialogForm(LexEntryUi leui, ITsString tssForm, IHelpTopicProvider helpProvider,
                                   string helpFileKey, IVwStylesheet styleSheet)
        {
            InitializeComponent();
            AccessibleName = GetType().Name;

            m_rghvo = new List <int>(1);
            m_rghvo.Add(leui.Object.Hvo);
            m_cache    = leui.Object.Cache;
            m_mediator = leui.Mediator;
            Initialize(tssForm, helpProvider, helpFileKey, styleSheet);
        }
示例#45
0
        public MGADialog(FdoCache cache, Mediator mediator, string sMorphemeForm)
        {
            m_mediator = mediator;
            m_cache    = cache;
            InitForm();
            labelAllomorph.Text = sMorphemeForm;

            helpProvider = new System.Windows.Forms.HelpProvider();
            helpProvider.HelpNamespace = FwApp.App.HelpFile;
            helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0));
            helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);
        }
示例#46
0
        public void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            m_mediator = mediator;
            m_cache    = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
            mediator.AddColleague(this);
            mediator.PropertyTable.SetProperty("ParserListener", this);
            mediator.PropertyTable.SetPropertyPersistence("ParserListener", false);

            m_sda = m_cache.MainCacheAccessor;
            m_sda.AddNotification(this);
        }
示例#47
0
        internal void Init(XCore.Mediator mediator, XmlNode node)
        {
            CheckDisposed();

            m_mediator = mediator;

            if (node != null)
            {
                m_hierarchical = XmlUtils.GetBooleanAttributeValue(node, "hierarchical");
                m_expand       = XmlUtils.GetBooleanAttributeValue(node, "expand");
                m_includeAbbr  = XmlUtils.GetBooleanAttributeValue(node, "includeAbbr");
                m_bestWS       = XmlUtils.GetOptionalAttributeValue(node, "ws", null);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="strings"></param>
        /// <param name="obj"></param>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="tssNote">a second message, in addition to what's in obj.Object.DeletionTextTss</param>
        public void SetDlgInfo(CmObjectUi obj, FdoCache cache, XCore.Mediator mediator, ITsString tssNote)
        {
            CheckDisposed();

            Debug.Assert(obj != null);
            Debug.Assert(obj.Object != null);

            //do not change the order of the following two lines of code
            //because m_descritiptionBox4.Tss is given a default value first.
            SetDlgInfo(obj, cache, mediator);
            ITsIncStrBldr tisb = TsIncStrBldrClass.Create();

            tisb.AppendTsString(tssNote);
            m_descriptionBox4.Tss = tisb.GetString();
        }
示例#49
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();
            }
        }
示例#50
0
 public AddComplexFormChooserCommand(FdoCache cache, bool fCloseBeforeExecuting,
                                     string sLabel, XCore.Mediator mediator, ICmObject lexEntry, /* Why ICmObject? */
                                     Form parentWindow)
     : base(cache, fCloseBeforeExecuting, sLabel, mediator)
 {
     m_lexEntry = lexEntry as ILexEntry;
     if (m_lexEntry == null)
     {
         m_lexSense = lexEntry as ILexSense;
         if (m_lexSense != null)
         {
             m_lexEntry = m_lexSense.Entry;
         }
     }
     m_parentWindow = parentWindow;
 }
示例#51
0
        /// <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 virtual void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            // m_sda COM object block removed due to crash in Finializer thread LT-6124

            if (disposing)
            {
                // Dispose managed resources here.
                if (m_updateTimer != null)
                {
                    m_updateTimer.Stop();
                    m_updateTimer.Tick -= new EventHandler(m_updateTimer_Elapsed);
                    m_updateTimer.Dispose();
                }

                if (m_sda != null)
                {
                    m_sda.RemoveNotification(this);
                }
                m_mediator.RemoveColleague(this);
                ParserConnection cnx = Connection;
                if (cnx != null)
                {
                    // Remove ParserConnection from the PropertyTable.
                    m_mediator.PropertyTable.SetProperty("ParserConnection", null, false);
                    m_mediator.PropertyTable.SetPropertyPersistence("ParserConnection", false);
                    m_mediator.PropertyTable.SetProperty("ParserListener", null, false);
                    m_mediator.PropertyTable.SetPropertyPersistence("ParserListener", false);
                    cnx.Dispose();
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_sda         = null;
            m_mediator    = null;
            m_cache       = null;
            m_updateTimer = null;
            m_traceSwitch = null;

            m_isDisposed = true;
        }
示例#52
0
        /// <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();
                }
                if (m_mediator != null)
                {
                    m_mediator.RemoveColleague(this);
                }
                if (m_fxtDumper != null)
                {
                    m_fxtDumper.Dispose();
                }
                if (m_stringResMan != null)
                {
                    m_stringResMan.ReleaseAllResources();
                }
            }
            m_mediator                  = null;
            m_fxtDumper                 = null;
            m_fxtNode                   = null;
            m_transformsNode            = null;
            m_sHtmlFileName             = null;
            m_configurationParameters   = null;
            m_sProgressDialogTitle      = null;
            m_sRegKeyName               = null;
            m_sFileNameKey              = null;
            m_stringResMan              = null;
            m_AlsoSaveTransformNode     = null;
            m_sAlsoSaveDialogTitle      = null;
            m_sAlsoSaveFileName         = null;
            m_sReplaceDoctype           = null;
            m_sSaveAsWebpageDialogTitle = null;

            base.Dispose(disposing);
        }
示例#53
0
        /// <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 virtual void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources here.
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_mediator = null;

            m_isDisposed = true;
        }
示例#54
0
        public override void Initialize(LcmCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider,
                                        XCore.Mediator mediator, PropertyTable propertyTable, string displayNameProperty, string displayWs)
        {
            CheckDisposed();
            base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, propertyTable, displayNameProperty, displayWs);

            m_view.Init(mediator, propertyTable, obj.Hvo, this, new AffixRuleFormulaVc(cache, propertyTable), AffixRuleFormulaVc.kfragRule, cache.MainCacheAccessor);

            m_view.SelectionChanged += SelectionChanged;

            m_insertionControl.AddOption(new InsertOption(RuleInsertType.Phoneme), DisplayOption);
            m_insertionControl.AddOption(new InsertOption(RuleInsertType.NaturalClass), DisplayOption);
            m_insertionControl.AddOption(new InsertOption(RuleInsertType.Features), DisplayOption);
            m_insertionControl.AddOption(new InsertOption(RuleInsertType.MorphemeBoundary), DisplayOption);
            m_insertionControl.AddOption(new InsertOption(RuleInsertType.Variable), DisplayVariableOption);
            m_insertionControl.AddOption(new InsertOption(RuleInsertType.Column), DisplayColumnOption);
            m_insertionControl.AddMultiOption(new InsertOption(RuleInsertType.Index), DisplayOption, DisplayIndices);
            m_insertionControl.NoOptionsMessage = DisplayNoOptsMsg;
        }
示例#55
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.m_msaDlglauncherView = new SIL.FieldWorks.XWorks.LexEd.MSADlglauncherView();
     this.m_panel.SuspendLayout();
     this.SuspendLayout();
     //
     // m_panel
     //
     this.m_panel.Name = "m_panel";
     //
     // m_btnLauncher
     //
     this.m_btnLauncher.Name = "m_btnLauncher";
     //
     // m_msaDlglauncherView
     //
     this.m_msaDlglauncherView.BackColor                  = System.Drawing.SystemColors.Window;
     this.m_msaDlglauncherView.Dock                       = System.Windows.Forms.DockStyle.Fill;
     this.m_msaDlglauncherView.Group                      = null;
     this.m_msaDlglauncherView.Location                   = new System.Drawing.Point(0, 0);
     this.m_msaDlglauncherView.Mediator                   = null;
     this.m_msaDlglauncherView.Name                       = "m_msaDlglauncherView";
     this.m_msaDlglauncherView.ReadOnlyView               = false;
     this.m_msaDlglauncherView.ScrollPosition             = new System.Drawing.Point(0, 0);
     this.m_msaDlglauncherView.ShowRangeSelAfterLostFocus = false;
     this.m_msaDlglauncherView.Size                       = new System.Drawing.Size(128, 24);
     this.m_msaDlglauncherView.SizeChangedSuppression     = false;
     this.m_msaDlglauncherView.TabIndex                   = 0;
     this.m_msaDlglauncherView.WsPending                  = -1;
     this.m_msaDlglauncherView.Zoom                       = 1F;
     //
     // MSADlgLauncher
     //
     this.Controls.Add(this.m_msaDlglauncherView);
     this.MainControl = this.m_msaDlglauncherView;
     this.Name        = "MSADlgLauncher";
     this.Size        = new System.Drawing.Size(150, 24);
     this.Controls.SetChildIndex(this.m_panel, 0);
     this.Controls.SetChildIndex(this.m_msaDlglauncherView, 0);
     this.m_panel.ResumeLayout(false);
     this.ResumeLayout(false);
 }
示例#56
0
        static public RecordBarHandler Create(XCore.Mediator mediator, XmlNode toolConfiguration)
        {
            RecordBarHandler handler = null;
            XmlNode          node    = toolConfiguration.SelectSingleNode("treeBarHandler");

            //if (node != null)
            //{
            //    handler = (TreeBarHandler)DynamicLoader.CreateObject(node);
            //    handler.Init(mediator, node);
            //}
            if (node == null)
            {
                handler = new RecordBarListHandler();
            }
            else
            {
                handler = (TreeBarHandler)DynamicLoader.CreateObject(node);
            }
            handler.Init(mediator, node);
            return(handler);
        }
示例#57
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Inits the specified mediator.
        /// </summary>
        /// <param name="mediator">The mediator.</param>
        /// <param name="configurationParameters">The configuration parameters.</param>
        /// ------------------------------------------------------------------------------------
        public override void Init(XCore.Mediator mediator, System.Xml.XmlNode configurationParameters)
        {
            base.Init(mediator, configurationParameters);

            // Load the special strings from the string table if possible.  If not, use the
            // default (English) values.
            if (mediator != null && mediator.HasStringTable)
            {
                StringTbl = mediator.StringTbl;
                if (StringTbl != null)
                {
                    m_sNullItemLabel = StringTbl.GetString("NullItemLabel",
                                                           "DetailControls/ReferenceComboBox");
                }
            }

            if (string.IsNullOrEmpty(m_sNullItemLabel) || m_sNullItemLabel == "*NullItemLabel*")
            {
                m_sNullItemLabel = DetailControlsStrings.ksNullLabel;
            }
        }
示例#58
0
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.m_PhonologicalFeatureListDlgLauncherView = new SIL.FieldWorks.XWorks.LexEd.PhonologicalFeatureListDlgLauncherView();
			this.m_panel.SuspendLayout();
			this.SuspendLayout();
			//
			// m_PhonologicalFeatureListDlgLauncherView
			//
			this.m_PhonologicalFeatureListDlgLauncherView.BackColor = System.Drawing.SystemColors.Window;
			this.m_PhonologicalFeatureListDlgLauncherView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.m_PhonologicalFeatureListDlgLauncherView.DoSpellCheck = false;
			this.m_PhonologicalFeatureListDlgLauncherView.Group = null;
			this.m_PhonologicalFeatureListDlgLauncherView.IsTextBox = false;
			this.m_PhonologicalFeatureListDlgLauncherView.Location = new System.Drawing.Point(0, 0);
			this.m_PhonologicalFeatureListDlgLauncherView.Mediator = null;
			this.m_PhonologicalFeatureListDlgLauncherView.Name = "m_PhonologicalFeatureListDlgLauncherView";
			this.m_PhonologicalFeatureListDlgLauncherView.Phoneme = null;
			this.m_PhonologicalFeatureListDlgLauncherView.ReadOnlyView = false;
			this.m_PhonologicalFeatureListDlgLauncherView.ScrollMinSize = new System.Drawing.Size(0, 0);
			this.m_PhonologicalFeatureListDlgLauncherView.ScrollPosition = new System.Drawing.Point(0, 0);
			this.m_PhonologicalFeatureListDlgLauncherView.ShowRangeSelAfterLostFocus = false;
			this.m_PhonologicalFeatureListDlgLauncherView.Size = new System.Drawing.Size(130, 24);
			this.m_PhonologicalFeatureListDlgLauncherView.SizeChangedSuppression = false;
			this.m_PhonologicalFeatureListDlgLauncherView.TabIndex = 0;
			this.m_PhonologicalFeatureListDlgLauncherView.WritingSystemFactory = null;
			this.m_PhonologicalFeatureListDlgLauncherView.WsPending = -1;
			this.m_PhonologicalFeatureListDlgLauncherView.Zoom = 1F;
			//
			// PhonologicalFeatureListDlgLauncher
			//
			this.Controls.Add(this.m_PhonologicalFeatureListDlgLauncherView);
			this.MainControl = this.m_PhonologicalFeatureListDlgLauncherView;
			this.Name = "PhonologicalFeatureListDlgLauncher";
			this.Size = new System.Drawing.Size(150, 24);
			this.Controls.SetChildIndex(this.m_panel, 0);
			this.Controls.SetChildIndex(this.m_PhonologicalFeatureListDlgLauncherView, 0);
			this.m_panel.ResumeLayout(false);
			this.ResumeLayout(false);

		}
示例#59
0
        void IFwExtension.Init(SIL.FieldWorks.FDO.FdoCache cache, XCore.Mediator mediator)
        {
            m_mediator   = mediator;
            m_cache      = cache;
            m_sUserWs    = SIL.FieldWorks.Common.Framework.FwApp.UserWs;
            m_sNewUserWs = m_sUserWs;
            m_userInterfaceChooser.Init(m_sUserWs);
            //PopulateLanguagesCombo();

            // Populate Plugins tab page list.
            string baseConfigPath = DirectoryFinder.GetFWCodeSubDirectory(@"Language Explorer\Configuration");
            string basePluginPath = Path.Combine(baseConfigPath, "Available Plugins");
            // The extension XML files should be stored in the data area, not in the code area.
            // This reduces the need for users to have administrative privileges.
            string baseExtensionPath = Path.Combine(DirectoryFinder.FWDataDirectory, @"Language Explorer\Configuration");

            foreach (string dir in Directory.GetDirectories(basePluginPath))
            {
                Debug.WriteLine(dir);
                string managerPath = Path.Combine(dir, "ExtensionManager.xml");
                if (File.Exists(managerPath))
                {
                    XmlDocument managerDoc = new XmlDocument();
                    managerDoc.Load(managerPath);
                    XmlNode managerNode = managerDoc.SelectSingleNode("/manager");
                    m_lvPlugins.SuspendLayout();
                    ListViewItem lvi = new ListViewItem();
                    lvi.Tag  = managerDoc;
                    lvi.Text = managerNode.Attributes["name"].Value;
                    lvi.SubItems.Add(managerNode.Attributes["description"].Value);
                    // See if it is installed and check the lvi if it is.
                    XmlNode configfilesNode = managerNode.SelectSingleNode("configfiles");
                    string  extensionPath   = Path.Combine(baseExtensionPath, configfilesNode.Attributes["targetdir"].Value);
                    lvi.Checked = Directory.Exists(extensionPath);
                    m_plugins.Add(lvi.Text, lvi.Checked);                     // Remember original installed state.
                    m_lvPlugins.Items.Add(lvi);
                    m_lvPlugins.ResumeLayout();
                }
            }
        }
示例#60
0
        /// <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 virtual void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources here.
                if (m_mediator != null)
                {
                    m_mediator.RemoveColleague(this);
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_mediator = null;
            m_configurationParameters = null;

            m_isDisposed = true;
        }