当前位置: 首页>>代码示例>>C#>>正文


C# List.Contains方法代码示例

本文整理汇总了C#中XCore.List.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# List.Contains方法的具体用法?C# List.Contains怎么用?C# List.Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XCore.List的用法示例。


在下文中一共展示了List.Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FileEncodingsAreValid

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Check to make sure all of the file encodings are valid for importing.
		/// </summary>
		/// <returns><c>true</c> if all files have valid encodings<c>false</c> otherwise</returns>
		/// ------------------------------------------------------------------------------------
		public bool FileEncodingsAreValid()
		{
			CheckDisposed();

			if (ScrListView.Items.Count == 0)
				return false;

			// Verify that the files all have supported encodings
			List<Encoding> supportedEncodings = new List<Encoding>(4);
			supportedEncodings.Add(Encoding.ASCII);
			supportedEncodings.Add(Encoding.UTF8);
			supportedEncodings.Add(Encoding.BigEndianUnicode);
			supportedEncodings.Add(Encoding.Unicode);

			foreach (ListView lv in new ListView[] {ScrListView, BtListView, NotesListView})
			{
				foreach(ListViewItem lvi in lv.Items)
				{
					ScrImportFileInfo fileInfo = (ScrImportFileInfo)lvi.Tag;

					if (fileInfo.IsReadable && !supportedEncodings.Contains(fileInfo.FileEncoding))
					{
						string message = string.Format(TeResourceHelper.GetResourceString("kstidUnsupportedEncoding"),
							fileInfo.FileName, fileInfo.FileEncoding.EncodingName);

						DisplayMessageBox(message);
						return false;
					}
				}
			}
			return true;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:38,代码来源:SFFileListBuilder.cs

示例2: OnAddApprovedAnalysis

		/// <summary>
		///
		/// </summary>
		/// <param name="argument">The xCore Command object.</param>
		/// <returns>true</returns>
		public bool OnAddApprovedAnalysis(object argument)
		{
			var mainWnd = (FwXWindow)m_dataEntryForm.FindForm();
			using (EditMorphBreaksDlg dlg = new EditMorphBreaksDlg(mainWnd.Mediator.HelpTopicProvider))
			{
				IWfiWordform wf = Wordform;
				if (wf == null)
					return true;
				ITsString tssWord = Wordform.Form.BestVernacularAlternative;
				string morphs = tssWord.Text;
				var cache = Cache;
				dlg.Initialize(tssWord, morphs, cache.MainCacheAccessor.WritingSystemFactory,
					cache, m_dataEntryForm.Mediator.StringTbl, m_dataEntryForm.StyleSheet);
				// Making the form active fixes problems like LT-2619.
				// I'm (RandyR) not sure what adverse impact might show up by doing this.
				mainWnd.Activate();
				if (dlg.ShowDialog(mainWnd) == DialogResult.OK)
				{
					morphs = dlg.GetMorphs().Trim();
					if (morphs.Length == 0)
						return true;

					string[] prefixMarkers = MorphServices.PrefixMarkers(cache);
					string[] postfixMarkers = MorphServices.PostfixMarkers(cache);

					List<string> allMarkers = new List<string>();
					foreach (string s in prefixMarkers)
					{
						allMarkers.Add(s);
					}

					foreach (string s in postfixMarkers)
					{
						if (!allMarkers.Contains(s))
							allMarkers.Add(s);
					}
					allMarkers.Add(" ");

					string[] breakMarkers = new string[allMarkers.Count];
					for (int i = 0; i < allMarkers.Count; ++i)
						breakMarkers[i] = allMarkers[i];

					string fullForm = SandboxBase.MorphemeBreaker.DoBasicFinding(morphs, breakMarkers, prefixMarkers, postfixMarkers);

					var command = (Command) argument;
					UndoableUnitOfWorkHelper.Do(command.UndoText, command.RedoText, cache.ActionHandlerAccessor,
						() =>
							{
								IWfiAnalysis newAnalysis = Cache.ServiceLocator.GetInstance<IWfiAnalysisFactory>().Create();
								Wordform.AnalysesOC.Add(newAnalysis);
								newAnalysis.ApprovalStatusIcon = 1; // Make it human approved.
								int vernWS = TsStringUtils.GetWsAtOffset(tssWord, 0);
								foreach (string morph in fullForm.Split(Unicode.SpaceChars))
								{
									if (morph != null && morph.Length != 0)
									{
										IWfiMorphBundle mb = cache.ServiceLocator.GetInstance<IWfiMorphBundleFactory>().Create();
										newAnalysis.MorphBundlesOS.Add(mb);
										mb.Form.set_String(vernWS, Cache.TsStrFactory.MakeString(morph, vernWS));
									}
								}
							});
				}
			}
			return true;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:71,代码来源:MorphologyListener.cs

示例3: m_btnDuplicate_Click

		private void m_btnDuplicate_Click(object sender, EventArgs e)
		{
			Debug.Assert(m_current.Level > 0);
			StoreNodeData();	// Ensure duplicate has current data.
			LayoutTreeNode ltnDup = (LayoutTreeNode)m_current.Clone();
			ltnDup.IsDuplicate = true;
			// Generate a unique label to identify this as the n'th duplicate in the list.
			List<string> rgsLabels = new List<string>();
			string sBaseLabel = null;
			for (int i = 0; i < m_current.Parent.Nodes.Count; ++i)
			{
				LayoutTreeNode ltn = (LayoutTreeNode)m_current.Parent.Nodes[i];
				if (ltn.Configuration == m_current.Configuration &&
					ltn.LayoutName == m_current.LayoutName &&
					ltn.PartName == m_current.PartName)
				{
					rgsLabels.Add(ltn.Label);
					if (!ltn.IsDuplicate)
						sBaseLabel = ltn.Label;
				}
			}
			if (sBaseLabel == null)
				sBaseLabel = m_current.Label;
			int cDup = 1;
			string sLabel = String.Format("{0} ({1})", sBaseLabel, cDup);
			while (rgsLabels.Contains(sLabel))
			{
				++cDup;
				sLabel = String.Format("{0} ({1})", sBaseLabel, cDup);
			}
			ltnDup.Label = sLabel;		// sets Text as well.
			string sDup = ltnDup.DupString;
			if (String.IsNullOrEmpty(sDup))
				sDup = cDup.ToString();
			else
				sDup = String.Format("{0}-{1}", sDup, cDup);
			ltnDup.DupString = sDup;
			int idx = m_current.Index;
			m_current.Parent.Nodes.Insert(idx + 1, ltnDup);
			m_tvParts.SelectedNode = ltnDup;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:41,代码来源:XmlDocConfigureDlg.cs

示例4: AddItem

		public override void AddItem(int hvoNew)
		{
			CheckDisposed();

			List<int> lexemes = new List<int>();
			ILexEntryRef ler = m_obj as ILexEntryRef;
			if (m_flid == (int)LexEntryRef.LexEntryRefTags.kflidComponentLexemes)
				lexemes.AddRange(ler.ComponentLexemesRS.HvoArray);
			else if (m_flid == (int)LexEntryRef.LexEntryRefTags.kflidPrimaryLexemes)
				lexemes.AddRange(ler.PrimaryLexemesRS.HvoArray);
			// don't add a duplicate items.
			if (!lexemes.Contains(hvoNew))
			{
				lexemes.Add(hvoNew);
				SetItems(lexemes);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:17,代码来源:EntrySequenceReferenceLauncher.cs

示例5: ComputeValue

		protected virtual void ComputeValue(List<ICmObject> chosenObjs, int hvoItem, out List<ICmObject> oldVals, out List<ICmObject> newVal)
		{
			int hvoReal;
			// Check whether we can actually compute values for this item.  If not,
			// just return a pair of empty lists.  (See LT-11016 and LT-11357.)
			if (!CanActuallyComputeValuesFor(hvoItem, out hvoReal))
			{
				oldVals = new List<ICmObject>();
				newVal = oldVals;
				return;
			}

			oldVals = GetOldVals(hvoReal);
			newVal = chosenObjs;

			if (m_fRemove)
			{
				newVal = oldVals; // by default no change in remove mode.
				if (oldVals.Count > 0)
				{
					var newValues = new List<ICmObject>(oldVals);
					foreach (ICmObject obj in chosenObjs)
					{
						if (newValues.Contains(obj))
							newValues.Remove(obj);
					}
					newVal = newValues;
				}
			}
			else if (!m_fReplace && oldVals.Count != 0)
			{
				// Need to handle as append.
				if (Atomic)
					newVal = oldVals; // can't append to non-empty atomic value
				else
				{
					var newValues = new List<ICmObject>(oldVals);
					foreach (ICmObject obj in chosenObjs)
					{
						if (!newValues.Contains(obj))
							newValues.Add(obj);
					}
					newVal = newValues;
				}
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:46,代码来源:BulkEditBar.cs

示例6: LoadCheckingErrors

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Loads into the grid, the checking errors for the specified checks.
		/// </summary>
		/// <param name="selectedCheckIds">The list of checkIds for which to show results.
		/// When this is null, results for all the checks are shown.</param>
		/// ------------------------------------------------------------------------------------
		public void LoadCheckingErrors(List<Guid> selectedCheckIds)
		{
			m_list.Clear();

			// Unsubscribe so we don't get reference changed events (which happens in the
			// grid's RowEnter event delegate) while we are loading the grid.
			m_dataGridView.RowEnter -= m_dataGridView_RowEnter;
			m_dataGridView.RowCount = 0;
			m_dataGridView.ResetFonts();
			m_dataGridView.IsStale = false;

			if (m_BookFilter == null || m_BookFilter.BookIds == null)
				return;

			m_cache.LoadAllOfAnOwningVectorProp(
				(int)ScrBookAnnotations.ScrBookAnnotationsTags.kflidNotes, "ScrScriptureNote", true);

			m_cache.LoadAllOfAnOwningAtomicProp(
				(int)ScrScriptureNote.ScrScriptureNoteTags.kflidQuote, "StJournalText");

			m_cache.LoadAllOfAnOwningAtomicProp(
				(int)ScrScriptureNote.ScrScriptureNoteTags.kflidDiscussion, "StJournalText");

			m_cache.LoadAllOfAnIntProp(
				(int)ScrScriptureNote.ScrScriptureNoteTags.kflidResolutionStatus);

			m_cache.LoadAllOfAnIntProp(
				(int)ScrScriptureNote.CmBaseAnnotationTags.kflidBeginRef);

			// ENHANCE: get end ref. when we deal with it in the checking error class.
			//m_cache.LoadAllOfAnIntProp(
			//	(int)ScrScriptureNote.CmBaseAnnotationTags.kflidEndRef);

			m_cache.LoadAllOfAnIntProp(
				(int)ScrScriptureNote.CmAnnotationTags.kflidAnnotationType);

			m_cache.LoadAllOfAnOwningVectorProp(
				(int)StJournalText.StTextTags.kflidParagraphs, "StPara", true);

			FdoOwningSequence<IScrBookAnnotations> booksAnnotations =
				m_cache.LangProject.TranslatedScriptureOA.BookAnnotationsOS;

			foreach (int bookId in m_BookFilter.BookIds)
			{
				IScrBookAnnotations annotations = booksAnnotations[bookId - 1];
				for (int i = annotations.NotesOS.HvoArray.Length - 1; i >= 0; i--)
				{
					int hvoNote = annotations.NotesOS.HvoArray[i];
					CheckingError error = CheckingError.Create(m_cache, hvoNote, false, false);
					if (error != null && (selectedCheckIds == null || selectedCheckIds.Count == 0 ||
						selectedCheckIds.Contains(error.AnnotationTypeRA.Guid)))
					{
						if (error.Status == (int)CheckingStatus.StatusEnum.Irrelevant)
							error.DeleteUnderlyingObject();
						else
							m_list.Add(error);
					}
				}
			}

			m_dataGridView.RowCount = m_list.Count;
			m_dataGridView.CheckingErrors = m_list;
			m_dataGridView.StyleSheet = StyleSheet;
			m_dataGridView.TMAdapter = TMAdapter;
			Sort(m_sortedColumn, false, kRefCol);

			m_prevResultRow = -1;

			if (m_persistence != null)
				OnLoadSettings(m_persistence.SettingsKey);

			m_dataGridView.RowEnter += m_dataGridView_RowEnter;

			if (m_dataGridView.RowCount > 0)
			{
				m_dataGridView.CurrentCell = m_dataGridView[0, 0];

				// Do this in case the current row didn't change by setting the current cell.
				m_dataGridView_RowEnter(this, new DataGridViewCellEventArgs(0, 0));
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:88,代码来源:EditorialChecksRenderingsControl.cs

示例7: GetCurrentThenRemainingActiveWss

		/// <summary>
		/// gets a list of ws hvos, starting with the current wss, followed by remaining (non-current) active ones
		/// </summary>
		/// <param name="currentWss"></param>
		/// <param name="activeWss"></param>
		/// <param name="fAddOnlyCurrent">if true, only add the current wss, ignoring remaining active wss.</param>
		/// <returns></returns>
		internal static List<int> GetCurrentThenRemainingActiveWss(FdoReferenceSequence<ILgWritingSystem> currentWss,
			FdoReferenceCollection<ILgWritingSystem> activeWss, bool fAddOnlyCurrent)
		{
			List<int> hvoWss = new List<int>();
			// Add ordered (checked) writing system names to the list.
			foreach (ILgWritingSystem ws in currentWss)
				hvoWss.Add(ws.Hvo);
			if (fAddOnlyCurrent)
				return hvoWss;	// finished adding current wss, so return;
			// Now add the unchecked (or not current) writing systems to the list.
			foreach (ILgWritingSystem ws in activeWss)
			{
				if (!hvoWss.Contains(ws.Hvo))
					hvoWss.Add(ws.Hvo);
			}
			return hvoWss;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:24,代码来源:LabeledMultiStringView.cs

示例8: OnAddApprovedAnalysis

		/// <summary>
		///
		/// </summary>
		/// <param name="argument">The xCore Command object.</param>
		/// <returns>true</returns>
		public bool OnAddApprovedAnalysis(object argument)
		{
			using (EditMorphBreaksDlg dlg = new EditMorphBreaksDlg())
			{
				IWfiWordform wf = Wordform;
				if (wf == null)
					return true;
				ITsString tssWord = Wordform.Form.BestVernacularAlternative;
				string morphs = tssWord.Text;
				FdoCache cache = Cache;
				dlg.Initialize(tssWord, morphs, cache.MainCacheAccessor.WritingSystemFactory,
					cache, m_dataEntryForm.Mediator.StringTbl, m_dataEntryForm.StyleSheet);
				Form mainWnd = m_dataEntryForm.FindForm();
				// Making the form active fixes problems like LT-2619.
				// I'm (RandyR) not sure what adverse impact might show up by doing this.
				mainWnd.Activate();
				if (dlg.ShowDialog(mainWnd) == DialogResult.OK)
				{
					morphs = dlg.GetMorphs().Trim();
					if (morphs.Length == 0)
						return true;

					string[] prefixMarkers = MoMorphType.PrefixMarkers(cache);
					string[] postfixMarkers = MoMorphType.PostfixMarkers(cache);

					List<string> allMarkers = new List<string>();
					foreach (string s in prefixMarkers)
					{
						allMarkers.Add(s);
					}

					foreach (string s in postfixMarkers)
					{
						if (!allMarkers.Contains(s))
							allMarkers.Add(s);
					}
					allMarkers.Add(" ");

					string[] breakMarkers = new string[allMarkers.Count];
					for (int i = 0; i < allMarkers.Count; ++i)
						breakMarkers[i] = allMarkers[i];

					string fullForm = SandboxBase.MorphemeBreaker.DoBasicFinding(morphs, breakMarkers, prefixMarkers, postfixMarkers);

					using (UndoRedoCommandHelper undoRedoTask = new UndoRedoCommandHelper(Cache,
						argument as Command))
					{
						IWfiAnalysis newAnalysis = Wordform.AnalysesOC.Add(new WfiAnalysis());
						newAnalysis.ApprovalStatusIcon = 1; // Make it human approved.
						int vernWS = StringUtils.GetWsAtOffset(tssWord, 0);
						foreach (string morph in fullForm.Split(Unicode.SpaceChars))
						{
							if (morph != null && morph.Length != 0)
							{
								IWfiMorphBundle mb = newAnalysis.MorphBundlesOS.Append(new WfiMorphBundle());
								mb.Form.SetAlternative(morph, vernWS);
							}
						}
						int outlineFlid = BaseVirtualHandler.GetInstalledHandlerTag(cache, "WfiAnalysis", "HumanApprovedNumber");
						foreach (int haaHvo in Wordform.HumanApprovedAnalyses)
						{
							// Do PropChanged for the outline number for all of them.
							// This fixes LT-5007, as the older ones kept their old number,
							// which could have been a duplicate number.
							cache.PropChanged(
								null,
								PropChangeType.kpctNotifyAll,
								haaHvo,
								outlineFlid,
								0, 0, 0);
						}
						cache.PropChanged(
							null,
							PropChangeType.kpctNotifyAll,
							Wordform.Hvo,
							BaseVirtualHandler.GetInstalledHandlerTag(cache, "WfiWordform", "HumanApprovedAnalyses"),
							0, 1, 0);
					}
				}
			}

			return true;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:88,代码来源:MorphologyListener.cs

示例9: ComputeValue

		private void ComputeValue(int[] chosenHvos, int hvoItem, out int[] oldVals, out int[] newVal)
		{
			oldVals = m_cache.GetVectorProperty(hvoItem, m_flid, true);
			newVal = chosenHvos;
			if (m_fRemove)
			{
				newVal = oldVals; // by default no change in remove mode.
				if (oldVals.Length > 0)
				{
					List<int> newValues = new List<int>(oldVals);
					foreach (int hvo in chosenHvos)
					{
						if (newValues.Contains(hvo))
							newValues.Remove(hvo);
					}
					newVal = newValues.ToArray();
				}
			}
			else if (!m_fReplace && oldVals.Length != 0)
			{
				// Need to handle as append.
				List<int> newValues = new List<int>(oldVals);
				foreach (int hvo in chosenHvos)
				{
					if (!newValues.Contains(hvo))
						newValues.Add(hvo);
				}
				newVal = newValues.ToArray();
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:30,代码来源:BulkEditBar.cs

示例10: OnReferenceChanged

		/// <summary>
		/// Handle interaction between POS and Slot ptoeprties for a inflectional affix MSA.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		/// <remarks>
		/// If the new value is zero, then set the Slot prop to zero.
		/// If the new value is not zero, then make sure the Slot prop is valid.
		///		If the current slot is not legal for the new POS value, then set it to zero.
		///		Otherwise leave the slot value alone.
		/// </remarks>
		protected void OnReferenceChanged(object sender, SIL.FieldWorks.Common.Utils.FwObjectSelectionEventArgs e)
		{
			Debug.Assert(sender is AtomicReferenceLauncher);
			AtomicReferenceLauncher source = (AtomicReferenceLauncher)sender;
			Debug.Assert(Control == source);
			Debug.Assert(Object is MoInflAffMsa);

			int idxSender = Parent.Controls.IndexOf(this);

			int otherFlid = (int)MoInflAffMsa.MoInflAffMsaTags.kflidSlots;
			Slice otherSlice = null;
			int idxOther;

			// Try to get the Slots slice.
			// Check for slices before this one.
			if (idxSender > 0)
			{
				idxOther = idxSender - 1;
				while (idxOther >= 0
					&& (otherSlice == null
						|| (otherSlice.Indent == Indent && idxOther > 0 && otherSlice.Object == Object)))
				{
					otherSlice = (Slice)Parent.Controls[idxOther--];
					if (otherSlice is ReferenceVectorSlice && (otherSlice as ReferenceVectorSlice).Flid == otherFlid)
						break;
					otherSlice = null;
				}
			}

			// Check for following slices, if we didn't get one earlier.
			if (otherSlice == null && idxSender < Parent.Controls.Count)
			{
				idxOther = idxSender + 1;
				while (idxOther < Parent.Controls.Count
					&& (otherSlice == null
						|| (otherSlice.Indent == Indent && idxOther > 0 && otherSlice.Object == Object)))
				{
					otherSlice = (Slice)Parent.Controls[idxOther++];
					if (otherSlice is ReferenceVectorSlice && (otherSlice as ReferenceVectorSlice).Flid == otherFlid)
						break;
					otherSlice = null;
				}
			}

			VectorReferenceLauncher otherControl = null;
			if (otherSlice != null)
			{
				Debug.Assert((otherSlice as ReferenceVectorSlice).Flid == otherFlid);
				Debug.Assert(otherSlice.Object == Object);
				otherControl = otherSlice.Control as VectorReferenceLauncher;
				Debug.Assert(otherControl != null);
			}

			MoInflAffMsa msa = Object as MoInflAffMsa;
			int slotHvo = 0;
			if (msa.SlotsRC.Count > 0)
			{
				int[] hvos = msa.SlotsRC.HvoArray;
				slotHvo = hvos[0];
			}
			if (e.Hvo == 0 || slotHvo > 0)
			{
				IPartOfSpeech pos = msa.PartOfSpeechRA;
				List<int> slotIDs = new List<int>();
				if (pos != null)
					slotIDs = pos.AllAffixSlotIDs;
				bool clearSlot = (   (e.Hvo == 0)
								  || (!slotIDs.Contains(slotHvo)));
				if (clearSlot)
				{
					if (otherControl == null)
						msa.ClearAllSlots(); // The slot slice is not showing, so directly set the object's Slot property.
					else
						otherControl.AddItem(0); // Reset it using the other slice, so it gets refreshed.
				}
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:88,代码来源:InflMSAReferenceSlice.cs

示例11: SetupDlg

		/// <summary>
		/// This method assumes all of the Find and UsedBy items are included in the fcfList.
		/// </summary>
		/// <param name="mediator"></param>
		/// <param name="fcfList"></param>
		/// <param name="startingItem"></param>
		internal void SetupDlg(Mediator mediator, List<FindComboFillerBase> fcfList, FindComboFillerBase startingItem)
		{
			if (mediator == null)
				throw new ArgumentException("No Mediator.");
			if (fcfList == null)
				throw new ArgumentException("No items found.");
			if (fcfList.Count < 1)
				throw new ArgumentException("There has to be at least one item.");
			foreach (FindComboFillerBase fcf in fcfList)
			{
				if (fcf.List_UBF.Count == 0)
					throw new ArgumentException("No sub-items found.");
			}
			if (startingItem != null && !fcfList.Contains(startingItem))
				throw new ArgumentException("'startingItem' is not in the 'fcfList' list.");

			m_mediator = mediator;
			m_cbFind.BeginUpdate();
			m_cbFind.Items.Clear();
			m_cbFind.Items.AddRange(fcfList.ToArray());
			m_cbFind.EndUpdate();
			m_cbFind.SelectedItem = startingItem;
			m_mediator.BroadcastPendingItems();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:30,代码来源:ConcorderControl.cs

示例12: GetMergeinfo

		protected override DummyCmObject GetMergeinfo(WindowParams wp, List<DummyCmObject> mergeCandidates, out string guiControl, out string helpTopic)
		{
			wp.m_title = FdoUiStrings.ksMergeSense;
			wp.m_label = FdoUiStrings.ksSenses;

			ILexEntry le = (Object as LexSense).Entry;
			// Exclude subsenses of the chosen sense.  See LT-6107.
			List<int> rghvoExclude = new List<int>();
			foreach (ILexSense ls in (Object as ILexSense).AllSenses)
				rghvoExclude.Add(ls.Hvo);
			foreach (ILexSense sense in le.AllSenses)
			{
				if (sense.Hvo != Object.Hvo && !rghvoExclude.Contains(sense.Hvo))
				{
					mergeCandidates.Add(
						new DummyCmObject(
						sense.Hvo,
						sense.ShortName,
						m_cache.LangProject.DefaultAnalysisWritingSystem));
				}
			}
			guiControl = "MergeSenseList";
			helpTopic = "khtpMergeSense";
			return new DummyCmObject(m_hvo, Object.ShortName, m_cache.LangProject.DefaultAnalysisWritingSystem);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:25,代码来源:FdoUiCore.cs

示例13: GetModifiedLayouts

			internal bool GetModifiedLayouts(List<XmlNode> rgxn, List<LayoutTreeNode> topNodes)
			{
				List<XmlNode> rgxnDirtyLayouts = new List<XmlNode>();
				for (int i = 0; i < Nodes.Count; ++i)
				{
					LayoutTreeNode ltn = (LayoutTreeNode)Nodes[i];
					if (ltn.GetModifiedLayouts(rgxn, topNodes))
					{
						XmlNode xn = ltn.ParentLayout;
						if (xn != null && !rgxnDirtyLayouts.Contains(xn))
							rgxnDirtyLayouts.Add(xn);
						xn = ltn.HiddenChildLayout;
						if (xn != null && ltn.HiddenChildDirty && !rgxnDirtyLayouts.Contains(xn))
							rgxnDirtyLayouts.Add(xn);
						xn = ltn.m_xnHiddenParentLayout;
						if (xn != null && ltn.HasMoved && !rgxnDirtyLayouts.Contains(xn))
							rgxnDirtyLayouts.Add(xn);
						foreach (LayoutTreeNode ltnMerged in ltn.MergedNodes)
						{
							xn = ltnMerged.ParentLayout;
							if (xn != null && !rgxnDirtyLayouts.Contains(xn))
								rgxnDirtyLayouts.Add(xn);
						}
					}
				}
				var fDirty = IsDirty();
				if (Level == 0 && !rgxnDirtyLayouts.Contains(m_xnParentLayout))
				{
					if (OverallLayoutVisibilityChanged())
					{
						rgxnDirtyLayouts.Add(m_xnParentLayout);
					}
					else if (!IsTopLevel && fDirty)
					{
						rgxnDirtyLayouts.Add(m_xnParentLayout);
					}
				}
				foreach (XmlNode xnDirtyLayout in rgxnDirtyLayouts)
				{
					// Create a new layout node with all its parts in order.  This is needed
					// to handle arbitrary reordering and possible addition or deletion of
					// duplicate nodes.  This is complicated by the presence (or rather absence)
					// of "hidden" nodes, and by "merged" nodes.
					XmlNode xnLayout = xnDirtyLayout.Clone();
					if (xnDirtyLayout == m_xnParentLayout && IsTopLevel && OverallLayoutVisibilityChanged())
						UpdateAttribute(xnLayout, "visibility", Checked ? "always" : "never");
					if (xnLayout.Attributes != null)
					{
						XmlAttribute[] rgxa = new XmlAttribute[xnLayout.Attributes.Count];
						xnLayout.Attributes.CopyTo(rgxa, 0);
						List<XmlNode> rgxnGen = new List<XmlNode>();
						List<int> rgixn = new List<int>();
						for (int i = 0; i < xnLayout.ChildNodes.Count; ++i)
						{
							XmlNode xn = xnLayout.ChildNodes[i];
							if (xn.Name != "part")
							{
								rgxnGen.Add(xn);
								rgixn.Add(i);
							}
						}
						xnLayout.RemoveAll();
						for (int i = 0; i < rgxa.Length; ++i)
						{
							if (xnLayout.Attributes != null)
								xnLayout.Attributes.SetNamedItem(rgxa[i]);
						}
						if (Level == 0 && !IsTopLevel && xnDirtyLayout == m_xnParentLayout)
						{
							foreach (var ltn in topNodes)
							{
								if (ltn.IsTopLevel || ltn.ParentLayout != xnDirtyLayout)
									continue;
								if (fDirty && ltn == this)
									ltn.StoreUpdatedValuesInConfiguration();
								xnLayout.AppendChild(ltn.Configuration.CloneNode(true));
							}
						}
						else
						{
							for (int i = 0; i < Nodes.Count; ++i)
							{
								LayoutTreeNode ltn = (LayoutTreeNode) Nodes[i];
								if (ltn.ParentLayout == xnDirtyLayout)
								{
									xnLayout.AppendChild(ltn.Configuration.CloneNode(true));
								}
								else if (ltn.HiddenNodeLayout == xnDirtyLayout)
								{
									var xpathString = "/" + ltn.HiddenNode.Name + "[" +
													  BuildXPathFromAttributes(ltn.HiddenNode.Attributes) + "]";
									if (xnLayout.SelectSingleNode(xpathString) == null)
										xnLayout.AppendChild(ltn.HiddenNode.CloneNode(true));
								}
								else if (ltn.HiddenChildLayout == xnDirtyLayout)
								{
									var xpathString = "/" + ltn.HiddenNode.Name + "[" +
													  BuildXPathFromAttributes(ltn.HiddenChild.Attributes) + "]";
									if (xnLayout.SelectSingleNode(xpathString) == null)
										xnLayout.AppendChild(ltn.HiddenChild.CloneNode(true));
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:XmlDocConfigureDlg.cs

示例14: OnDuplicateClick

		private void OnDuplicateClick(object sender, EventArgs e)
		{
			Debug.Assert(!m_current.IsTopLevel);
			StoreNodeData(m_current);	// Ensure duplicate has current data.
			LayoutTreeNode ltnDup;

			// Generate a unique label to identify this as the n'th duplicate in the list.
			var rgsLabels = new List<string>();
			string sBaseLabel = null;
			if (m_current.Level == 0)
			{
				var nodes = ((LayoutTypeComboItem)m_cbDictType.SelectedItem).TreeNodes;
				sBaseLabel = GetBaseLabel(nodes, rgsLabels);
			}
			else
			{
				sBaseLabel = GetBaseLabel(m_current.Parent.Nodes, rgsLabels);
			}
			if (sBaseLabel == null)
				sBaseLabel = m_current.Label;
			var cDup = 1;
			var sLabel = String.Format("{0} ({1})", sBaseLabel, cDup);
			while (rgsLabels.Contains(sLabel))
			{
				++cDup;
				sLabel = String.Format("{0} ({1})", sBaseLabel, cDup);
			}
			if (String.IsNullOrEmpty(m_current.Param))
			{
				Debug.Assert(m_current.Nodes.Count == 0);
				ltnDup = m_current.CreateCopy();
			}
			else
			{
				ltnDup = DuplicateLayoutSubtree(cDup);
				if (ltnDup == null)
					return;
			}
			ltnDup.Label = sLabel;		// sets Text as well.
			var sDup = ltnDup.DupString;
			sDup = String.IsNullOrEmpty(sDup) ? cDup.ToString() : String.Format("{0}-{1}", sDup, cDup);
			ltnDup.DupString = sDup;
			if (m_current.Level == 0)
			{
				var nodes = ((LayoutTypeComboItem)m_cbDictType.SelectedItem).TreeNodes;
				var idx = nodes.IndexOf(m_current);
				nodes.Insert(idx + 1, ltnDup);
				m_tvParts.Nodes.Insert(idx + 1, ltnDup);
			}
			else
			{
				var idx = m_current.Index;
				m_current.Parent.Nodes.Insert(idx + 1, ltnDup);
			}
			ltnDup.Checked = m_current.Checked; // remember this before m_current changes
			m_tvParts.SelectedNode = ltnDup;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:57,代码来源:XmlDocConfigureDlg.cs

示例15: MoveToNextPane

		/// <summary>
		/// Move focus to next/previous pane.
		/// 'Pane' here means:
		/// 1. the Sidebar (m_sidebar),
		/// 2. the record list, (if showing at all, m_recordBar),
		/// 3. the first or second control of a MultiPane, or a parent MultiPane.
		/// 4. the main content control, if is not a MultiPane, or 'focusedControl'
		/// is not contained in a MultiPane.
		/// </summary>
		/// <param name="fForward"></param>
		/// <returns>control in pane that got the focus.</returns>
		private Control MoveToNextPane(bool fForward)
		{
			Control focusedControl = FocusedControl();

			if (focusedControl == this)
				return null;

			Control indexControl = null;
			// We can make a complete collection of candidates here.
			// In all cases, we add m_sidebar, since it is always showing.
			// We may want to include m_recordBar, if it is also showing.
			// We then want one or more controls from the m_mainContentControl.
			// (Note: m_mainContentPlaceholderPanel will be replaced by m_mainContentControl in normal operations,
			// but is is theoretically possible it is a current option.)
			List<Control> targetCandidates = new List<Control>();
			// The m_sidebar is currently always showing (as of Jan 11, 2007),
			// but it may not be in the future, so add it is it is showing.
			if (m_mainSplitContainer.Panel1.Controls[0] == m_sidebar)
			{
				if (m_sidebar.ContainsFocus)
				{
					targetCandidates.Add(focusedControl);
					indexControl = focusedControl;
				}
				else
				{
					Control target = m_sidebar;
					foreach (Control child in m_sidebar.Controls)
					{
						if (child.Controls.Count > 0)
						{
							Control innerChild = child.Controls[0];
							if (innerChild is ListView)
							{
								if ((innerChild as ListView).SelectedItems.Count > 0)
								{
									target = innerChild;
									break;
								}
							}
						}
					}
					targetCandidates.Add(target);
				}
			}
			if (!m_secondarySplitContainer.Panel1Collapsed
				&& m_secondarySplitContainer.Panel1.Controls[0] == m_recordBar)
			{
				if (m_recordBar.ContainsFocus)
				{
					targetCandidates.Add(focusedControl);
					indexControl = focusedControl;
				}
				else
				{
					// It looks like the record list can deal with waht is selected,
					// so just toss in the whole thing.
					targetCandidates.Add(m_recordBar);
				}
			}

			if (!m_secondarySplitContainer.Panel2Collapsed
				&& m_secondarySplitContainer.Panel2.Controls[0] == m_mainContentControl)
			{
				// Now deal with the m_mainContentControl side of things.
				Control otherControl = (m_mainContentControl as IxCoreCtrlTabProvider).PopulateCtrlTabTargetCandidateList(targetCandidates);
				if (otherControl != null)
				{
					Debug.Assert(indexControl == null, "indexCntrol should have been null.");
					indexControl = otherControl;
				}
			}
			Debug.Assert(indexControl != null, "Couldn't find the focused control anywhere.");
			Debug.Assert(targetCandidates.Contains(indexControl));
			int srcIndex = targetCandidates.IndexOf(indexControl);
			int targetIndex = 0;
			if (fForward)
			{
				targetIndex = srcIndex + 1 < targetCandidates.Count ? srcIndex + 1 : 0;
			}
			else
			{
				targetIndex = srcIndex > 0 ? srcIndex - 1 : targetCandidates.Count - 1;
			}

			Control newFocusedControl = targetCandidates[targetIndex];
			newFocusedControl.Focus(); // Note: may result in Focusing in a subcontrol.
			return newFocusedControl;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:100,代码来源:xWindow.cs


注:本文中的XCore.List.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。