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


C# Threading.Dispatcher类代码示例

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


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

示例1: TrackInfoPoller

 public TrackInfoPoller(NowPlayingTrackInfoProvider Provider, CoverManager CoverManager, Window window)
 {
     this.nowPlayingProvider = Provider;
     this.coverManager = CoverManager;
     this.window = window;
     this.dispatcher = App.Current.Dispatcher;
 }
开发者ID:philippn,项目名称:now-playing-kiosk,代码行数:7,代码来源:MainWindow.xaml.cs

示例2: TaskViewModel

 public TaskViewModel(Dispatcher disp)
 {
     this._dispatcher = disp;
     AnnulerCommand = new GenericCommand<object>(ExecuteAnnulerCommand, CanExecuteAnnulerCommand);
     EffectuerCommand = new GenericCommand<object>(ExecuteEffectuerCommand, CanExecuteEffectuerCommand);
     DeclarerProbleme = new GenericCommand<object>(ExecuteDeclarerProblemeCommand, CanExecuteDeclarerProblemeCommand);
 }
开发者ID:qlestrelin,项目名称:icomierp,代码行数:7,代码来源:TaskViewModel.cs

示例3: UserRateListViewModel

 public UserRateListViewModel(IUserInterop userInterop, IControllerInterop controllerInterop, Dispatcher dispatcher, BaseEntityDTO entity)
     : base(userInterop, controllerInterop, dispatcher)
 {
     this.entity = entity;
     rates = new ObservableCollection<UserRateItemDTO>();
     Rates = new ReadOnlyObservableCollection<UserRateItemDTO>(rates);
 }
开发者ID:ZuTa,项目名称:StudyingController,代码行数:7,代码来源:UserRateListViewModel.cs

示例4: MainViewModel

        public MainViewModel()
        {
            _Dispatcher = Dispatcher.CurrentDispatcher;

            Items = new ObservableCollection<string>();
            Items.Add("Messages go here");
        }
开发者ID:modulexcite,项目名称:MEF-Plugin-With-Custom-Attributes-and-Metadata-Sample,代码行数:7,代码来源:MainViewModel.cs

示例5: RequireInstance

        private static void RequireInstance()
        {
            // Design-time is more of a no-op, won't be able to resolve the
            // dispatcher if it isn't already set in these situations.
            if (_designer || Application.Current == null)
            {
                return;
            }

            // Attempt to use the RootVisual of the plugin to retrieve a
            // dispatcher instance. This call will only succeed if the current
            // thread is the UI thread.
            try
            {
                _instance = Application.Current.Dispatcher;
            }
            catch (Exception e)
            {
                throw new InvalidOperationException("The first time SmartDispatcher is used must be from a user interface thread. Consider having the application call Initialize, with or without an instance.", e);
            }

            if (_instance == null)
            {
                throw new InvalidOperationException("Unable to find a suitable Dispatcher instance.");
            }
        }
开发者ID:Laurent27,项目名称:IGScalp,代码行数:26,代码来源:SmartDispatcher.cs

示例6: CachedBitmap

 public CachedBitmap()
 {
     dispatcher = Dispatcher.CurrentDispatcher;
     _url = "";
     _source = null;
     _workItem = null;
 }
开发者ID:punker76,项目名称:sjupdater,代码行数:7,代码来源:CachedBitmap.cs

示例7: DispatcherSynchronizationContext

		public DispatcherSynchronizationContext (Dispatcher dispatcher)
		{
			if (dispatcher == null)
				throw new ArgumentNullException ("dispatcher");

			this.dispatcher = dispatcher;
		}
开发者ID:dfr0,项目名称:moon,代码行数:7,代码来源:DispatcherSynchronizationContext.cs

示例8: GuardUiaServerInvocation

 private static void GuardUiaServerInvocation(Action invocation, Dispatcher dispatcher)
 {
     if (dispatcher == null)
         throw new ElementNotAvailableException();
     Exception remoteException = null;
     bool completed = false;
     dispatcher.Invoke(DispatcherPriority.Send, TimeSpan.FromMinutes(3.0), (Action)(() =>
     {
         try
         {
             invocation();
         }
         catch (Exception e)
         {
             remoteException = e;
         }
         catch
         {
             remoteException = null;
         }
         finally
         {
             completed = true;
         }
     }));
     if (completed)
     {
         if (remoteException != null)
             throw remoteException;
     }
     else if (dispatcher.HasShutdownStarted)
         throw new InvalidOperationException("AutomationDispatcherShutdown");
     else
         throw new TimeoutException("AutomationTimeout");
 }
开发者ID:TestStack,项目名称:uia-custom-pattern-managed,代码行数:35,代码来源:AutomationPeerAugmentationHelper.cs

示例9: DialogManager

		public DialogManager(
			ContentControl parent,
			Dispatcher dispatcher)
		{
			_dispatcher = dispatcher;
			_dialogHost = new DialogLayeringHelper(parent);
		}
开发者ID:tsbrzesny,项目名称:rma-alzheimer,代码行数:7,代码来源:DialogManager.cs

