コード例 #1
0
        internal bool Show()
        {
            OpenFileDialog Dialog = new OpenFileDialog
            {
                AddExtension     = false,
                CheckFileExists  = false,
                DereferenceLinks = true,
                Filter           = "Folders|\n",
                InitialDirectory = CurrentDirectory,
                Multiselect      = false,
                Title            = LocString(LocCode.SelectFolder)
            };
            object VistaDialog = typeof(OpenFileDialog).GetMethod("CreateVistaDialog", Flags).Invoke(Dialog, new object[0]);

            typeof(OpenFileDialog).GetMethod("OnBeforeVistaDialog", Flags).Invoke(Dialog, new[] { VistaDialog });
            SetOptions.Invoke(VistaDialog, new object[] { (uint)GetOptions.Invoke(Dialog, new object[0]) | PickFolders });
            object[] AdviseParameters = new[] { VistaDialogEventsConstructor.Invoke(new[] { Dialog }), 0U };
            IFileDialog.GetMethod("Advise").Invoke(VistaDialog, AdviseParameters);
            try
            {
                bool Result = (int)IFileDialog.GetMethod("Show").Invoke(VistaDialog, new object[] { Zero }) == 0;
                if (Result)
                {
                    Path = Dialog.FileName;
                }
                return(Result);
            }
            finally { IFileDialog.GetMethod("Unadvise").Invoke(VistaDialog, new[] { AdviseParameters[1] }); }
        }