本文整理汇总了C#中System.Windows.Threading.DispatcherTimer类的典型用法代码示例。如果您正苦于以下问题:C# DispatcherTimer类的具体用法?C# DispatcherTimer怎么用?C# DispatcherTimer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DispatcherTimer类属于System.Windows.Threading命名空间,在下文中一共展示了DispatcherTimer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: XNAAsyncDispatcher
public XNAAsyncDispatcher(TimeSpan dispatchInterval)
{
FrameworkDispatcher.Update();
this._frameworkDispatcherTimer = new DispatcherTimer();
this._frameworkDispatcherTimer.Tick += new EventHandler(frameworkDispatcherTimer_Tick);
this._frameworkDispatcherTimer.Interval = dispatchInterval;
}
开发者ID:jasonkuster,项目名称:MetroLooper,代码行数:7,代码来源:XNAAsyncDispatcher.cs
示例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);
}
}
开发者ID:jcw-,项目名称:sparrowtoolkit,代码行数:34,代码来源:ViewModel.cs
示例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 ();
}
开发者ID:chkn,项目名称:cirrus,代码行数:27,代码来源:Bootstrap.cs
示例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);
}
}
开发者ID:kindohm,项目名称:getstem-kinect-3d,代码行数:25,代码来源:MainViewModel.cs
示例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);
}
开发者ID:Prashant-Jonny,项目名称:phever,代码行数:25,代码来源:AdvancedSearch.xaml.cs
示例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;
}
开发者ID:h8null,项目名称:csharpSIMD,代码行数:33,代码来源:FlyThru.xaml.cs
示例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;
}
开发者ID:jaywick,项目名称:pastr,代码行数:27,代码来源:MainWindow.xaml.cs
示例8: PointSymbolConfigControl
public PointSymbolConfigControl()
{
DefaultStyleKey = typeof(PointSymbolConfigControl);
_opacityChangedTimer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 500) };
_opacityChangedTimer.Tick += OpacityChangedTimer_Tick;
}
开发者ID:Esri,项目名称:arcgis-viewer-silverlight,代码行数:7,代码来源:PointSymbolConfigControl.cs
示例9: StartTimer
void StartTimer()
{
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(5);
timer.Tick += new EventHandler(timer_Elapsed);
timer.Start();
}
开发者ID:ttss2272,项目名称:his,代码行数:7,代码来源:Welcome.xaml.cs
示例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);
});
}
开发者ID:lycilph,项目名称:Projects,代码行数:26,代码来源:OverviewViewModel.cs
示例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();
}
开发者ID:syatin003,项目名称:Wpf,代码行数:27,代码来源:WorkspaceViewModel.cs
示例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;
}
开发者ID:larsw,项目名称:DownmarkerWPF,代码行数:25,代码来源:DocumentViewModel.cs
示例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();
}
开发者ID:alonrotem,项目名称:DateTimeConverter,代码行数:28,代码来源:MainWindow.xaml.cs
示例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();
}
开发者ID:EBojilova,项目名称:CSharpHQC,代码行数:7,代码来源:OrbitsCalculator.cs
示例15: DlGroupMigrationMain
public DlGroupMigrationMain()
{
InitializeComponent();
_timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1)};
_timer.Tick += _timer_Tick;
}
开发者ID:Microsoft,项目名称:hummingbird,代码行数:7,代码来源:DLGroupMigrationMain.xaml.cs
示例16: ClearMineGame
public ClearMineGame()
{
timer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 100) };
timer.Tick += OnTick;
Settings.Default.PropertyChanged += OnSettingsChanged;
MessageManager.SubscribeMessage<CellStateMessage>(OnCellStatusChanged);
}
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:7,代码来源:ClearMineGame.cs
示例17: ViewModel
public ViewModel()
{
Current = this;
PrimarySerial.NewMessageReceived += PrimarySerial_NewMessageReceived;
if (IsDebugMode)
{
DispatcherTimer dt = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(1) };
dt.Tick += delegate
{
if (!IsRandomizerEnabled || Calibrator.ActiveCalibrationSub == null)
return;
double val = 0;
switch (Calibrator.CalibrationTarget)
{
case CalibrationTarget.Pump:
weight = weight + rnd.NextDouble() * (double)Calibrator.ActiveCalibrationSub.Setpoint / 500000;
val = weight;
break;
case CalibrationTarget.Stirrer:
val = (0.7 * rnd.NextDouble() + 0.3) * (double)Calibrator.ActiveCalibrationSub.Setpoint / 60;
break;
}
if (Calibrator.ActiveCalibrationSub != null)
Calibrator.ActiveCalibrationSub.AddPoint(new DataPoint(DateTime.Now, val));
};
dt.Start();
}
}
开发者ID:igemsoftware,项目名称:Aachen_2015,代码行数:28,代码来源:ViewModel.cs
示例18: StartPage
public StartPage()
{
InitializeComponent();
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = TimeSpan.FromMilliseconds(1);
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
}
开发者ID:GhostSoar,项目名称:JigsawPuzzle,代码行数:7,代码来源:StartPage.xaml.cs
示例19: startclock
private void startclock()
{
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += tickevent;
timer.Start();
}
开发者ID:RineshRamadhin,项目名称:Smart-Mirror-App,代码行数:7,代码来源:MainWindow.xaml.cs
示例20: UpdateProgressViewModel
public UpdateProgressViewModel(UpdateManager updateManger,IProductUpdate productUpdate)
{
_updateManger = updateManger;
_productUpdate = productUpdate;
_dispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, Dispatcher.CurrentDispatcher);
StartUpdateProgressTimer();
}
开发者ID:jormenjanssen,项目名称:Soundboard,代码行数:7,代码来源:UpdateProgressViewModel.cs
注:本文中的System.Windows.Threading.DispatcherTimer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论