Example #1
0
        private void FireSelChanged(Object sender, BrowseSelChangedEventArgs e)
        {
            var copied = SelChanged;

            if (copied != null)
            {
                copied(sender, e);
            }
        }
Example #2
0
        private int BrowseCallback(IntPtr hwnd, int msg, IntPtr lp, IntPtr lpData)
        {
            var ret = 0;

            switch (msg)
            {
            case BFFM_INITIALIZED:
                handle = hwnd;
                FireInitialized(this, null);

                break;

            case BFFM_IUNKNOWN:
                if (IUnknownObtained != null)
                {
                    if (lp != IntPtr.Zero)
                    {
                        var obtained = Marshal.GetObjectForIUnknown(lp);
                        if (obtained != null)
                        {
                            FireIUnknownObtained(this, new IUnknownObtainedEventArgs(obtained));
                        }
                    }
                }
                break;

            case BFFM_SELCHANGED:
                if (SelChanged != null)
                {
                    var e = new BrowseSelChangedEventArgs(lp);
                    FireSelChanged(this, e);
                }
                break;

            case BFFM_VALIDATEFAILEDA:
                if (ValidateFailed != null)
                {
                    var e = new ValidationFailedEventArgs(Marshal.PtrToStringAnsi(lpData));
                    FireValidateFailed(this, e);
                    ret = (e.Dismiss) ? 0 : 1;
                }
                break;

            case BFFM_VALIDATEFAILEDW:
                if (ValidateFailed != null)
                {
                    var e = new ValidationFailedEventArgs(Marshal.PtrToStringUni(lpData));
                    FireValidateFailed(this, e);
                    ret = (e.Dismiss) ? 0 : 1;
                }
                break;
            }

            return(ret);
        }