Ejemplo n.º 1
0
        /// <summary>
        /// Executes in two distinct scenarios.
        ///
        /// 1. If disposing is true, the method has been called directly
        /// or indirectly by a user's code via the Dispose method.
        /// Both managed and unmanaged resources can be disposed.
        ///
        /// 2. If disposing is false, the method has been called by the
        /// runtime from inside the finalizer and you should not reference (access)
        /// other managed objects, as they already have been garbage collected.
        /// Only unmanaged resources can be disposed.
        /// </summary>
        /// <param name="disposing"></param>
        /// <remarks>
        /// If any exceptions are thrown, that is fine.
        /// If the method is being done in a finalizer, it will be ignored.
        /// If it is thrown by client code calling Dispose,
        /// it needs to be handled by fixing the bug.
        ///
        /// If subclasses override this method, they should call the base implementation.
        /// </remarks>
        protected virtual void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources here.
                if (m_mediator != null)
                {
                    m_mediator.RemoveColleague(this);
                }
                if (m_dialog != null)
                {
                    m_dialog = null;
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_mediator = null;

            m_isDisposed = true;
        }
Ejemplo n.º 2
0
 void m_dialog_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (m_dialog != null)
     {
         if (m_persistProvider != null)
         {
             m_persistProvider.PersistWindowSettings(m_ksTryAWord, m_dialog);
         }
         m_dialog = null;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the xWorks message for Try A Word
        /// </summary>
        /// <param name="argument">The xCore Command object.</param>
        /// <returns>false</returns>
        public bool OnTraceWord(object argument)
        {
            CheckDisposed();

            if (m_dialog == null)
            {
                m_dialog             = new ParseWordDlg(m_mediator);
                m_dialog.FormClosed += new FormClosedEventHandler(m_dialog_FormClosed);
                XWorks.FwXWindow form = (XWorks.FwXWindow)m_mediator.PropertyTable.GetValue("window");
                if (m_persistProvider != null)
                {
                    m_persistProvider.RestoreWindowSettings(m_ksTryAWord, m_dialog);
                }
                m_dialog.Show(form);
                m_dialog.InitStatusMaterial();
                // This allows Keyman to work correctly on initial typing.
                // Marc Durdin suggested switching to a different window and back.
                // PostMessage gets into the queue after the dialog settles down, so it works.
                Win32.PostMessage(form.Handle, Win32.WinMsgs.WM_SETFOCUS, 0, 0);
                Win32.PostMessage(m_dialog.Handle, Win32.WinMsgs.WM_SETFOCUS, 0, 0);
            }
            else
            {
                if (m_dialog.WindowState == FormWindowState.Minimized)
                {
                    if (m_dialog.m_windowState == FormWindowState.Maximized)
                    {
                        m_dialog.WindowState = FormWindowState.Maximized;
                    }
                    else
                    {
                        m_dialog.WindowState = FormWindowState.Normal;
                    }
                }
                else
                {
                    m_dialog.WindowState = m_dialog.m_windowState;
                    m_dialog.Activate();
                }
            }
            return(true);            // we handled this
        }
Ejemplo n.º 4
0
		void m_dialog_FormClosed(object sender, FormClosedEventArgs e)
		{
			if (m_dialog != null)
			{
				if (m_persistProvider != null)
					m_persistProvider.PersistWindowSettings(m_ksTryAWord, m_dialog);
				m_dialog = null;
			}
		}
Ejemplo n.º 5
0
		/// <summary>
		/// Handles the xWorks message for Try A Word
		/// </summary>
		/// <param name="argument">The xCore Command object.</param>
		/// <returns>false</returns>
		public bool OnTraceWord(object argument)
		{
			CheckDisposed();

			if (m_dialog == null)
			{
				m_dialog = new ParseWordDlg(m_mediator);
				m_dialog.FormClosed += new FormClosedEventHandler(m_dialog_FormClosed);
				XWorks.FwXWindow form = (XWorks.FwXWindow) m_mediator.PropertyTable.GetValue("window");
				if (m_persistProvider != null)
					m_persistProvider.RestoreWindowSettings(m_ksTryAWord, m_dialog);
				m_dialog.Show(form);
				m_dialog.InitStatusMaterial();
				// This allows Keyman to work correctly on initial typing.
				// Marc Durdin suggested switching to a different window and back.
				// PostMessage gets into the queue after the dialog settles down, so it works.
				Win32.PostMessage(form.Handle, Win32.WinMsgs.WM_SETFOCUS, 0, 0);
				Win32.PostMessage(m_dialog.Handle, Win32.WinMsgs.WM_SETFOCUS, 0, 0);
			}
			else
			{
				if (m_dialog.WindowState == FormWindowState.Minimized)
				{
					if (m_dialog.m_windowState == FormWindowState.Maximized)
						m_dialog.WindowState = FormWindowState.Maximized;
					else
						m_dialog.WindowState = FormWindowState.Normal;
				}
				else
				{
					m_dialog.WindowState = m_dialog.m_windowState;
					m_dialog.Activate();
				}
			}
			return true; // we handled this
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected virtual void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (m_isDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_mediator != null)
					m_mediator.RemoveColleague(this);
				if (m_dialog != null)
					m_dialog = null;
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_mediator = null;

			m_isDisposed = true;
		}