本文整理汇总了C#中System.Windows.Threading.DispatcherTimer类的典型用法代码示例。如果您正苦于以下问题:C# DispatcherTimer类的具体用法?C# DispatcherTimer怎么用?C# DispatcherTimer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DispatcherTimer类属于System.Windows.Threading命名空间,在下文中一共展示了DispatcherTimer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XNAAsyncDispatcher
public XNAAsyncDispatcher(TimeSpan dispatchInterval)
{
FrameworkDispatcher.Update();
this._frameworkDispatcherTimer = new DispatcherTimer();
this._frameworkDispatcherTimer.Tick += new EventHandler(frameworkDispatcherTimer_Tick);
this._frameworkDispatcherTimer.Interval = dispatchInterval;
}
示例2: ViewModel
public ViewModel()
{
mgt = new ManagementClass("Win32_Processor");
procs = mgt.GetInstances();
CPU = new ObservableCollection<Model>();
timer = new DispatcherTimer();
random = new Random();
time = DateTime.Now;
cpuCounter = new PerformanceCounter();
cpuCounter.CategoryName = "Processor";
cpuCounter.CounterName = "% Processor Time";
cpuCounter.InstanceName = "_Total";
ramCounter = new PerformanceCounter("Memory", "Available MBytes");
ProcessorID = GetProcessorID();
processes = Process.GetProcesses();
Processes = processes.Length;
MaximumSpeed = GetMaxClockSpeed();
LogicalProcessors = GetNumberOfLogicalProcessors();
Cores = GetNumberOfCores();
L2Cache = GetL2CacheSize();
L3Cache = GetL3CacheSize();
foreach (ManagementObject item in procs)
L1Cache = ((UInt32)item.Properties["L2CacheSize"].Value / 2).ToString() + " KB";
timer.Interval = TimeSpan.FromMilliseconds(1000);
timer.Tick += timer_Tick;
timer.Start();
for (int i = 0; i < 60; i++)
{
CPU.Add(new Model(time, 0,0));
time = time.AddSeconds(1);
}
}
示例3: PlatformWpf
public PlatformWpf()
: base(null, true)
{
var app = new Application ();
var slCanvas = new Canvas ();
var win = new Window
{
Title = Title,
Width = Width,
Height = Height,
Content = slCanvas
};
var cirrusCanvas = new CirrusCanvas(slCanvas, Width, Height);
MainCanvas = cirrusCanvas;
win.Show ();
EntryPoint.Invoke (null, null);
var timer = new DispatcherTimer ();
timer.Tick += runDelegate;
timer.Interval = TimeSpan.FromMilliseconds (1);
timer.Start ();
app.Run ();
}
示例4: MainViewModel
public MainViewModel(IConfigurationService configService, INuiService nuiService, IKeyboardService keyboardService)
{
this.keyboardService = keyboardService;
this.keyboardService.KeyUp += new EventHandler<KeyEventArgs>(keyboardService_KeyUp);
this.configService = configService;
this.nuiService = nuiService;
this.nuiService.UserRaisedHand += new EventHandler<HandRaisedEventArgs>(nuiService_UserRaisedHand);
this.nuiService.UserEnteredBounds += new EventHandler(nuiService_UserEnteredBounds);
this.nuiService.UserExitedBounds += new EventHandler(nuiService_UserExitedBounds);
this.ToggleCommand = new RelayCommand(this.ExecuteToggleCommand);
this.AutoPlayCommand = new RelayCommand(this.ExecuteAutoPlayCommand);
this.ToggleKinectVisionCommand = new RelayCommand(this.ExecuteToggleKinectVisionCommand);
this.MainBackgroundBrush = (Brush)Application.Current.Resources["DefaultBackground"];
this.EngineeringBackgroundBrush = new SolidColorBrush(Color.FromArgb(255, 0, 49, 83));
this.videoTimer = new DispatcherTimer();
this.videoTimer.Interval = TimeSpan.FromMilliseconds(50);
this.videoTimer.Tick += new EventHandler(videoTimer_Tick);
this.videoTimer.Start();
if (!IsInDesignMode)
{
Application.Current.MainWindow.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
}
}
示例5: AdvancedSearch
public AdvancedSearch()
{
stockIcons = new StockIcons();
documentsStockIcon = stockIcons.DocumentAssociated;
videosStockIcon = stockIcons.VideoFiles;
musicStockIcon = stockIcons.AudioFiles;
picturesStockIcon = stockIcons.ImageFiles;
InitializeComponent();
// Set our default
DocumentsRadioButton.IsChecked = true;
//
prop1prop2OperationComboBox.SelectedIndex = 0;
// Because the search can take some time, using a background thread.
// This timer will check if that thread is still alive and accordingly update
// the cursor
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 1);
timer.IsEnabled = true;
timer.Tick += new EventHandler(timer_Tick);
}
示例6: FlyThru
public FlyThru()
{
// Start point/range
float xs = -0.5f;
float ys = 0.0f;
float rs = 3.0f;
// End point/range
float xe = -.2649f;
float ye = -.8506f;
float re = 0.00048828125f;
// Interpolate all the points in between
float l = 1.0f / (RenderPoints.Length - 1);
for (int i = 0; i < RenderPoints.Length; i++)
{
float scale = (float)Math.Pow(l * i, 0.03125);
RenderPoints[i] = Tuple.Create(xs + (xe - xs) * scale, ys + (ye - ys) * scale, rs + (re - rs) * scale);
}
// Initialize the visible elements, just for fun
XC = xs;
YC = ys;
Scale = rs;
IsRyuJIT = MainWindow.IsRyuJITLoaded() ? Visibility.Visible : Visibility.Collapsed;
// WPF initialization
InitializeComponent();
// Create the timer to update the screen
renderClock = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 16) };// 62.5 FPS should be sufficient
renderClock.Tick += renderClock_Tick;
}
示例7: Start
private void Start()
{
//this.Hide();
_timer = new DispatcherTimer();
_timer.Interval = TimeSpan.FromMilliseconds(10);
_timer.Tick += _timer_Tick;
_timer.Start();
_events = new Events();
_storage = new Storage(_events);
_trayIcon = new TrayIcon(this);
_events.OnInvokeDrop += _storage.Drop;
_events.OnInvokeExpire += _storage.Expire;
_events.OnInvokePeek += _storage.Peek;
_events.OnInvokePoke += _storage.Poke;
_events.OnInvokePinch += _storage.Pinch;
_events.OnInvokePop += _storage.Pop;
_events.OnInvokePush += _storage.Push;
_events.OnInvokeShunt += _storage.Shunt;
_events.OnInvokeReverse += _storage.Reverse;
_events.OnInvokeRotateLeft += _storage.RotateLeft;
_events.OnInvokeRotateRight += _storage.RotateRight;
_events.OnInvokeSwap += _storage.Swap;
_events.OnInvokeWipe += _storage.Wipe;
}
示例8: PointSymbolConfigControl
public PointSymbolConfigControl()
{
DefaultStyleKey = typeof(PointSymbolConfigControl);
_opacityChangedTimer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 500) };
_opacityChangedTimer.Tick += OpacityChangedTimer_Tick;
}
示例9: StartTimer
void StartTimer()
{
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(5);
timer.Tick += new EventHandler(timer_Elapsed);
timer.Start();
}
示例10: OverviewViewModel
public OverviewViewModel()
{
today = DateTime.Today;
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMinutes(1);
timer.Tick += (sender, args) =>
{
if (DateTime.Today <= today) return;
today = DateTime.Today;
UpdateHeaders();
};
timer.Start();
ItemSelectionChangedCommand = new ActionCommand(ItemSelectionChanged);
LinkCommand = new ActionCommand(ShowLink);
LoadedCommand = new ActionCommand(Loaded);
TodayCommand = new ActionCommand(_ => Show(MenuRepository.GetTodaysMenu()));
ExpandAllCommand = new ActionCommand(_ => SetAllExpansion(true));
CollapseAllCommand = new ActionCommand(_ =>
{
SetAllSelection(false);
SetAllExpansion(false);
});
}
示例11: WorkspaceViewModel
public WorkspaceViewModel()
{
var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
_workspaceDataUnit = dataUnitLocator.ResolveDataUnit<IWorkspaceDataUnit>();
_crmDataUnit = dataUnitLocator.ResolveDataUnit<ICrmDataUnit>();
_eventDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>();
var time = (int?)ApplicationSettings.Read("LogoutTime");
_logoutTime = (time.HasValue && time.Value > 0) ? time.Value : 30; // 30 minutes - default logout time
EventManager.RegisterClassHandler(typeof(Window), UIElement.KeyDownEvent, new RoutedEventHandler(Window_KeyDown));
EventManager.RegisterClassHandler(typeof(Window), UIElement.MouseDownEvent, new RoutedEventHandler(Window_MouseDown));
EventManager.RegisterClassHandler(typeof(Window), UIElement.MouseMoveEvent, new RoutedEventHandler(Window_MouseMove));
EventManager.RegisterClassHandler(typeof(Window), UIElement.MouseWheelEvent, new RoutedEventHandler(Window_MouseWheel));
_timer = new Timer(LogoutByInactivity, null, 1000 * 60 * _logoutTime, Timeout.Infinite);
_updateTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(30) };
_updateTimer.Tick += UpdateTimer_Tick;
_updateTimer.Start();
_updateTimerEvents = new DispatcherTimer { Interval = TimeSpan.FromSeconds(30) };
_updateTimerEvents.Tick += _updateTimerEvents_Tick;
_updateTimerEvents.Start();
}
示例12: DocumentViewModel
public DocumentViewModel(
IDialogService dialogService,
IWindowManager windowManager,
ISiteContextGenerator siteContextGenerator,
Func<string, IMetaWeblogService> getMetaWeblog,
ISettingsProvider settingsProvider,
IDocumentParser documentParser)
{
this.dialogService = dialogService;
this.windowManager = windowManager;
this.siteContextGenerator = siteContextGenerator;
this.getMetaWeblog = getMetaWeblog;
this.settingsProvider = settingsProvider;
this.documentParser = documentParser;
FontSize = GetFontSize();
title = "New Document";
Original = "";
Document = new TextDocument();
Post = new Post();
timer = new DispatcherTimer();
timer.Tick += TimerTick;
timer.Interval = delay;
}
示例13: MainWindow
public MainWindow()
{
InitializeComponent();
Stream iconResource = Assembly.GetExecutingAssembly().GetManifestResourceStream("DateTimeConverter.Images.Clock.ico");
this.Icon = BitmapFrame.Create(iconResource);
this.menuItemExit.Click += MenuItemExit_Click;
this.menuItemClear.Click += MenuItemClear_Click;
this.menuItemGithub.Click += MenuItemGithub_Click;
this.menuItemAbout.Click += MenuItemAbout_Click;
this.dateTimeOnRemoteComputer.Value = DateTime.Now;
this.dateTimeOnRemoteComputer.Format = Xceed.Wpf.Toolkit.DateTimeFormat.Custom;
this.dateTimeOnRemoteComputer.FormatString = this.dateTimeFormatStr;
this.dateTimeOnRemoteComputer.ValueChanged += DateTimeOnRemoteComputer_ValueChanged;
this.dateTimeOfEvent.Value = DateTime.Now;
this.dateTimeOfEvent.Format = Xceed.Wpf.Toolkit.DateTimeFormat.Custom;
this.dateTimeOfEvent.FormatString = this.dateTimeFormatStr;
this.dateTimeOfEvent.ValueChanged += DateTimeOfEvent_ValueChanged;
this.UpdateCurrentTime();
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(DispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Start();
}
示例14: StartTimer
public void StartTimer()
{
this.startTime = DateTime.Now;
this.timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(10) };
this.timer.Tick += this.OnTimerTick;
this.timer.Start();
}
示例15: DlGroupMigrationMain
public DlGroupMigrationMain()
{
InitializeComponent();
_timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1)};
_timer.Tick += _timer_Tick;
}