Inheritance: System.Windows.Forms.Form
Example #1
0
        private void LaunchRespellerDlgOnWord(ITsString tss)
        {
            if (tss == null || string.IsNullOrEmpty(tss.Text))
            {
                return;
            }

            var cache    = m_mediator.PropertyTable.GetValue("cache") as FdoCache;
            var wordform = WordformApplicationServices.GetWordformForForm(cache, tss);

            using (var luh = new RecordClerk.ListUpdateHelper(m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk))
            {
                // Launch the Respeller Dlg.
                using (var dlg = new RespellerDlg())
                {
                    var xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
                    if (dlg.SetDlgInfo(wordform, m_mediator, m_configurationParameters))
                    {
                        dlg.ShowDialog(xwindow);
                    }
                    else
                    {
                        MessageBox.Show(MEStrings.ksCannotRespellWordform);
                    }
                }
                //// We assume that RespellerDlg made all the necessary changes to relevant lists.
                //// no need to reload due to a propchange (e.g. change in paragraph contents).
                //luh.TriggerPendingReloadOnDispose = false;
            }
        }
        private void LaunchRespellerDlgOnWord(ITsString tss)
        {
            if (tss == null || string.IsNullOrEmpty(tss.Text))
            {
                return;
            }
            FdoCache cache       = m_mediator.PropertyTable.GetValue("cache") as FdoCache;
            int      hvoWordform = WfiWordform.FindOrCreateWordform(cache, tss);

            if (hvoWordform == 0)
            {
                return;                 // paranoia.
            }
            IWfiWordform wf = WfiWordform.CreateFromDBObject(cache, hvoWordform);

            using (RecordClerk.ListUpdateHelper luh = new RecordClerk.ListUpdateHelper(m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk))
            {
                // Launch the Respeller Dlg.
                using (RespellerDlg dlg = new RespellerDlg())
                {
                    XWindow xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
                    if (dlg.SetDlgInfo2(wf, m_mediator, m_configurationParameters))
                    {
                        dlg.ShowDialog(xwindow);
                    }
                    else
                    {
                        MessageBox.Show(MEStrings.ksCannotRespellWordform);
                    }
                }
                // We assume that RespellerDlg made all the necessary changes to relevant lists.
                // no need to reload due to a propchange (e.g. change in paragraph contents).
                luh.TriggerPendingReloadOnDispose = false;
            }
        }
 /// <summary>
 /// Launch the Respeller dlg.
 /// </summary>
 /// <param name="argument">The xCore Command object.</param>
 /// <returns>true</returns>
 public bool OnLaunchRespellerDlg(object argument)
 {
     CheckDisposed();
     if (!InFriendliestTool)                     // See LT-8641.
     {
         LaunchRespellerDlgOnWord(ActiveWord());
         return(true);
     }
     using (RecordClerk.ListUpdateHelper luh = new RecordClerk.ListUpdateHelper(m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk))
     {
         // Launch the Respeller Dlg.
         using (RespellerDlg dlg = new RespellerDlg())
         {
             XWindow xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
             if (dlg.SetDlgInfo(m_mediator, m_configurationParameters))
             {
                 dlg.ShowDialog(xwindow);
             }
             else
             {
                 MessageBox.Show(MEStrings.ksCannotRespellWordform);
             }
         }
         // We assume that RespellerDlg made all the necessary changes to relevant lists.
         // no need to reload due to a propchange (e.g. change in paragraph contents).
         luh.TriggerPendingReloadOnDispose = false;
     }
     return(true);
 }