示例10: Run

        protected override void Run()
        {
            this.Engine.Log(LogLevel.Verbose, "Launching Sparrow.Chart.Installer");
            BootstrapperDispatcher = Dispatcher.CurrentDispatcher;
            MainViewModel viewModel = new MainViewModel(this);
            viewModel.Bootstrapper.Engine.Detect();

            if (viewModel.Bootstrapper.Command.Action == LaunchAction.Install && !isInstalled)
            {
                MainView view = new MainView();
                view.DataContext = viewModel;
                view.Closed += (sender, e) => BootstrapperDispatcher.InvokeShutdown();
                view.Show();
                isInstalled = true;
            }

            if (viewModel.Bootstrapper.Command.Action == LaunchAction.Uninstall && !isUninstalled)
            {
                MainView view = new MainView();
                view.DataContext = viewModel;
                view.Closed += (sender, e) => BootstrapperDispatcher.InvokeShutdown();
                view.Show();
                isUninstalled = true;
            }

            Dispatcher.Run();

            this.Engine.Quit(0);
        }
开发者ID:jcw-,项目名称:sparrowtoolkit,代码行数:29,代码来源:SparrowInstaller.cs

示例11: Application_Startup

		private void Application_Startup (object sender, StartupEventArgs e)
		{
			Panel root = new TestElement { Name = "Root" };
			root.Children.Add (CreateTemplated ("Button1"));
			d = root.Dispatcher;
			RootVisual = root;
			Delay (() => {
				Console.WriteLine ("Actual");
				Console.Write (sb.ToString ());

				Console.WriteLine ();
				Console.WriteLine ();
				Console.WriteLine (@"Expected
Button1: Loaded
Root: Loaded
Button2: Loaded
Button1: OnApplyTemplate
Button1: MeasureOverride
Button2: OnApplyTemplate
Button2: MeasureOverride
Button1: ArrangeOverride
Button2: ArrangeOverride
Root: LayoutUpdated
Button1: LayoutUpdated
Button2: LayoutUpdated");
			});
		}
开发者ID:dfr0,项目名称:moon,代码行数:27,代码来源:App.xaml.cs

示例12: FileOpenModalDialog

 internal FileOpenModalDialog(Dispatcher dispatcher, Window parentWindow)
     : base(dispatcher, parentWindow)
 {
     Dialog = new CommonOpenFileDialog { EnsureFileExists = true };
     Filters = new List<FileDialogFilter>();
     FilePaths = new List<string>();
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:7,代码来源:FileOpenModalDialog.cs

示例13: ClaudiaIDE

        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        /// <param name="imageProvider">The <see cref="IImageProvider"/> which provides bitmaps to draw</param>
        /// <param name="setting">The <see cref="Setting"/> contains user image preferences</param>
        public ClaudiaIDE(IWpfTextView view, List<IImageProvider> imageProvider, Setting setting)
		{
		    try
		    {
		        _dispacher = Dispatcher.CurrentDispatcher;
                _imageProviders = imageProvider;
                _imageProvider = imageProvider.FirstOrDefault(x=>x.ProviderType == setting.ImageBackgroundType);
                _setting = setting;
                if (_imageProvider == null)
                {
                    _imageProvider = new SingleImageProvider(_setting);
                }
                _view = view;
                _image = new Image
                {
                    Opacity = setting.Opacity,
                    IsHitTestVisible = false
                };
                _adornmentLayer = view.GetAdornmentLayer("ClaudiaIDE");
				_view.ViewportHeightChanged += delegate { RepositionImage(); };
				_view.ViewportWidthChanged += delegate { RepositionImage(); };     
                _view.ViewportLeftChanged += delegate { RepositionImage(); };
                _setting.OnChanged += delegate { ReloadSettings(); };

                _imageProviders.ForEach(x => x.NewImageAvaliable += delegate { InvokeChangeImage(); });

                ChangeImage();
            }
			catch
			{
			}
		}
开发者ID:liange,项目名称:ClaudiaIDE,代码行数:39,代码来源:ClaudiaIDE.cs

示例14: CathedraViewModel

        public CathedraViewModel(IUserInterop userInterop, IControllerInterop controllerInterop, Dispatcher dispatcher, CathedraDTO cathedra)
            : base(userInterop, controllerInterop, dispatcher)
        {
            faculties = new List<FacultyDTO>();

            originalEntity = cathedra;
        }
开发者ID:ZuTa,项目名称:StudyingController,代码行数:7,代码来源:CathedraViewModel.cs

示例15: BackgroundDispatcher

        public BackgroundDispatcher(string name)
        {
            AutoResetEvent are = new AutoResetEvent(false);

            Thread thread = new Thread((ThreadStart)delegate
            {
                _dispatcher = Dispatcher.CurrentDispatcher;
                _dispatcher.UnhandledException +=
                delegate(
                     object sender,
                     DispatcherUnhandledExceptionEventArgs e)
                {
                    e.Handled = true;
                };
                are.Set();
                Dispatcher.Run();
            });

            thread.Name = string.Format("BackgroundStaDispatcher({0})", name);
            thread.SetApartmentState(ApartmentState.MTA);
            thread.IsBackground = true;
            thread.Start();

            are.WaitOne();
            are.Close();
            are.Dispose();
        }
开发者ID:karthik20522,项目名称:SimpleDotImage,代码行数:27,代码来源:BackgroundDispatcher.cs


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