Inheritance: IxCoreColleague, IFWDisposable
コード例 #1
0
ファイル: ReversalListener.cs プロジェクト: sillsdev/WorldPad
        public void DeleteReversalIndex(IReversalIndex ri)
        {
            CheckDisposed();

            Form mainWindow = (Form)m_mediator.PropertyTable.GetValue("window");

            mainWindow.Cursor = Cursors.WaitCursor;
            using (ConfirmDeleteObjectDlg dlg = new ConfirmDeleteObjectDlg())
            {
                SIL.FieldWorks.FdoUi.CmObjectUi ui = new SIL.FieldWorks.FdoUi.CmObjectUi(ri);
                dlg.SetDlgInfo(ui, m_cache, m_mediator);
                dlg.TopMessage     = LexEdStrings.ksDeletingThisRevIndex;
                dlg.BottomQuestion = LexEdStrings.ksReallyWantToDeleteRevIndex;
                if (DialogResult.Yes == dlg.ShowDialog(mainWindow))
                {
                    ReallyDeleteReversalIndex(ri);
                }
            }
            mainWindow.Cursor = Cursors.Default;
        }
コード例 #2
0
		private bool HandleRightClickOnObject(int hvoDummy)
		{
			if (hvoDummy == 0)
				return false;

			if (m_realEnvs.ContainsKey(hvoDummy))
			{
				// This displays the "Show in Environments list" item in the popup menu, in
				// addition to all the Insert X" items.
				int hvo = m_realEnvs[hvoDummy].Hvo;
				ReferenceCollectionUi ui = new ReferenceCollectionUi(Cache, m_rootObj, m_rootFlid, hvo);
				return ui.HandleRightClick(Mediator, this, true);
			}
			else
			{
				// We need a CmObjectUi in order to call HandleRightClick().  This won't
				// display the "Show in Environments list" item in the popup menu.
				CmObjectUi ui = new CmObjectUi(m_rootObj);
				return ui.HandleRightClick(Mediator, this, true, "mnuEnvReferenceChoices");
			}
		}
コード例 #3
0
		public void SetDlgInfo(CmObjectUi obj, FdoCache cache, XCore.Mediator mediator)
		{

			CheckDisposed();

			StringTable strings = mediator.StringTbl;
			m_cache = cache;
			IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);

			Debug.Assert(obj != null);
			Debug.Assert(obj.Object != null);

			Text = String.Format(FdoUiStrings.ksDeleteX, strings.GetString(obj.ClassName, "ClassNames"));

			// Set the s_helpTopic based on the window title and rearrange the buttons if neccesary
			switch (obj.ClassName)
			{
				case "WfiWordform":
					s_helpTopic = "khtpDeleteWordform";
					break;
			}
			if (s_helpTopic != null)
			{
				buttonHelp.Visible = true;
				buttonHelp.Enabled = true;
				this.helpProvider = new System.Windows.Forms.HelpProvider();
				this.helpProvider.HelpNamespace = FwApp.App.HelpFile;
				this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0));
				this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);
			}
			else
			{
				m_deleteButton.Location = m_cancelButton.Location;
				m_cancelButton.Location = buttonHelp.Location;
			}

			//Use an FWTextBox so that strings of different writing systems will
			//be displayed with the correct stylesheet settings.
			m_descriptionBox3.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
			m_descriptionBox3.WritingSystemCode = m_cache.LangProject.DefaultUserWritingSystem;
			m_descriptionBox3.StyleSheet = stylesheet;
			ITsIncStrBldr tisb3 = TsIncStrBldrClass.Create();
			tisb3.AppendTsString(obj.Object.DeletionTextTSS);
			m_descriptionBox3.Tss = tisb3.GetString();

			m_descriptionBox4.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
			m_descriptionBox4.WritingSystemCode = m_cache.LangProject.DefaultUserWritingSystem;
			m_descriptionBox4.StyleSheet = stylesheet;
			ITsIncStrBldr tisb4 = TsIncStrBldrClass.Create();
			tisb4.AppendTsString(m_cache.MakeUserTss(" ")); //this is the default for m_descriptionBox4
			m_descriptionBox4.Tss = tisb4.GetString();

			m_deleteButton.Enabled = obj.Object.CanDelete;
			label2.Visible = m_deleteButton.Enabled;
		}