Example #4
0
        /// <summary>
        /// Launch the Respeller dlg.
        /// </summary>
        /// <param name="argument">The xCore Command object.</param>
        /// <returns>true</returns>
        public bool OnLaunchRespellerDlg(object argument)
        {
            CheckDisposed();
            if (!InFriendliestTool)                     // See LT-8641.
            {
                LaunchRespellerDlgOnWord(ActiveWord());
                return(true);
            }
            var clerk = m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk;

            using (var luh = new RecordClerk.ListUpdateHelper(clerk))
            {
                var changesWereMade = false;
                // Launch the Respeller Dlg.
                using (var dlg = new RespellerDlg())
                {
                    var xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
                    if (dlg.SetDlgInfo(m_mediator, m_configurationParameters))
                    {
                        dlg.ShowDialog(xwindow);
                        changesWereMade = dlg.ChangesWereMade;
                    }
                    else
                    {
                        MessageBox.Show(MEStrings.ksCannotRespellWordform);
                    }
                }
                // The Respeller dialog can't make all necessary updates, since things like occurrence
                // counts depend on which texts are included, not just the data. So make sure we reload.
                luh.TriggerPendingReloadOnDispose = changesWereMade;
                if (changesWereMade)
                {
                    // further try to refresh occurrence counts.
                    var sda = clerk.VirtualListPublisher;
                    while (sda != null)
                    {
                        if (sda is ConcDecorator)
                        {
                            ((ConcDecorator)sda).Refresh();
                            break;
                        }
                        if (!(sda is DomainDataByFlidDecoratorBase))
                        {
                            break;
                        }
                        sda = ((DomainDataByFlidDecoratorBase)sda).BaseSda;
                    }
                }
            }
            return(true);
        }
		private void LaunchRespellerDlgOnWord(ITsString tss)
		{
			if (tss == null || string.IsNullOrEmpty(tss.Text))
				return;
			FdoCache cache = m_mediator.PropertyTable.GetValue("cache") as FdoCache;
			int hvoWordform = WfiWordform.FindOrCreateWordform(cache, tss);
			if (hvoWordform == 0)
				return; // paranoia.
			IWfiWordform wf = WfiWordform.CreateFromDBObject(cache, hvoWordform);
			using (RecordClerk.ListUpdateHelper luh = new RecordClerk.ListUpdateHelper(m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk))
			{
				// Launch the Respeller Dlg.
				using (RespellerDlg dlg = new RespellerDlg())
				{
					XWindow xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
					if (dlg.SetDlgInfo2(wf, m_mediator, m_configurationParameters))
					{
						dlg.ShowDialog(xwindow);
					}
					else
					{
						MessageBox.Show(MEStrings.ksCannotRespellWordform);
					}
				}
				// We assume that RespellerDlg made all the necessary changes to relevant lists.
				// no need to reload due to a propchange (e.g. change in paragraph contents).
				luh.TriggerPendingReloadOnDispose = false;
			}
		}
		/// <summary>
		/// Launch the Respeller dlg.
		/// </summary>
		/// <param name="argument">The xCore Command object.</param>
		/// <returns>true</returns>
		public bool OnLaunchRespellerDlg(object argument)
		{
			CheckDisposed();
			if (!InFriendliestTool)		// See LT-8641.
			{
				LaunchRespellerDlgOnWord(ActiveWord());
				return true;
			}
			using (RecordClerk.ListUpdateHelper luh = new RecordClerk.ListUpdateHelper(m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk))
			{
				// Launch the Respeller Dlg.
				using (RespellerDlg dlg = new RespellerDlg())
				{
					XWindow xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
					if (dlg.SetDlgInfo(m_mediator, m_configurationParameters))
					{
						dlg.ShowDialog(xwindow);
					}
					else
					{
						MessageBox.Show(MEStrings.ksCannotRespellWordform);
					}
				}
				// We assume that RespellerDlg made all the necessary changes to relevant lists.
				// no need to reload due to a propchange (e.g. change in paragraph contents).
				luh.TriggerPendingReloadOnDispose = false;
			}
			return true;
		}
		private void LaunchRespellerDlgOnWord(ITsString tss)
		{
			if (tss == null || string.IsNullOrEmpty(tss.Text))
				return;

			var cache = m_mediator.PropertyTable.GetValue("cache") as FdoCache;
			var wordform = WordformApplicationServices.GetWordformForForm(cache, tss);
			using (var luh = new RecordClerk.ListUpdateHelper(m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk))
			{
				// Launch the Respeller Dlg.
				using (var dlg = new RespellerDlg())
				{
					var xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
					if (dlg.SetDlgInfo(wordform, m_mediator, m_configurationParameters))
					{
						dlg.ShowDialog(xwindow);
					}
					else
					{
						MessageBox.Show(MEStrings.ksCannotRespellWordform);
					}
				}
				//// We assume that RespellerDlg made all the necessary changes to relevant lists.
				//// no need to reload due to a propchange (e.g. change in paragraph contents).
				//luh.TriggerPendingReloadOnDispose = false;
			}
		}
		/// <summary>
		/// Launch the Respeller dlg.
		/// </summary>
		/// <param name="argument">The xCore Command object.</param>
		/// <returns>true</returns>
		public bool OnLaunchRespellerDlg(object argument)
		{
			CheckDisposed();
			if (!InFriendliestTool)		// See LT-8641.
			{
				LaunchRespellerDlgOnWord(ActiveWord());
				return true;
			}
			var clerk = m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk;
			using (var luh = new RecordClerk.ListUpdateHelper(clerk))
			{
				var changesWereMade = false;
				// Launch the Respeller Dlg.
				using (var dlg = new RespellerDlg())
				{
					var xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
					if (dlg.SetDlgInfo(m_mediator, m_configurationParameters))
					{
						dlg.ShowDialog(xwindow);
						changesWereMade = dlg.ChangesWereMade;
					}
					else
					{
						MessageBox.Show(MEStrings.ksCannotRespellWordform);
					}
				}
				// The Respeller dialog can't make all necessary updates, since things like occurrence
				// counts depend on which texts are included, not just the data. So make sure we reload.
				luh.TriggerPendingReloadOnDispose = changesWereMade;
				if (changesWereMade)
				{
					// further try to refresh occurrence counts.
					var sda = clerk.VirtualListPublisher;
					while (sda != null)
					{
						if (sda is ConcDecorator)
						{
							((ConcDecorator)sda).Refresh();
							break;
						}
						if (!(sda is DomainDataByFlidDecoratorBase))
							break;
						sda = ((DomainDataByFlidDecoratorBase) sda).BaseSda;
					}
				}
			}
			return true;
		}