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


C# List.Remove方法代码示例

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


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

示例1: OnMasterRefresh

        /// <summary>
        /// This is the one (and should be only) handler for the user Refresh command.
        /// Refresh wants to first clean up the cache, then give things like Clerks a
        /// chance to reload stuff (calling the old OnRefresh methods), then give
        /// windows a chance to redisplay themselves.
        /// </summary>
        public void OnMasterRefresh(object sender)
        {
            // TODO: This is no longer called by the Mediator, since this class
            // is no longer an xcore colleague. But, it can't be removed either,
            // since it is used by another method on this clsss. :-(
            CheckDisposed();

            // Susanna asked that refresh affect only the currently active project, which is
            // what the string and List variables below attempt to handle.  See LT-6444.
            FwXWindow activeWnd = ActiveForm as FwXWindow;

            List<FwXWindow> rgxw = new List<FwXWindow>();
            foreach (IFwMainWnd wnd in MainWindows)
            {
                FwXWindow xwnd = wnd as FwXWindow;
                if (xwnd != null)
                {
                    xwnd.PrepareToRefresh();
                    rgxw.Add(xwnd);
                }
            }
            if (activeWnd != null)
                rgxw.Remove(activeWnd);

            foreach (FwXWindow xwnd in rgxw)
            {
                xwnd.FinishRefresh();
                xwnd.Refresh();
            }

            // LT-3963: active window changes as a result of a refresh.
            // Make sure focus doesn't switch to another FLEx application / window also
            // make sure the application focus isn't lost all together.
            // ALSO, after doing a refresh with just a single application / window,
            // the application would loose focus and you'd have to click into it to
            // get that back, this will reset that too.
            if (activeWnd != null)
            {
                // Refresh it last, so its saved settings get restored.
                activeWnd.FinishRefresh();
                activeWnd.Refresh();
                activeWnd.Activate();
            }
        }
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:50,代码来源:FwXApp.cs

