当前位置: 首页>>代码示例>>C#>>正文


C# Reflector.GetType方法代码示例

本文整理汇总了C#中Reflector.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Reflector.GetType方法的具体用法?C# Reflector.GetType怎么用?C# Reflector.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reflector的用法示例。


在下文中一共展示了Reflector.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowDialog

        public bool ShowDialog(IntPtr hWndOwner)
        {
            bool flag = false;

            if (Environment.OSVersion.Version.Major >= 6)
            {
                var r = new Reflector("System.Windows.Forms");

                uint num = 0;
                Type typeIFileDialog = r.GetType("FileDialogNative.IFileDialog");
                object dialog = r.Call(ofd, "CreateVistaDialog");
                r.Call(ofd, "OnBeforeVistaDialog", dialog);

                uint options = (uint)r.CallAs(typeof(System.Windows.Forms.FileDialog), ofd, "GetOptions");
                options |= (uint)r.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS");
                r.CallAs(typeIFileDialog, dialog, "SetOptions", options);

                object pfde = r.New("FileDialog.VistaDialogEvents", ofd);
                object[] parameters = new object[] { pfde, num };
                r.CallAs2(typeIFileDialog, dialog, "Advise", parameters);
                num = (uint)parameters[1];

                try
                {
                    int num2 = (int)r.CallAs(typeIFileDialog, dialog, "Show", hWndOwner);
                    flag = 0 == num2;
                }
                finally
                {
                    r.CallAs(typeIFileDialog, dialog, "Unadvise", num);
                    GC.KeepAlive(pfde);
                }
            }
            else
            {
                using (var fbd = new FolderBrowserDialog())
                {
                    fbd.Description = this.Title;
                    fbd.SelectedPath = this.InitialDirectory;
                    fbd.ShowNewFolderButton = false;
                    if (fbd.ShowDialog(new WindowWrapper(hWndOwner)) != DialogResult.OK) return false;
                    ofd.FileName = fbd.SelectedPath;
                    flag = true;
                }
            }

            return flag;
        }
开发者ID:halalfood,项目名称:WallbaseDownloader,代码行数:48,代码来源:WinDialog.cs

示例2: ShowDialog

        private bool ShowDialog(IntPtr hWndOwner)
        {
            bool flag;
            if (Environment.OSVersion.Version.Major >= 6)
            {
                var r = new Reflector("System.Windows.Forms");

                uint num = 0;
                var typeIFileDialog = r.GetType("FileDialogNative.IFileDialog");
                var dialog = Reflector.Call(_ofd, "CreateVistaDialog");
                Reflector.Call(_ofd, "OnBeforeVistaDialog", dialog);

                var options = (uint)Reflector.CallAs(typeof(FileDialog), _ofd, "GetOptions");
                options |= (uint)r.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS");
                Reflector.CallAs(typeIFileDialog, dialog, "SetOptions", options);

                var pfde = r.New("FileDialog.VistaDialogEvents", _ofd);
                var parameters = new[] { pfde, num };
                Reflector.CallAs2(typeIFileDialog, dialog, "Advise", parameters);
                num = (uint)parameters[1];
                try
                {
                    var num2 = (int)Reflector.CallAs(typeIFileDialog, dialog, "Show", hWndOwner);
                    flag = 0 == num2;
                }
                finally
                {
                    Reflector.CallAs(typeIFileDialog, dialog, "Unadvise", num);
                    GC.KeepAlive(pfde);
                }
            }
            else
            {
                var fbd = new FolderBrowserDialog {
                                                      Description = Title,
                                                      SelectedPath = InitialDirectory
                                                  };
                if (fbd.ShowDialog(new WindowWrapper(hWndOwner)) != DialogResult.OK)
                    return false;
                _ofd.FileName = fbd.SelectedPath;
                return true;
            }

            return flag;
        }
