A PersistenceProvider which uses the XCore PropertyTable
Inheritance: IPersistenceProvider
コード例 #1
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);
            }
        }
コード例 #2
0
ファイル: BulkEditBar.cs プロジェクト: sillsdev/FieldWorks
		protected virtual void m_launcher_Click(object sender, EventArgs e)
		{
			if (m_hvoList == (int)SpecialHVOValues.kHvoUninitializedObject)
				return; // Can't show a chooser for a non-existent list!
			// Show a wait cursor (LT-4673)
			using (new WaitCursor(this.Control))
			{
				var list = m_cache.ServiceLocator.GetInstance<ICmPossibilityListRepository>().GetObject(m_hvoList);
				var persistProvider = new PersistenceProvider(m_mediator.PropertyTable);
				var labels = ObjectLabel.CreateObjectLabels(m_cache, list.PossibilitiesOS,
					m_displayNameProperty, m_displayWs);
				using (var chooser = new ReallySimpleListChooser(persistProvider,
					labels, m_fieldName, m_cache, m_chosenObjs, m_mediator.HelpTopicProvider))
				{
					chooser.Atomic = Atomic;
					chooser.Cache = m_cache;
					chooser.SetObjectAndFlid(0, m_flid);
					chooser.ShowFuncButtons();
					if (Convert.ToInt16(Right(m_flid.ToString(), 3)) >= 500 && Convert.ToInt16(Right(m_flid.ToString(),3)) < 600)
						chooser.SetHelpTopic("khtpBulkEditCustomField");
					else
						chooser.SetHelpTopic("khtpBulkEdit" + m_fieldName.Replace(" ", ""));
					var res = chooser.ShowDialog((sender as Control).TopLevelControl);
					if (DialogResult.Cancel == res)
						return;
					m_chosenObjs = chooser.ChosenObjects.ToList();
					m_fReplace = chooser.ReplaceMode;
					m_fRemove = chooser.RemoveMode;

					// Tell the parent control that we may have changed the selected item so it can
					// enable or disable the Apply and Preview buttons based on the selection.
					// We are just checking here if any item was selected by the user in the dialog
					if (ValueChanged != null)
					{
						int hvo = 0;
						if (m_chosenObjs.Count > 0)
							hvo = m_chosenObjs[0].Hvo;
						ValueChanged(sender, new FwObjectSelectionEventArgs(hvo));
					}
				}
			}
		}
コード例 #3
0
		private SimpleListChooser MakeChooserWithExtantSlots(bool fIsPrefixSlot)
		{
			int slotFlid;
			if (fIsPrefixSlot)
				slotFlid = MoInflAffixTemplateTags.kflidPrefixSlots;
			else
				slotFlid = MoInflAffixTemplateTags.kflidSuffixSlots;
			var labels = ObjectLabel.CreateObjectLabels(Cache, m_template.ReferenceTargetCandidates(slotFlid), null);
			PersistenceProvider persistProvider =
				new PersistenceProvider(m_mediator.PropertyTable);
			SimpleListChooser chooser = new SimpleListChooser(persistProvider, labels,
				m_ChooseSlotHelpTopic, m_mediator.HelpTopicProvider);
			chooser.SetHelpTopic("khtpChoose-Grammar-InflAffixTemplateControl");
			chooser.Cache = Cache;
			chooser.TextParamHvo = m_template.Owner.Hvo;
			chooser.Title = m_sSlotChooserTitle;
			chooser.InstructionalText = m_sSlotChooserInstructionalText;
			string sTopPOS;
			var pos = GetHighestPOS(m_template.OwnerOfClass<IPartOfSpeech>(), out sTopPOS);
			string sLabel = String.Format(m_sObligatorySlot, sTopPOS);
			chooser.AddLink(sLabel, SimpleListChooser.LinkType.kSimpleLink,
				new MakeInflAffixSlotChooserCommand(Cache, true, sLabel, pos.Hvo,
				false, m_mediator));
			sLabel = String.Format(m_sOptionalSlot, sTopPOS);
			chooser.AddLink(sLabel, SimpleListChooser.LinkType.kSimpleLink,
				new MakeInflAffixSlotChooserCommand(Cache, true, sLabel, pos.Hvo, true,
				m_mediator));
			chooser.SetObjectAndFlid(pos.Hvo, MoInflAffixTemplateTags.kflidSlots);
			return chooser;
		}
