本文整理匯總了C#中Windows.UI.Xaml.DispatcherTimer類的典型用法代碼示例。如果您正苦於以下問題:C# DispatcherTimer類的具體用法?C# DispatcherTimer怎麽用?C# DispatcherTimer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DispatcherTimer類屬於Windows.UI.Xaml命名空間,在下文中一共展示了DispatcherTimer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: layout
private void layout(StackPanel panel)
{
for (int i = 0; i < 8; i++)
{
panel.Children.Add(new Digital()
{
Digit = 10,
Height = 50,
Margin = new Thickness(5)
});
}
DispatcherTimer timer = new DispatcherTimer()
{
Interval = TimeSpan.FromMilliseconds(250)
};
timer.Tick += (object sender, object e) =>
{
string time = DateTime.Now.ToString("HH:mm:ss");
for (int i = 0; i < 8; i++)
{
string interval = time[i].ToString();
((Digital)panel.Children[i]).Digit =
interval == ":" ? 11 : int.Parse(interval);
}
};
timer.Start();
}
示例2: Initialize
/// <summary>
/// Creates a form which displays the status for a UA server.
/// </summary>
/// <param name="server">The server displayed in the form.</param>
/// <param name="configuration">The configuration used to initialize the server.</param>
public void Initialize(StandardServer server, ApplicationConfiguration configuration)
{
m_server = server;
m_configuration = configuration;
m_dispatcherTimer = new DispatcherTimer();
m_dispatcherTimer.Tick += UpdateTimerCTRL_Tick;
m_dispatcherTimer.Interval = new TimeSpan(0, 0, 5); // tick every 5 seconds
m_dispatcherTimer.Start();
// add the urls to the drop down.
UrlCB.Items.Clear();
foreach (EndpointDescription endpoint in m_server.GetEndpoints())
{
if (!UrlCB.Items.Contains(endpoint.EndpointUrl))
{
UrlCB.Items.Add(endpoint.EndpointUrl);
}
}
if (UrlCB.Items.Count > 0)
{
UrlCB.SelectedIndex = 0;
}
}
示例3: InitTimer
private void InitTimer()
{
timer = new DispatcherTimer();
timer.Tick += Timer_Tick;
timer.Interval = TimeSpan.FromMilliseconds(1000);
timer.Start();
}
示例4: HomePage
public HomePage()
{
this.InitializeComponent();
localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
//StatusField.Text = "Please ensure the sensor is connected";
app = App.Current as SensorTagReader.App;
if (app.HorseName != null) HorseNameField.Text = app.HorseName;
if (app.SessionID != null)
SesssionIDField.Text = app.SessionID;
else
SesssionIDField.Text = _sessionID;
tagReaders = new List<TagReaderService>();
deviceInfoService = new DeviceInfoService();
eventHubWriterTimer = new DispatcherTimer();
eventHubWriterTimer.Interval = new TimeSpan(0, 0, 1);
eventHubWriterTimer.Tick += OnEventHubWriterTimerTick;
}
示例5: CalibrationBar
public CalibrationBar()
{
this.InitializeComponent();
_calibrationTimer = new DispatcherTimer();
_calibrationTimer.Tick += OnAutoDismissTimerExpired;
_calibrationTimer.Interval = CALIBRATION_POPUP_AUTO_DIMSMISS_TIME;
}
示例6: MainPage
public MainPage() {
this.InitializeComponent();
m_timer = new DispatcherTimer();
m_timer.Interval = TimeSpan.FromMilliseconds(500); //100, 500
m_timer.Tick += dispatcher_timer_Tick; ;
InitSPIAndTimer();
}
示例7: CheckDataLoaded
private void CheckDataLoaded()
{
this._timer = new DispatcherTimer();
this._timer.Tick += timer_Tick;
this._timer.Interval = new TimeSpan(0, 0, 1);
this._timer.Start();
}
示例8: DispatcherTimerSetup
public void DispatcherTimerSetup()
{
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += dispatcherTimer_Tick;
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Start();
}
示例9: OnNavigatedTo
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached.
/// This parameter is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Stop();
}
示例10: InkToTextBox
public InkToTextBox()
{
this.DefaultStyleKey = typeof(InkToTextBox);
timer = new DispatcherTimer();
timer.Tick += Timer_Tick;
timer.Interval = TimeSpan.FromSeconds(3);
}
示例11: MainPage
public MainPage()
{
this.InitializeComponent();
TheFlipView.Items[0] = new HelpDesk();
TheFlipView.Items[1] = new PowerView();
TheFlipView.Items[2] = new NetworkM();
TheFlipView.Items[3] = new VirtualE();
//Configure the timer
_timer = new DispatcherTimer
{
//Set the interval between ticks (in this case 8 seconds to see it working)
Interval = TimeSpan.FromSeconds(8)
};
if (count == 0)
{ //Start the timer
_timer.Start();
//Change what's displayed when the timer ticks
count++;
}
_timer.Tick += ChangePage;
// this.Loaded += MainPage_Loaded;
}
示例12: initTimer
private void initTimer()
{
weathertimer = new DispatcherTimer();
weathertimer.Interval = TimeSpan.FromHours(1);
weathertimer.Tick += Timer_Tick;
weathertimer.Start();
}
示例13: Render
public Render()
{
InitializeComponent();
Loaded += Render_Loaded;
timer = new DispatcherTimer();
frameIndex = 0;
}
示例14: TutorialMainPage
public TutorialMainPage()
{
this.InitializeComponent();
#if !ALWAYS_SHOW_BLINKY
if (DeviceTypeInformation.Type != DeviceTypes.RPI2 && DeviceTypeInformation.Type != DeviceTypes.DB410)
{
TutorialList.Items.Remove(HelloBlinkyGridViewItem);
}
#endif
this.NavigationCacheMode = NavigationCacheMode.Enabled;
this.DataContext = LanguageManager.GetInstance();
this.Loaded += (sender, e) =>
{
UpdateBoardInfo();
UpdateDateTime();
timer = new DispatcherTimer();
timer.Tick += timer_Tick;
timer.Interval = TimeSpan.FromSeconds(30);
timer.Start();
};
this.Unloaded += (sender, e) =>
{
timer.Stop();
timer = null;
};
}
示例15: MainPage
public MainPage()
{
this.InitializeComponent();
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
}