开发者ID:ttgxdinger,项目名称:Random,代码行数:45,代码来源:FolderSelectDialog.cs

示例3: ShowDialog

 public bool ShowDialog(IntPtr hWndOwner)
 {
     if ((Environment.OSVersion.Version.Major >= 6) && !this.UseOldDialog)
     {
         Reflector reflector = new Reflector("System.Windows.Forms");
         uint num = 0;
         Type type = reflector.GetType("FileDialogNative.IFileDialog");
         object obj2 = reflector.Call(this.ofd, "CreateVistaDialog", new object[0]);
         reflector.Call(this.ofd, "OnBeforeVistaDialog", new object[] {obj2});
         uint num2 = (uint) reflector.CallAs(typeof (FileDialog), this.ofd, "GetOptions", new object[0]);
         num2 |= (uint) reflector.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS");
         reflector.CallAs(type, obj2, "SetOptions", new object[] {num2});
         object obj3 = reflector.New("FileDialog.VistaDialogEvents", new object[] {this.ofd});
         object[] parameters = new object[] {obj3, num};
         reflector.CallAs2(type, obj2, "Advise", parameters);
         num = (uint) parameters[1];
         try
         {
             int num3 = (int) reflector.CallAs(type, obj2, "Show", new object[] {hWndOwner});
             return (0 == num3);
         }
         finally
         {
             reflector.CallAs(type, obj2, "Unadvise", new object[] {num});
             GC.KeepAlive(obj3);
         }
     }
     FolderBrowserDialogEx ex = new FolderBrowserDialogEx();
     ex.Description = this.Title;
     ex.SelectedPath = this.InitialDirectory;
     ex.ShowNewFolderButton = true;
     ex.ShowEditBox = true;
     ex.ShowFullPathInEditBox = true;
     if (ex.ShowDialog(new WindowWrapper(hWndOwner)) != DialogResult.OK)
     {
         return false;
     }
     this.ofd.FileName = ex.SelectedPath;
     return true;
 }
开发者ID:desautel,项目名称:Sdl-Community,代码行数:40,代码来源:FolderSelect.cs

示例4: ShowDialog

		/// <summary>
		/// Shows the dialog
		/// </summary>
		/// <param name="hWndOwner">Handle of the control to be parent</param>
		/// <returns>True if the user presses OK else false</returns>
		public bool ShowDialog(IntPtr hWndOwner)
		{
			bool flag = false;

            if (PlatformHelper.GetPlatform() == Platform.OsX ||
                PlatformHelper.GetPlatform() == Platform.Linux ||
		        Environment.OSVersion.Version.Major < 6)
            {
                flag = FallBackToFolderBrowserDialog(hWndOwner);
		    }
            else
			{
				var r = new Reflector("System.Windows.Forms");

				uint num = 0;
				Type typeIFileDialog = r.GetType("FileDialogNative.IFileDialog");
			    if (typeIFileDialog == null)
                    flag = FallBackToFolderBrowserDialog(hWndOwner);
			    else
			    {
                    object dialog = r.Call(ofd, "CreateVistaDialog");
				    r.Call(ofd, "OnBeforeVistaDialog", dialog);

				    uint options = (uint)r.CallAs(typeof(System.Windows.Forms.FileDialog), ofd, "GetOptions");
				    options |= (uint)r.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS");
				    r.CallAs(typeIFileDialog, dialog, "SetOptions", options);

				    object pfde = r.New("FileDialog.VistaDialogEvents", ofd);
				    object[] parameters = new object[] { pfde, num };
				    r.CallAs2(typeIFileDialog, dialog, "Advise", parameters);
				    num = (uint)parameters[1];
				    try
				    {
					    int num2 = (int)r.CallAs(typeIFileDialog, dialog, "Show", hWndOwner);
					    flag = 0 == num2;
				    }
				    finally
				    {
					    r.CallAs(typeIFileDialog, dialog, "Unadvise", num);
					    GC.KeepAlive(pfde);
                    }
                }
			}

			return flag;
		}