コード例 #4
0
		/// <summary>
		///
		/// </summary>
		/// <param name="strings"></param>
		/// <param name="obj"></param>
		/// <param name="cache"></param>
		/// <param name="mediator"></param>
		/// <param name="tssNote">a second message, in addition to what's in obj.Object.DeletionTextTss</param>
		public void SetDlgInfo(CmObjectUi obj, FdoCache cache, XCore.Mediator mediator, ITsString tssNote)
		{
			CheckDisposed();

			Debug.Assert(obj != null);
			Debug.Assert(obj.Object != null);

			//do not change the order of the following two lines of code
			//because m_descritiptionBox4.Tss is given a default value first.
			SetDlgInfo(obj, cache, mediator);
			ITsIncStrBldr tisb = TsIncStrBldrClass.Create();
			tisb.AppendTsString(tssNote);
			m_descriptionBox4.Tss = tisb.GetString();
		}
コード例 #5
0
ファイル: FdoUiCore.cs プロジェクト: bbriggs/FieldWorks
		private static CmObjectUi MakeUi(FdoCache cache, int hvo, int clsid)
		{
			IFwMetaDataCache mdc = cache.DomainDataByFlid.MetaDataCache;
			// If we've encountered an object with this Clsid before, and this clsid isn't in
			// the switch below, the dictioanry will give us the appropriate clsid that IS in the
			// map, so the loop below will have only one iteration. Otherwise, we start the
			// search with the clsid of the object itself.
			int realClsid = m_subclasses.ContainsKey(clsid) ? m_subclasses[clsid] : clsid;
			// Each iteration investigates whether we have a CmObjectUi subclass that
			// corresponds to realClsid. If not, we move on to the base class of realClsid.
			// In this way, the CmObjectUi subclass we return is the one designed for the
			// closest base class of obj that has one.
			CmObjectUi result = null;
			while (result == null)
			{
				switch (realClsid)
				{
					// Todo: lots more useful cases.
					case WfiAnalysisTags.kClassId:
						result = new WfiAnalysisUi();
						break;
					case PartOfSpeechTags.kClassId:
						result = new PartOfSpeechUi();
						break;
					case CmPossibilityTags.kClassId:
						result = new CmPossibilityUi();
						break;
					case CmObjectTags.kClassId:
						result = new CmObjectUi();
						break;
					case LexPronunciationTags.kClassId:
						result = new LexPronunciationUi();
						break;
					case LexSenseTags.kClassId:
						result = new LexSenseUi();
						break;
					case LexEntryTags.kClassId:
						result = new LexEntryUi();
						break;
					case MoMorphSynAnalysisTags.kClassId:
						result = new MoMorphSynAnalysisUi();
						break;
					case MoStemMsaTags.kClassId:
						result = new MoStemMsaUi();
						break;
					case MoDerivAffMsaTags.kClassId:
						result = new MoDerivAffMsaUi();
						break;
					case MoInflAffMsaTags.kClassId:
						result = new MoInflAffMsaUi();
						break;
					case MoAffixAllomorphTags.kClassId:
					case MoStemAllomorphTags.kClassId:
						result = new MoFormUi();
						break;
					case ReversalIndexEntryTags.kClassId:
						result = new ReversalIndexEntryUi();
						break;
					case WfiWordformTags.kClassId:
						result = new WfiWordformUi();
						break;
					case WfiGlossTags.kClassId:
						result = new WfiGlossUi();
						break;
					default:
						realClsid = mdc.GetBaseClsId(realClsid);
						// This isn't needed because CmObject.kClassId IS 0.
						//					if (realClsid == 0)
						//					{
						//						// Somehow the class doesn't have CmObject in its inheritance path!
						//						Debug.Assert(false);
						//						// this may help make us more robust if this somehow happens.
						//						realClsid = (uint)CmObject.kClassId;
						//					}
						break;
				}
			}
			if (realClsid != clsid)
				m_subclasses[clsid] = realClsid;

			result.m_hvo = hvo;
			result.m_cache = cache;

			return result;
		}
