Exemplo n.º 1
0
		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));
					}
				}
			}
		}
Exemplo n.º 2
0
		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));
					}
				}
			}
		}