开发者ID:timmersuk,项目名称:KSP-Mod-Admin-aOS,代码行数:51,代码来源:FolderSelectDialog.cs

示例5: ShowDialog

        /// <summary>
        /// Shows the dialog
        /// </summary>
        /// <returns>True if the user presses OK else false</returns>
        public DialogResult ShowDialog(IntPtr hWndOwner)
        {
            bool flag;

            if (Environment.OSVersion.Version.Major >= 6)            // if current OS is windows and version Vista or higher - then use extended dialogs
            {
                var r = new Reflector("System.Windows.Forms");

                uint num = 0;
                var typeIFileDialog = r.GetType("FileDialogNative.IFileDialog");
                var dialog = r.Call(ofd, "CreateVistaDialog");
                r.Call(ofd, "OnBeforeVistaDialog", dialog);

                var options = (uint)r.CallAs(typeof(FileDialog), ofd, "GetOptions");
                options |= (uint)r.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS");
                r.CallAs(typeIFileDialog, dialog, "SetOptions", options);

                var pfde = r.New("FileDialog.VistaDialogEvents", ofd);
                var parameters = new[] { pfde, num };
                r.CallAs2(typeIFileDialog, dialog, "Advise", parameters);
                num = (uint)parameters[1];
                try
                {
                    var num2 = (int)r.CallAs(typeIFileDialog, dialog, "Show", hWndOwner);
                    flag = 0 == num2;
                }
                finally
                {
                    r.CallAs(typeIFileDialog, dialog, "Unadvise", num);
                    GC.KeepAlive(pfde);
                }
            }
            else                        // in another case - use standart dialog
            {
                using (var fbd = new FolderBrowserDialog { Description = Title, SelectedPath = InitialDirectory, ShowNewFolderButton = false, RootFolder = RootFolder })
                {
                    if (fbd.ShowDialog() != DialogResult.OK)
                        return DialogResult.Cancel;
                    ofd.FileName = fbd.SelectedPath;
                    flag = true;
                }
            }

            return flag ? DialogResult.OK : DialogResult.Cancel;
        }
开发者ID:reward-hunters,项目名称:PrintAhead,代码行数:49,代码来源:FolderDialogEx.cs

示例6: ShowDialog

        /// <summary>
        /// Shows the dialog
        /// </summary>
        /// <param name="hWndOwner">Handle of the control to be parent</param>
        /// <returns>True if the user presses OK else false</returns>
        public bool ShowDialog(IntPtr hWndOwner)
        {
            bool flag;

            // TODO: Find way to use Microsoft.Win32
            Reflector r = new Reflector("System.Windows.Forms");

            uint num = 0;
            Type typeIFileDialog = r.GetType("FileDialogNative.IFileDialog");
            object dialog = r.Call(ofd, "CreateVistaDialog");
            r.Call(ofd, "OnBeforeVistaDialog", dialog);

            uint options = (uint)r.CallAs(typeof(FileDialog), ofd, "GetOptions");
            options |= (uint)r.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS");
            r.CallAs(typeIFileDialog, dialog, "SetOptions", options);

            object pfde = r.New("FileDialog.VistaDialogEvents", ofd);
            object[] parameters = new object[] { pfde, num };
            r.CallAs2(typeIFileDialog, dialog, "Advise", parameters);
            num = (uint)parameters[1];
            try
            {
                int num2 = (int)r.CallAs(typeIFileDialog, dialog, "Show", hWndOwner);
                flag = 0 == num2;
            }
            finally
            {
                r.CallAs(typeIFileDialog, dialog, "Unadvise", num);
                GC.KeepAlive(pfde);
            }

            return flag;
        }
开发者ID:McoreD,项目名称:HelpersLib.Wpf,代码行数:38,代码来源:FolderDialog.cs


注:本文中的Reflector.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。