예제 #1
0
        public override Size GetPreferredSize(Size proposedSize)
        {
            Size preferredSize;

            ErrorUtil.ThrowOnFailure(_client.GetPreferredSize(proposedSize, out preferredSize));

            return(preferredSize);
        }
예제 #2
0
        protected override bool ProcessDialogChar(char charCode)
        {
            if (base.ProcessDialogChar(charCode))
            {
                return(true);
            }

            return(ErrorUtil.ThrowOnFailure(_host.ProcessDialogChar(charCode)));
        }
예제 #3
0
        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (base.ProcessDialogKey(keyData))
            {
                return(true);
            }

            return(ErrorUtil.ThrowOnFailure(_host.ProcessDialogKey(keyData)));
        }
예제 #4
0
 int IIsolationClient.ProcessMnemonic(char charCode)
 {
     try
     {
         return(ProcessMnemonic(charCode) ? 0 : 1);
     }
     catch (Exception ex)
     {
         return(ErrorUtil.GetHResult(ex));
     }
 }
예제 #5
0
 int IIsolationHost.ProcessDialogChar(char charData)
 {
     try
     {
         return(ProcessDialogChar(charData) ? 0 : 1);
     }
     catch (Exception ex)
     {
         return(ErrorUtil.GetHResult(ex));
     }
 }
예제 #6
0
 int IIsolationHost.ProcessDialogKey(Keys keyData)
 {
     try
     {
         return(ProcessDialogKey(keyData) ? 0 : 1);
     }
     catch (Exception ex)
     {
         return(ErrorUtil.GetHResult(ex));
     }
 }
예제 #7
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (base.ProcessCmdKey(ref msg, keyData))
            {
                return(true);
            }

            NiMessage message = msg;
            bool      result  = ErrorUtil.ThrowOnFailure(_host.ProcessCmdKey(ref message, keyData));

            msg = message;

            return(result);
        }
예제 #8
0
        int IIsolationClient.GetPreferredSize(Size proposedSize, out Size preferredSize)
        {
            preferredSize = new Size();

            try
            {
                preferredSize = GetPreferredSize(proposedSize);

                return(0);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
예제 #9
0
        int IIsolationHost.ProcessCmdKey(ref NiMessage message, Keys keyData)
        {
            try
            {
                Message msg    = message;
                bool    result = ProcessCmdKey(ref msg, keyData);
                message = msg;

                return(result ? 0 : 1);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
예제 #10
0
        protected override void Select(bool directed, bool forward)
        {
            if (_select > 0)
            {
                return;
            }

            _select++;

            try
            {
                // We were the target of select next control. Forward the
                // call to the isolation client which does its search. If it
                // matches a control, we need to make ourselves active.

                if (ErrorUtil.ThrowOnFailure(_client.SelectNextControl(!directed || forward)))
                {
                    base.Select(directed, forward);
                    return;
                }

                // If the client wasn't able to select something, we continue the
                // search from here. One small detail is that SelectNextControl
                // does not match itself. When it would match an IsolationClient,
                // this would mean that the search does not go into the
                // IsolationHost. We specifically match this case by first doing
                // a non-wrapping search and matching the root for IsolationClient.
                // If that matches, we allow the IsolationClient to continue
                // the search upwards. Otherwise, we continue the search
                // from the root as usual.

                var root = ControlUtil.GetRoot(this);

                if (root.SelectNextControl(this, !directed || forward, true, true, !(root is IsolationClient)))
                {
                    return;
                }

                if (root is IsolationClient)
                {
                    Stubs.ControlSelect(root, directed, forward);
                }
            }
            finally
            {
                _select--;
            }
        }
예제 #11
0
        protected override void Select(bool directed, bool forward)
        {
            if (_select > 0)
            {
                return;
            }

            _select++;

            try
            {
                ErrorUtil.ThrowOnFailure(_host.SelectNextControl(!directed || forward));
            }
            finally
            {
                _select--;
            }
        }
예제 #12
0
        public int SetHost(IIsolationHost host)
        {
            try
            {
                if (host == null)
                {
                    throw new ArgumentNullException("host");
                }

                _host = host;
                _sponsor.Register((MarshalByRefObject)host);

                return(0);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
예제 #13
0
        public override bool PreProcessMessage(ref Message msg)
        {
            NiMessage message = msg;
            PreProcessMessageResult preProcessMessageResult;
            bool processed = ErrorUtil.ThrowOnFailure(_client.PreProcessMessage(ref message, out preProcessMessageResult));

            msg = message;

            Stubs.ControlSetState2(
                this,
                Stubs.STATE2_INPUTKEY,
                (preProcessMessageResult & PreProcessMessageResult.IsInputKey) != 0
                );

            Stubs.ControlSetState2(
                this,
                Stubs.STATE2_INPUTCHAR,
                (preProcessMessageResult & PreProcessMessageResult.IsInputChar) != 0
                );

            return(processed);
        }
예제 #14
0
        int IIsolationClient.PreviewKeyDown(Keys keyData)
        {
            try
            {
                int result = 1;

                var target = FindTarget(NativeMethods.GetFocus());
                if (target != null)
                {
                    var e = new PreviewKeyDownEventArgs(keyData);

                    Stubs.ControlOnPreviewKeyDown(target, e);

                    result = e.IsInputKey ? 0 : 1;
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
예제 #15
0
 protected override bool ProcessMnemonic(char charCode)
 {
     return(ErrorUtil.ThrowOnFailure(_client.ProcessMnemonic(charCode)));
 }
예제 #16
0
 protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e)
 {
     e.IsInputKey = ErrorUtil.ThrowOnFailure(_client.PreviewKeyDown(e.KeyData));
 }