示例2: SetItems

		/// <summary>
		/// Overridden to set the new values selected from the chooser dialog.
		/// </summary>
		/// <param name="rghvosChosen"></param>
		public override void SetItems(List<int> rghvosChosen)
		{
			CheckDisposed();
			m_phoneEnvRefView.Commit();
			// null indicates that we cancelled out of the chooser dialog -- we shouldn't get
			// here with that value, but just in case...
			if (rghvosChosen == null)
				return;
			int h1 = m_phoneEnvRefView.RootBox.Height;
			// First, we need a list of hvos added and a list of hvos deleted.
			int citemsOld = m_cache.GetVectorSize(m_obj.Hvo, m_flid);
			List<int> rghvosNew = new List<int>(rghvosChosen);
			List<int> rghvosDel = new List<int>(citemsOld);
			if (citemsOld > 0)
			{
				int[] hvosOld = m_cache.GetVectorProperty(m_obj.Hvo, m_flid, false);
				Debug.Assert(citemsOld == hvosOld.Length);
				for (int i = 0; i < citemsOld; ++i)
				{
					if (rghvosNew.Contains(hvosOld[i]))
						rghvosNew.Remove(hvosOld[i]);
					else
						rghvosDel.Add(hvosOld[i]);
				}
			}
			// Add all the new environments.
			using (new UndoRedoTaskHelper(m_cache,
				String.Format(DetailControlsStrings.ksUndoSet, m_fieldName),
				String.Format(DetailControlsStrings.ksRedoSet, m_fieldName)))
			{
				for (int i = 0; i < rghvosNew.Count; ++i)
				{
					int hvo = (int)rghvosNew[i];
					m_phoneEnvRefView.AddNewItem(hvo);
					if (m_flid == (int)MoAffixAllomorph.MoAffixAllomorphTags.kflidPosition)
					{
						((MoAffixAllomorph)m_obj).PositionRS.Append(hvo);
					}
					else
					{
						if (m_obj is MoAffixAllomorph)
							((MoAffixAllomorph)m_obj).PhoneEnvRC.Add(hvo);
						else
							((MoStemAllomorph)m_obj).PhoneEnvRC.Add(hvo);
					}
				}
				for (int i = 0; i < rghvosDel.Count; ++i)
				{
					int hvo = (int)rghvosDel[i];
					m_phoneEnvRefView.RemoveItem(hvo);
					if (m_flid == (int)MoAffixAllomorph.MoAffixAllomorphTags.kflidPosition)
					{
						((MoAffixAllomorph)m_obj).PositionRS.Remove(hvo);
					}
					else
					{
						if (m_obj is MoAffixAllomorph)
							((MoAffixAllomorph)m_obj).PhoneEnvRC.Remove(hvo);
						else
							((MoStemAllomorph)m_obj).PhoneEnvRC.Remove(hvo);
					}
				}
			}
			int h2 = m_phoneEnvRefView.RootBox.Height;
			if (h1 != h2 && ViewSizeChanged != null)
			{
				ViewSizeChanged(this,
					new FwViewSizeEventArgs(h2, m_phoneEnvRefView.RootBox.Width));
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:74,代码来源:PhoneEnvReferenceLauncher.cs

示例3: 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

示例4: OnMasterRefresh

		public virtual void OnMasterRefresh(object sender)
		{
			CheckDisposed();

			// Susanna asked that refresh affect only the currently active project, which is
			// what the string and List variables below attempt to handle.  See LT-6444.
			FwXWindow activeWnd = ActiveForm as FwXWindow;

			FdoCache activeCache = null;
			if (activeWnd != null)
				activeCache = activeWnd.Cache;

			List<FwXWindow> rgxw = new List<FwXWindow>();
			foreach (IFwMainWnd wnd in m_app.MainWindows)
			{
				FwXWindow xwnd = wnd as FwXWindow;
				if (xwnd != null)
				{
					if (activeCache == null || xwnd.Cache == activeCache)
					{
						xwnd.PrepareToRefresh();
						rgxw.Add(xwnd);
					}
				}
			}
			if (activeWnd != null)
				rgxw.Remove(activeWnd);

			foreach (FwXWindow xwnd in rgxw)
			{
				xwnd.FinishRefresh();
				xwnd.Refresh();
			}

			// LT-3963: active window changes as a result of a refresh.
			// Make sure focus doesn't switch to another FLEx application / window also
			// make sure the application focus isn't lost all together.
			// ALSO, after doing a refresh with just a single application / window,
			// the application would loose focus and you'd have to click into it to
			// get that back, this will reset that too.
			if (activeWnd != null)
			{
				// Refresh it last, so its saved settings get restored.
				activeWnd.FinishRefresh();
				activeWnd.Refresh();
				activeWnd.Activate();
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:48,代码来源:FwXWindow.cs

示例5: ModifyOverlay

		public void ModifyOverlay(bool fApplyTag, IVwOverlay pvo, int itag)
		{
			CheckDisposed();
			if (m_rootb == null)
				return;

			Debug.WriteLine("WARNING: RootSite.ModifyOverlay() isn't tested yet");
			int hvo;
			uint clrFore;
			uint clrBack;
			uint clrUnder;
			int unt;
			bool fHidden;
			string uid;
			using (ArrayPtr arrayPtr = MarshalEx.StringToNative((int)VwConst1.kcchGuidRepLength + 1, true))
			{
				pvo.GetDbTagInfo(itag, out hvo, out clrFore, out clrBack, out clrUnder, out unt,
					out fHidden, arrayPtr);
				uid = MarshalEx.NativeToString(arrayPtr,
					(int)VwConst1.kcchGuidRepLength, false);
			}

			IVwSelection vwsel;
			ITsTextProps[] vttp;
			IVwPropertyStore[] vvps;
			if (EditingHelper.GetCharacterProps(out vwsel, out vttp, out vvps))
			{
				int cttp = vttp.Length;
				for (int ittp = 0; ittp < cttp; ittp++)
				{
					string strGuid = vttp[ittp].GetStrPropValue(
						(int)FwTextPropType.ktptTags);

					// REVIEW (EberhardB): I'm not sure if this works
					int cGuids = strGuid.Length / Marshal.SizeOf(typeof(Guid));
					List<string> guids = new List<string>();
					for (int i = 0; i < cGuids; i++)
						guids.Add(strGuid.Substring(i, Marshal.SizeOf(typeof(Guid))));

					if (fApplyTag)
					{
						// Add the tag if it does not exist
						if (guids.BinarySearch(uid) >= 0)
						{
							// The tag has already been applied to the textprop, so it doesn't
							// need to be modified.
							vttp[ittp] = null;
							continue;
						}
						else
						{
							// We need to add the tag to the textprop.
							guids.Add(uid);
							guids.Sort();
						}
					}
					else
					{
						// Remove the tag from the textprop.
						guids.Remove(uid);
					}

					ITsPropsBldr tpb = vttp[ittp].GetBldr();
					tpb.SetStrPropValue((int)FwTextPropType.ktptTags,
						guids.ToString());

					vttp[ittp] = tpb.GetTextProps();
				}
				vwsel.SetSelectionProps(cttp, vttp);

				/*
				 * ENHANCE (EberhardB): Implement this if we need it. It probably should be
				 * implemented in a derived class (view class for DataNotebook?)
				// Update the RnGenericRec_PhraseTags table as necessary.
				// (Yes, this is special case code!)

				AfDbInfo * pdbi = NULL;
				AfMainWnd * pamw = m_pwndSubclass->MainWindow();
				if (pamw)
				{
					AfMdiMainWnd * pammw = dynamic_cast<AfMdiMainWnd *>(pamw);
					AfLpInfo * plpi = NULL;
					if (pammw)
					{
						plpi = pammw->GetLpInfo();
						if (plpi)
							pdbi = plpi->GetDbInfo();
					}
				}
				if (pdbi)
				{
					int clevEnd;
					int clevAnchor;
					HVO hvoEnd;
					HVO hvoAnchor;
					PropTag tagEnd;
					PropTag tagAnchor;
					int ihvo;
					int cpropPrev;
					IVwPropertyStorePtr qvps;
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:SimpleRootSite.cs

示例6: 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

示例7: IchLimOfMorphs

			/// <summary>
			/// get the end offsets for potential morphs based upon whitespace delimiters
			/// </summary>
			/// <param name="sourceString"></param>
			/// <returns></returns>
			private static List<int> IchLimOfMorphs(string sourceString, bool fBaseWordIsPhrase)
			{
				List<int> whiteSpaceOffsets = WhiteSpaceOffsets(sourceString);
				List<int> morphEndOffsets = new List<int>(whiteSpaceOffsets);
				int prevOffset = -1;
				int cOffsets = whiteSpaceOffsets.Count;
				foreach (int offset in whiteSpaceOffsets)
				{
					// we always want to remove spaces following a previous space
					// or if we're in a a phrase, always remove the last offset, since
					// it cannot be followed by a second one.
					if (prevOffset != -1 && offset == prevOffset + 1 ||
						fBaseWordIsPhrase && offset == whiteSpaceOffsets[whiteSpaceOffsets.Count - 1])
					{
						morphEndOffsets.Remove(offset);
					}

					if (fBaseWordIsPhrase)
					{
						// for a phrase, we always want to remove previous offsets
						// that are not followed by a space offset
						if (prevOffset != -1 && prevOffset != offset - 1)
						{
							morphEndOffsets.Remove(prevOffset);
						}
					}
					prevOffset = offset;
				}
				// finally add the end of the sourcestring to the offsets.
				morphEndOffsets.Add(sourceString.Length);
				return morphEndOffsets;
			}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:37,代码来源:SandboxBase.cs

示例8: BuildDummiesToConvertList

		private void BuildDummiesToConvertList(List<int> queue, List<int> dummiesToConvert)
		{
			ICmObject realObj = null;
			// Add only up to the max allowed.
			foreach (int item in queue.ToArray())
			{
				if (dummiesToConvert.Count == kMaxDummiesToConvertAtOnce)
					break;
				// only add unique and things that haven't already been converted.
				if (!dummiesToConvert.Contains(item))
				{
					if (m_dummyToRealDict.TryGetValue(item, out realObj) && realObj != null)
					{
						// we've already converted this, so remove it from our queue
						queue.Remove(item);
						continue;
					}
					dummiesToConvert.Add(item);
				}
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:21,代码来源:RecordList.cs


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