コード例 #4
0
ファイル: TryAWordDlg.cs プロジェクト: bbriggs/FieldWorks
		public void SetDlgInfo(Mediator mediator, IWfiWordform wordform, ParserListener parserListener)
		{
			m_mediator = mediator;
			m_persistProvider = new PersistenceProvider(PersistProviderID, m_mediator.PropertyTable);
			m_cache = (FdoCache) m_mediator.PropertyTable.GetValue("cache");
			m_parserListener = parserListener;

			Text = m_cache.ProjectId.UiName + " - " + Text;
			SetRootSite();
			SetFontInfo();
			// restore window location and size after setting up the form textbox, because it might adjust size of
			// window causing the window to grow every time it is opened
			m_persistProvider.RestoreWindowSettings(PersistProviderID, this);
			if (wordform == null)
				GetLastWordUsed();
			else
				SetWordToUse(wordform.Form.VernacularDefaultWritingSystem.Text);

			m_webPageInteractor = new WebPageInteractor(m_htmlControl, m_mediator, m_wordformTextBox);
#if !__MonoCS__
			m_htmlControl.Browser.ObjectForScripting = m_webPageInteractor;
#endif

			// HermitCrab does not currently support selected tracing
			/*if (m_cache.LangProject.MorphologicalDataOA.ActiveParser == "HC")
			{
				m_parserCanDoSelectMorphs = false;
				m_doSelectMorphsCheckBox.Enabled = false;
			}
*/
			// No such thing as FwApp.App now: if(FwApp.App != null) // Could be null during testing
			if (m_mediator.HelpTopicProvider != null) // trying this
			{
				m_helpProvider.HelpNamespace = m_mediator.HelpTopicProvider.HelpFile;
				m_helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(HelpTopicID));
				m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
			}

			if (m_parserListener.Connection != null)
			{
				m_parserListener.Connection.TryAWordDialogIsRunning = true;
				m_statusLabel.Text = GetString("ParserStatusPrefix") + ParserUIStrings.ksIdle_ + GetString("ParserStatusSuffix");
			}
			else
			{
				m_statusLabel.Text = ParserStoppedMessage();
			}
		}
コード例 #5
0
		private SimpleListChooser MakeChooserWithExtantMsas(IMoInflAffixSlot slot, XCore.Command cmd)
		{
			// Want the list of all lex entries which have an infl affix Msa
			// Do not want to list the infl affix Msas that are already assigned to the slot.
			var candidates = new HashSet<ICmObject>();
			bool fIsPrefixSlot = m_template.PrefixSlotsRS.Contains(slot);
			foreach (var lex in slot.OtherInflectionalAffixLexEntries)
			{
				bool fInclude = EntryHasAffixThatMightBeInSlot(lex, fIsPrefixSlot);
				if (fInclude)
				{
					foreach (var msa in lex.MorphoSyntaxAnalysesOC)
					{
						if (msa is IMoInflAffMsa)
						{
							candidates.Add(msa);
							break;
						}
					}
				}
			}
			var labels = ObjectLabel.CreateObjectLabels(Cache, candidates.OrderBy(iafmsa => iafmsa.Owner.ShortName), null);
			XCore.PersistenceProvider persistProvider = new PersistenceProvider(m_mediator.PropertyTable);
			var aiForceMultipleChoices = new ICmObject[0];
			var chooser = new SimpleListChooser(persistProvider, labels,
				m_ChooseInflectionalAffixHelpTopic, Cache, aiForceMultipleChoices,
				m_mediator.HelpTopicProvider);
			chooser.SetHelpTopic("khtpChoose-Grammar-InflAffixTemplateControl");
			chooser.SetFontForDialog(new int[] { Cache.DefaultVernWs, Cache.DefaultAnalWs }, StyleSheet, WritingSystemFactory);
			chooser.Cache = Cache;
			// We don't want the ()'s indicating optionality since the text spells it out.
			chooser.TextParam = slot.Name.AnalysisDefaultWritingSystem.Text;
			chooser.Title = m_sInflAffixChooserTitle;
			if (slot.Optional)
				chooser.InstructionalText = m_sInflAffixChooserInstructionalTextOpt;
			else
				chooser.InstructionalText = m_sInflAffixChooserInstructionalTextReq;
			chooser.AddLink(m_sInflAffix, SimpleListChooser.LinkType.kDialogLink,
				new MakeInflAffixEntryChooserCommand(Cache, true, m_sInflAffix, fIsPrefixSlot, slot, m_mediator));
			chooser.SetObjectAndFlid(slot.Hvo, slot.OwningFlid);
			string sGuiControl = XmlUtils.GetOptionalAttributeValue(cmd.ConfigurationNode, "guicontrol");
			if (!String.IsNullOrEmpty(sGuiControl))
			{
				chooser.ReplaceTreeView(m_mediator, sGuiControl);
			}
			return chooser;
		}
コード例 #6
0
ファイル: FilterBar.cs プロジェクト: sillsdev/WorldPad
		private ReallySimpleListChooser MakeChooser(ObjectLabelCollection labels, int[] oldTargets)
		{
			XCore.PersistenceProvider persistProvider =
				new PersistenceProvider(m_mediator.PropertyTable);
			if (m_leafFlid == 0)
				return new ReallySimpleListChooser(persistProvider,
								labels, "Items", m_cache, oldTargets);
			else
				return new LeafChooser(persistProvider,
								labels, "Items", m_cache, oldTargets, m_leafFlid);
		}
