/// <summary>
 /// Creates the text control interface for MS Word
 /// </summary>
 protected void createMSWordTextInterface()
 {
     if (_textInterface == null)
     {
         _textInterface = new MSWordTextControlAgent();
         setTextInterface(_textInterface);
         _textInterface.EvtTextChanged += _textInterface_EvtTextChanged;
     }
 }
 /// <summary>
 /// Disposes off the text interface
 /// </summary>
 private void disposeTextInterface()
 {
     if (_textInterface != null)
     {
         _textInterface.EvtTextChanged -= _textInterface_EvtTextChanged;
         _textInterface.Dispose();
         _textInterface = null;
         setTextInterface();
     }
 }
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public MSWordAgentBase()
 {
     _textInterface = null;
     isWordInstalled = (Type.GetTypeFromProgID("Word.Application") != null);
 }
Beispiel #4
0
 /// <summary>
 /// Disposes text interface
 /// </summary>
 private void disposeTextInterface()
 {
     if (_textInterface != null)
     {
         Log.Debug("Disposing old text interface");
         _textInterface.EvtTextChanged -= _textInterface_EvtTextChanged;
         _textInterface.Dispose();
         _textInterface = null;
         setTextInterface();
     }
 }
Beispiel #5
0
        /// <summary>
        /// Creates the text interface for the Talk window
        /// </summary>
        /// <param name="handle">Handle to the talk window</param>
        /// <param name="automationElement">talk window automation element</param>
        private void createTalkWindowTextInterface(IntPtr handle, AutomationElement automationElement)
        {
            disposeTextInterface();

            bool handled = false;
            _textInterface = new TalkWindowEditControlTextAgent(handle, automationElement, ref handled);
            _textInterface.EvtTextChanged += _textInterface_EvtTextChanged;
            setTextInterface(_textInterface);
            triggerTextChanged(_textInterface);
        }
Beispiel #6
0
        /// <summary>
        /// Sets the text control agent to the specifed one, null agent
        /// if NULL
        /// </summary>
        /// <param name="textInterface">Text interface to set</param>
        protected void setTextInterface(TextControlAgentBase textInterface = null)
        {
            if (_textInterface != null)
            {
                Log.Debug("Disposing " + _textInterface.GetType().Name);
                _textInterface.Dispose();
            }

            Log.Debug("Setting textinterface to " + ((textInterface != null) ? textInterface.GetType().Name : "null"));

            _textInterface = textInterface ?? _nullTextInterface;
            AgentManager.Instance.TextControlAgent = _textInterface;
        }
Beispiel #7
0
        /// <summary>
        /// Disposes currently active text control agent and creates
        /// a new one
        /// </summary>
        /// <param name="monitorInfo">active window info</param>
        private void disposeAndCreateTextInterface(WindowActivityMonitorInfo monitorInfo)
        {
            disposeTextInterface();
            Log.Debug("Calling createEditControlTextInterface");
            var textInterface = createEditControlTextInterface(monitorInfo.FgHwnd, monitorInfo.FocusedElement) ??
                                createKeyLoggerTextInterface(monitorInfo.FgHwnd, monitorInfo.FocusedElement);

            appTextInterface = textInterface;
            appTextInterface.EvtTextChanged += _textInterface_EvtTextChanged;
            setTextInterface(appTextInterface);
        }