當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。