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


C# Dispatcher.Run方法代码示例

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


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

示例1: CreateAndShowContent

            private void CreateAndShowContent()
            {
                Dispatcher = Dispatcher.CurrentDispatcher;
                VisualTargetPresentationSource source = new VisualTargetPresentationSource(_hostVisual);
                _resetEvent.Set();
                source.RootVisual = _createContent();
                DesiredSize = source.DesiredSize;
                _invalidateMeasure();

                Dispatcher.Run();
                source.Dispose();
            }
开发者ID:narukunegu,项目名称:ESClinic,代码行数:12,代码来源:ThreadedVisualHost.cs

示例2: Main

        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.Error.WriteLine("Usage: PluginHost name");
                return;
            }

            try
            {
                Console.WriteLine("Host starting: ARGS: " + args[0]);
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;
                var name = args[0];
                int bits = IntPtr.Size * 8;
                Console.WriteLine("Starting PluginHost {0}, {1} bit", name, bits );

                Dispatcher = Dispatcher.CurrentDispatcher;

                var serverProvider = new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full };
                var clientProvider = new BinaryClientFormatterSinkProvider();
                var properties = new Hashtable();
                properties["portName"] = name;

                var channel = new IpcChannel(properties, clientProvider, serverProvider);
                ChannelServices.RegisterChannel(channel, false);

                RemotingConfiguration.RegisterWellKnownServiceType(
                    typeof(PluginLoader), "PluginLoader", WellKnownObjectMode.Singleton);

                SignalReady(name);

                Dispatcher.Run();
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }
            Console.ReadKey();
        }
开发者ID:alkampfergit,项目名称:BaktunShell,代码行数:40,代码来源:Program.cs

示例3: Run

        /// <summary>
        /// Thread entry point for WiX Toolset UX.
        /// </summary>
        protected override void Run()
        {
            Engine.Log(LogLevel.Verbose, "Running the ESME Bootstrapper.");
            Model = new Model(this);
            Dispatcher = Dispatcher.CurrentDispatcher;
            var backgroundColorString = Engine.StringVariables["BackgroundColor"];
            var progressBarColorString = Engine.StringVariables["ProgressBarColor"];
            var convertedBackgroundColorObject = ColorConverter.ConvertFromString(backgroundColorString);
            var convertedProgressBarColorObject = ColorConverter.ConvertFromString(progressBarColorString);
            var backgroundColor = (Color)(convertedBackgroundColorObject ?? Colors.LightSeaGreen);
            var progressBarColor = (Color)(convertedProgressBarColorObject ?? Color.FromArgb(0xFF, 0x00, 0x8E, 0x91));
            var viewModel = new RootViewModel
            {
                BundleLongName = Engine.StringVariables["BundleLongName"],
                BundleShortName = Engine.StringVariables["BundleShortName"],
                ProductLongName = Engine.StringVariables["ProductLongName"],
                ProductShortName = Engine.StringVariables["ProductShortName"],
                ProductFullVersion = Engine.StringVariables["ProductFullVersion"],
                ButtonBackgroundBrush = new SolidColorBrush(backgroundColor),
                ProgressBarBrush = new SolidColorBrush(progressBarColor),
            };
            // Populate the view models with the latest data. This is where Detect is called.
            viewModel.Refresh();

            // Create a Window to show UI.
            if (Model.Command.Display == Display.Passive ||
                Model.Command.Display == Display.Full)
            {
                Engine.Log(LogLevel.Verbose, "Creating a UI.");
                View = new RootView(viewModel);
                View.Show();
            }
            Dispatcher.Run();

            Engine.Quit(0);
        }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:39,代码来源:Bootstrapper.cs

示例4: StartDispatcher

 public void StartDispatcher()
 {
     this.Dispatcher = null;
     _thread = new Thread(() =>
     {
         this.Dispatcher = Dispatcher.CurrentDispatcher;
         Dispatcher.Run();
     });
     _thread.SetApartmentState(ApartmentState.STA);
     _thread.IsBackground = true;
     _thread.Start();
     while (this.Dispatcher == null) //waitinig while dispatcher starts
         Thread.Sleep(1);
 }
开发者ID:noant,项目名称:Pyrite,代码行数:14,代码来源:Scenario.cs

示例5: CreateAndShowContent

			private void CreateAndShowContent()
			{
				this.Dispatcher = Dispatcher.CurrentDispatcher;
				var source = new VisualTargetPresentationSource( _hostVisual );
				this._sync.Set();
				source.RootVisual = _createContent();
				this.DesiredSize = source.DesiredSize;
				this._invalidateMeasure();

				Dispatcher.Run();
				source.Dispose();
			}
开发者ID:micdenny,项目名称:Radical.Windows,代码行数:12,代码来源:BackgroundVisualHost.cs

示例6: _CreateAndShowContent

            /// <summary>
            /// Creates and show content.
            /// </summary>
            private void _CreateAndShowContent()
            {
                Dispatcher = Dispatcher.CurrentDispatcher;
                var source = new VisualTargetPresentationSource(_hostVisual);
                _sync.Set();
                source.RootVisual = _createContent();
                DesiredSize = source.DesiredSize;
                _rootVisual = source.RootVisual as Control;
                Debug.Assert(null != _rootVisual);
                _invalidateMeasure();

                Dispatcher.Run();
                source.Dispose();
            }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:17,代码来源:BackgroundVisualHost.cs


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