SIL.FieldWorks.FdoUi.PhonologicalFeatureEditor.FakeDoit C# (CSharp) Method

FakeDoit() public method

Fake doing the change by setting the specified property to the appropriate value for each item in the set. Disable items that can't be set.
public FakeDoit ( IEnumerable itemsToChange, int tagFakeFlid, int tagEnable, SIL.FieldWorks.Common.Controls.ProgressState state ) : void
itemsToChange IEnumerable
tagFakeFlid int
tagEnable int
state SIL.FieldWorks.Common.Controls.ProgressState
return void
		public void FakeDoit(IEnumerable<int> itemsToChange, int tagFakeFlid, int tagEnable, ProgressState state)
		{
			CheckDisposed();

			string labelToShow = SelectedLabel;
			// selectedHvo refers to either a FsFeatStruc we've made or the targeted feature
			var selectedObject = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(SelectedHvo);
			if (selectedObject is IFsFeatStruc)
			{
				labelToShow = GetLabelToShow(); // get the value for the targeted feature from the FsFeatStruc
			}
			else if (selectedObject is IFsClosedFeature)
			{
				labelToShow = " "; // it is the remove option so we just show nothing after the arrow
			}
			ITsString tss = TsStringUtils.MakeTss(labelToShow, m_cache.DefaultAnalWs);
			int i = 0;
			// Report progress 50 times or every 100 items, whichever is more (but no more than once per item!)
			int interval = Math.Min(100, Math.Max(itemsToChange.Count()/50, 1));
			foreach (int hvo in itemsToChange)
			{
				i++;
				if (i%interval == 0)
				{
					state.PercentDone = i*100/itemsToChange.Count();
					state.Breath();
				}
				bool fEnable = IsItemEligible(m_sda, hvo, selectedObject, labelToShow);
				if (fEnable)
					m_sda.SetString(hvo, tagFakeFlid, tss);
				m_sda.SetInt(hvo, tagEnable, (fEnable ? 1 : 0));
			}
		}