本文整理汇总了C#中System.Windows.Threading.Dispatcher类的典型用法代码示例。如果您正苦于以下问题:C# Dispatcher类的具体用法?C# Dispatcher怎么用?C# Dispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dispatcher类属于System.Windows.Threading命名空间,在下文中一共展示了Dispatcher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: RemoveClientFromUserListTask
public RemoveClientFromUserListTask(Dispatcher disp, TaskHandler handler, ClientConnectionList list, ClientConnection client, ObservableCollection<UserLocation> locs)
: base(disp, handler)
{
ClientConnectionList = list;
ClientConnection = client;
UserLocations = locs;
}
开发者ID:bakacaptain,项目名称:istalkapp,代码行数:7,代码来源:RemoveClientFromUserListTask.cs
示例17: OrgStructureViewModel
public OrgStructureViewModel(string siteUrl,string subSiteUrl, StringBuilder log, string mainCheckListName)
{
_log = log;
_dispatcher = Deployment.Current.Dispatcher;
_OrgStructureServiceAgent = new OrgStructureServiceAgent(siteUrl, log);
_mainCheckListName = mainCheckListName;
_subSiteUrl = subSiteUrl;
Levels = new ObservableCollection<OrgStructureEntityModel>();
AddCommand = new RelayCommand(AddAction);
AddCommand.IsEnabled = false;
EditCommand = new RelayCommand(EditAction);
EditCommand.IsEnabled = false;
DeleteCommand = new RelayCommand(DeleteAction);
DeleteCommand.IsEnabled = false;
AddGlobalCommand = new RelayCommand(AddGlobalAction);
AddGlobalCommand.IsEnabled = true;
CancelCommand = new RelayCommand(CancelAction);
CancelCommand.IsEnabled = true;
_confirmDialog = new DialogService(340, 120);
LoadOrgStructureEntityModel();
}
开发者ID:nilavghosh,项目名称:VChk,代码行数:30,代码来源:OrgStructureViewModel.cs
示例18: InstituteAdminViewModel
public InstituteAdminViewModel(IUserInterop userInterop, IControllerInterop controllerInterop, Dispatcher dispatcher)
: base(userInterop, controllerInterop, dispatcher)
{
institutes = new List<InstituteDTO>();
originalEntity = new InstituteAdminDTO() { Role = UserRoles.InstituteAdmin };
}
开发者ID:ZuTa,项目名称:StudyingController,代码行数:7,代码来源:InstituteAdminViewModel.cs
示例19: DispatcherOperation
internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio, Delegate d, object arg)
: this (dis, prio)
{
delegate_method = d;
delegate_args = new object [1];
delegate_args [0] = arg;
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:DispatcherOperation.cs
示例20: FileWatcher
public FileWatcher(string directory, string filter)
{
_dispatcher = Dispatcher.CurrentDispatcher;
_watcher = new FileSystemWatcher();
_watcher.BeginInit();
_watcher.Path = directory;
_watcher.Filter = filter;
_watcher.IncludeSubdirectories = false;
_watcher.InternalBufferSize = InitialBufferSize;
_watcher.NotifyFilter
= NotifyFilters.DirectoryName
| NotifyFilters.FileName
| NotifyFilters.LastWrite
| NotifyFilters.Attributes
| NotifyFilters.Security
| NotifyFilters.Size;
// note: all events are on threadpool threads!
_watcher.Created += onCreated;
_watcher.Deleted += onDeleted;
_watcher.Changed += onChanged;
_watcher.Renamed += onRenamed;
_watcher.Error += onError;
_watcher.EndInit();
_watcher.EnableRaisingEvents = true;
}
开发者ID:pragmatrix,项目名称:CrossUI,代码行数:30,代码来源:FileWatcher.cs
注:本文中的System.Windows.Threading.Dispatcher类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论