Exemple #1
0
        public static mwg.IO.AsyncStringReader BeginErrorReadString(this Diag::Process proc)
        {
            const int MODE_UNDEF = 0;
            //const int MODE_SYNC=1;
            const int MODE_ASYNC          = 2;
            int       errorStreamReadMode = (int)fProcess_errorStreamReadMode.GetValue(proc);

            if (errorStreamReadMode == MODE_UNDEF)
            {
                fProcess_errorStreamReadMode.SetValue(proc, MODE_ASYNC);
            }
            else if (errorStreamReadMode != MODE_ASYNC)
            {
                throw new System.InvalidOperationException("CantMixSyncAsyncOperation");
            }

            if ((bool)fProcess_pendingErrorRead.GetValue(proc))
            {
                throw new System.InvalidOperationException("PendingAsyncOperation");
            }
            fProcess_pendingErrorRead.SetValue(proc, true);

            mwg.IO.AsyncStringReader reader;
            {
                System.IO.StreamReader standardError = (System.IO.StreamReader)fProcess_standardError.GetValue(proc);
                if (standardError == null)
                {
                    throw new System.InvalidOperationException("CantGetStandardError");
                }
                System.IO.Stream stream = standardError.BaseStream;

                System.Action <string> callback = (System.Action <string>)System.Delegate.CreateDelegate(
                    typeof(System.Action <string>), proc, "ErrorReadNotifyUser");

                reader = new mwg.IO.AsyncStringReader(stream, (System.Action <string>)callback, standardError.CurrentEncoding);
            }
            reader.BeginRead();
            return(reader);
        }
Exemple #2
0
        private void Force0x20_0()
        {
            Ref::BindingFlags BF = Ref::BindingFlags.Instance | Ref::BindingFlags.NonPublic;

            System.Type ptype = typeof(System.Windows.Forms.PictureBox);

            Ref::FieldInfo fstate = ptype.GetField("pictureBoxState", BF);

            System.Collections.Specialized.BitVector32 vec = (System.Collections.Specialized.BitVector32)fstate.GetValue(this);
            vec[0x20] = false;
            fstate.SetValue(this, vec);
        }