Пример #1
0
 /// <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;
     }
 }
Пример #2
0
 /// <summary>
 /// Disposes currently active text control agent
 /// </summary>
 private void disposeTextInterface()
 {
     if (appTextInterface != null)
     {
         appTextInterface.EvtTextChanged -= _textInterface_EvtTextChanged;
         appTextInterface.Dispose();
         appTextInterface = null;
         setTextInterface();
     }
 }
Пример #3
0
 /// <summary>
 /// Creates the text control interface for MS Word
 /// </summary>
 protected void createMSWordTextInterface()
 {
     if (_textInterface == null)
     {
         _textInterface = new MSWordTextControlAgent();
         (_textInterface as MSWordTextControlAgent).autoUnprotectWordDocs = autoUnprotectWordDocs;
         setTextInterface(_textInterface);
         _textInterface.EvtTextChanged += _textInterface_EvtTextChanged;
     }
 }
Пример #4
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);
        }
Пример #5
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();
     }
 }
Пример #6
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);
        }
Пример #7
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;
        }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public MSWordAgentBase()
 {
     _textInterface  = null;
     isWordInstalled = (Type.GetTypeFromProgID("Word.Application") != null);
 }