コード例 #7
0
ファイル: BulkEditBar.cs プロジェクト: sillsdev/WorldPad
		void m_launcher_Click(object sender, EventArgs e)
		{
			// Show a wait cursor (LT-4673)
			using (new SIL.FieldWorks.Common.Utils.WaitCursor(this.Control))
			{
				ICmPossibilityList list = CmPossibilityList.CreateFromDBObject(m_cache, m_hvoList);
				List<int> candidates = new List<int>(list.PossibilitiesOS.HvoArray);
				XCore.PersistenceProvider persistProvider =
					new PersistenceProvider(m_mediator.PropertyTable);
				ObjectLabelCollection labels = new ObjectLabelCollection(m_cache, candidates,
					m_displayNameProperty, m_displayWs);
				//m_cache.MetaDataCacheAccessor.GetFieldName((uint)m_flid, out fieldName);
				using (ReallySimpleListChooser chooser = new ReallySimpleListChooser(persistProvider,
					labels, m_fieldName, m_cache, m_chosenHvos))
				{
					chooser.Cache = m_cache;
					chooser.SetObjectAndFlid(0, m_flid);
					chooser.ShowFuncButtons();
					chooser.SetHelpTopic("khtpBulkEdit" + m_fieldName.Replace(" ", ""));
					System.Windows.Forms.DialogResult res = chooser.ShowDialog((sender as Control).TopLevelControl);
					if (System.Windows.Forms.DialogResult.Cancel == res)
						return;
					m_chosenHvos = chooser.ChosenHvos.ToArray();
					m_fReplace = chooser.ReplaceMode;
					m_fRemove = chooser.RemoveMode;

					// Tell the parent control that we may have changed the selected item so it can
					// enable or disable the Apply and Preview buttons based on the selection.
					// We are just checking here if any item was selected by the user in the dialog
					if (ValueChanged != null)
					{
						int itemCount = m_chosenHvos.Length;
						int hvo = 0;
						if (itemCount > 0)
							hvo = m_chosenHvos[0];
						ValueChanged(sender, new FwObjectSelectionEventArgs(hvo));
					}
				}
			}
		}
コード例 #8
0
ファイル: ParseWordDlg.cs プロジェクト: sillsdev/WorldPad
		/// <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);
		}
コード例 #9
0
ファイル: DataTree.cs プロジェクト: sillsdev/FieldWorks
		internal IRnGenericRec ChooseNewOwner(IRnGenericRec[] records, string sTitle)
		{

			var helpTopic = "khtpDataNotebook-ChooseOwnerOfDemotedRecord";
			XCore.PersistenceProvider persistProvider =
				new PersistenceProvider(m_mediator.PropertyTable);
			var labels = ObjectLabel.CreateObjectLabels(m_cache, records.Cast<ICmObject>(),
					"ShortName", m_cache.WritingSystemFactory.GetStrFromWs(m_cache.DefaultAnalWs));
			using (var dlg = new ReallySimpleListChooser(persistProvider, labels,
				String.Empty, m_mediator.HelpTopicProvider))
			{
				dlg.Text = sTitle;
				dlg.SetHelpTopic(helpTopic);
				if (dlg.ShowDialog() == DialogResult.OK)
					return dlg.SelectedObject as IRnGenericRec;
			}
			return null;
		}
コード例 #10
0
		private SimpleListChooser MakeChooserWithExtantSlots(bool fIsPrefixSlot)
		{
			int slotFlid;
			if (fIsPrefixSlot)
				slotFlid = (int)MoInflAffixTemplate.MoInflAffixTemplateTags.kflidPrefixSlots;
			else
				slotFlid = (int) MoInflAffixTemplate.MoInflAffixTemplateTags.kflidSuffixSlots;
			ObjectLabelCollection labels = new ObjectLabelCollection(
				Cache,
				m_template.ReferenceTargetCandidates(slotFlid),
				null);
			PersistenceProvider persistProvider =
				new PersistenceProvider(m_mediator.PropertyTable);
			SimpleListChooser chooser =
				new SimpleListChooser(persistProvider, labels, m_ChooseSlotHelpTopic);
			chooser.Cache = Cache;
			chooser.TextParamHvo = m_template.OwnerHVO;
			chooser.Title = m_sSlotChooserTitle;
			chooser.InstructionalText = m_sSlotChooserInstructionalText;
			string sTopPOS;
			int posHvo = GetHvoOfHighestPOS(m_template.OwnerHVO, out sTopPOS);
			string sLabel = String.Format(m_sObligatorySlot, sTopPOS);
			chooser.AddLink(sLabel, SimpleListChooser.LinkType.kSimpleLink,
				new MakeInflAffixSlotChooserCommand(Cache, true, sLabel, posHvo,
				false, m_mediator));
			sLabel = String.Format(m_sOptionalSlot, sTopPOS);
			chooser.AddLink(sLabel, SimpleListChooser.LinkType.kSimpleLink,
				new MakeInflAffixSlotChooserCommand(Cache, true, sLabel, posHvo, true,
				m_mediator));
			chooser.SetObjectAndFlid(posHvo, (int)FDO.Ling.MoInflAffixTemplate.MoInflAffixTemplateTags.kflidSlots);
			return chooser;
		}