コード例 #6
0
ファイル: FdoUiCore.cs プロジェクト: bbriggs/FieldWorks
		public ReferenceBaseUi(FdoCache cache, ICmObject rootObj, int referenceFlid, int targetHvo)
		{
			// determine whether this is an atomic or vector relationship.
			Debug.Assert(cache.IsReferenceProperty(referenceFlid));
			Debug.Assert(rootObj != null);

			m_cache = cache;
			m_hvo = rootObj.Hvo;
			m_obj = rootObj;
			m_flid = referenceFlid;
			m_hvoTarget = targetHvo;
			m_targetUi = MakeUi(m_cache, m_hvoTarget);
		}
コード例 #7
0
		public virtual bool DisplayContextMenu(IVwSelection vwselNew)
		{
			SelectionHelper sel = SelectionHelper.Create(vwselNew, m_view);
			int hvo = CurrentHvo;

			if (hvo != 0)
			{
				// we only bother to display the context menu if an item is selected
				CmObjectUi ui = new CmObjectUi(CmObject.CreateFromDBObject(m_cache, hvo));
				return ui.HandleRightClick(Mediator, this, true, m_menuId);
			}
			else
			{
				return false;
			}
		}
コード例 #8
0
		private void ContextMenuRequested(object sender, ContextMenuRequestedEventArgs e)
		{
			e.Selection.Install();
			ICmObject obj = CurrentObject;

			if (obj != null)
			{
				// we only bother to display the context menu if an item is selected
				using (var ui = new CmObjectUi(obj))
				{
					e.Handled = ui.HandleRightClick(Mediator, this, true, ContextMenuID);
				}
			}
		}
コード例 #9
0
		public void DeleteReversalIndex(IReversalIndex ri)
		{
			CheckDisposed();

			var mainWindow = (Form)m_mediator.PropertyTable.GetValue("window");
			using (new WaitCursor(mainWindow))
			{
				using (var dlg = new ConfirmDeleteObjectDlg(m_mediator.HelpTopicProvider))
				{
					var ui = new CmObjectUi(ri);
					dlg.SetDlgInfo(ui, Cache, m_mediator);
					dlg.TopMessage = LexEdStrings.ksDeletingThisRevIndex;
					dlg.BottomQuestion = LexEdStrings.ksReallyWantToDeleteRevIndex;
					if (DialogResult.Yes == dlg.ShowDialog(mainWindow))
						ReallyDeleteReversalIndex(ri);
				}
			}
		}
コード例 #10
0
		public virtual bool DisplayContextMenu(IVwSelection vwselNew)
		{
			SelectionHelper sel = SelectionHelper.Create(vwselNew, m_view);
			var obj = CurrentObject;

			if (obj != null)
			{
				// we only bother to display the context menu if an item is selected
				using (var ui = new CmObjectUi(obj))
					return ui.HandleRightClick(Mediator, this, true, ContextMenuID);
			}
			return false;
		}
コード例 #11
0
ファイル: ReversalListener.cs プロジェクト: sillsdev/WorldPad
		public void DeleteReversalIndex(IReversalIndex ri)
		{
			CheckDisposed();

			Form mainWindow = (Form)m_mediator.PropertyTable.GetValue("window");
			mainWindow.Cursor = Cursors.WaitCursor;
			using (ConfirmDeleteObjectDlg dlg = new ConfirmDeleteObjectDlg())
			{
				SIL.FieldWorks.FdoUi.CmObjectUi ui = new SIL.FieldWorks.FdoUi.CmObjectUi(ri);
				dlg.SetDlgInfo(ui, m_cache, m_mediator);
				dlg.TopMessage = LexEdStrings.ksDeletingThisRevIndex;
				dlg.BottomQuestion = LexEdStrings.ksReallyWantToDeleteRevIndex;
				if (DialogResult.Yes == dlg.ShowDialog(mainWindow))
					ReallyDeleteReversalIndex(ri);
			}
			mainWindow.Cursor = Cursors.Default;
		}