本文整理匯總了C#中Windows.UI.Xaml.DispatcherTimer.Start方法的典型用法代碼示例。如果您正苦於以下問題:C# DispatcherTimer.Start方法的具體用法?C# DispatcherTimer.Start怎麽用?C# DispatcherTimer.Start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows.UI.Xaml.DispatcherTimer
的用法示例。
在下文中一共展示了DispatcherTimer.Start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Load
public async Task Load()
{
var x = 0;
var max = 20;
var y = 0;
var items = ResourceFileParser.GetKeysBasedOn(@"Common\StandardStyles.xaml", "AppBarButtonStyle");
t = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(50) };
t.Tick += (s, e) =>
{
t.Stop();
for (int index = x; index < items.Count; index++)
{
y++;
var i = items[index];
buttonGroup.Items.Add(i);
if (y % max == 0)
{
x = index;
if (y < items.Count)
t.Start();
break;
}
}
};
t.Start();
}
示例2: NodesViewPage
// public ObservableCollection<Model> Models { get; set; }
public NodesViewPage()
{
this.InitializeComponent();
App.serialController.OnNewNodeEvent += AddNode;
App.serialController.OnNodeUpdatedEvent += UpdateNode;
App.serialController.OnSensorUpdatedEvent += UpdateSensor;
App.serialController.OnClearNodesList += OnClearNodesList;
if (App.serialController.IsConnected())
{
textBlock3.Visibility = Visibility.Collapsed;
itemsControl1.Visibility = Visibility.Visible;
ShowNodes();
}
else
{
textBlock3.Text = "Device is not connected";
textBlock3.Visibility = Visibility.Visible;
itemsControl1.Visibility = Visibility.Collapsed;
}
refrashTimer = new DispatcherTimer();
refrashTimer.Interval = TimeSpan.FromMilliseconds(100);
refrashTimer.Tick += RefrashInfoTimer;
refrashTimer.Start();
}
示例3: InitTimer
private void InitTimer()
{
timer = new DispatcherTimer();
timer.Tick += Timer_Tick;
timer.Interval = TimeSpan.FromMilliseconds(1000);
timer.Start();
}
示例4: 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;
}
}
示例5: LoadData
private void LoadData()
{
if (dispatcherTimer == null)
{
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 5);
dispatcherTimer.Tick += DispatcherTimer_Tick;
dispatcherTimer.Start();
}
if (Accounts == null)
Accounts = new ObservableCollection<Account>();
else
Accounts.Clear();
foreach (Account a in App.Accounts)
{
Accounts.Add(a);
}
if (Accounts.Count > 0)
{
this.prgStatusBar.Visibility = Windows.UI.Xaml.Visibility.Visible;
this.txtEmpty.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
else
{
this.prgStatusBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
this.txtEmpty.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
}
示例6: StartScenarioAsync
private async Task StartScenarioAsync()
{
string i2cDeviceSelector = I2cDevice.GetDeviceSelector();
IReadOnlyList<DeviceInformation> devices = await DeviceInformation.FindAllAsync(i2cDeviceSelector);
// 0x40 was determined by looking at the datasheet for the HTU21D sensor.
var HTU21D_settings = new I2cConnectionSettings(0x40);
// If this next line crashes with an ArgumentOutOfRangeException,
// then the problem is that no I2C devices were found.
//
// If the next line crashes with Access Denied, then the problem is
// that access to the I2C device (HTU21D) is denied.
//
// The call to FromIdAsync will also crash if the settings are invalid.
//
// FromIdAsync produces null if there is a sharing violation on the device.
// This will result in a NullReferenceException in Timer_Tick below.
htu21dSensor = await I2cDevice.FromIdAsync(devices[0].Id, HTU21D_settings);
// Start the polling timer.
timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(500) };
timer.Tick += Timer_Tick;
timer.Start();
}
示例7: MainPage
public MainPage()
{
InitializeComponent();
DispatcherTimer timer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(1)};
timer.Tick += Timer_Tick;
timer.Start();
}
示例8: DispatcherTimerSetup
public void DispatcherTimerSetup()
{
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += dispatcherTimer_Tick;
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Start();
}
示例9: InitTimer
private void InitTimer()
{
timer = new DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 2);
timer.Tick += TimerTick;
timer.Start();
}
示例10: Start
public override void Start()
{
_timer = new DispatcherTimer();
_timer.Tick += _timer_Tick;
_timer.Interval = new TimeSpan(0, 0, 0, 1);
_timer.Start();
}
示例11: LoadData
public async void LoadData()
{
IsDataLoaded = false;
OnAir = await RadioBox2Service.GetNowOnAir(Item.Channel.ToString());
Broadcast = await RadioBox2Service.GetCurrentBroadcast(Item.Channel.ToString());
if (_nowOnAirRefreshTimer == null)
{
_nowOnAirRefreshTimer = new DispatcherTimer();
_nowOnAirRefreshTimer.Interval = DateTime.Now.AddMilliseconds(30000) - DateTime.Now;
_nowOnAirRefreshTimer.Tick += new EventHandler<object>(LoadOnAir);
_nowOnAirRefreshTimer.Start();
}
if (_broadcastRefreshTimer == null)
{
_broadcastRefreshTimer = new DispatcherTimer();
_broadcastRefreshTimer.Interval = DateTime.Now.AddMilliseconds(120000) - DateTime.Now;
_broadcastRefreshTimer.Tick += new EventHandler<object>(LoadBroadcast);
_broadcastRefreshTimer.Start();
}
LoadProgramme();
IsDataLoaded = true;
}
示例12: FlyPage
public FlyPage()
{
this.InitializeComponent();
//if (Application.Current.Resources.ContainsKey("DroneClient"))
//{
// _droneClient = (DroneClient)Application.Current.Resources["DroneClient"];
//}
//else
//{
// _droneClient = new DroneClient();
//}
_droneClient = DroneClient.Instance;
//Register joysticks
if (_droneClient.InputProviders.Count == 0)
{
_droneClient.InputProviders.Add(new XBox360JoystickProvider(_droneClient));
_droneClient.InputProviders.Add(new SoftJoystickProvider(_droneClient, RollPitchJoystick, YawGazJoystick));
}
this.DataContext = _droneClient;
this.DefaultViewModel["Messages"] = _droneClient.Messages;
_Timer = new DispatcherTimer();
_Timer.Tick += _Timer_Tick;
_Timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
_Timer.Start();
}
示例13: InitializeTimer
private void InitializeTimer()
{
_timer = new DispatcherTimer();
_timer.Interval = TimeSpan.FromMilliseconds(100);
_timer.Tick += Tick;
_timer.Start();
}
示例14: App
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
// Initialize AI telemetry in the app.
WindowsAppInitializer.InitializeAsync();
// Timer uploading hearbeat telemetry event
HeartbeatTimer = new DispatcherTimer();
HeartbeatTimer.Tick += HeartbeatTimer_Tick;
HeartbeatTimer.Interval = new TimeSpan(0, heartbeatInterval, 0); // tick every heartbeatInterval
HeartbeatTimer.Start();
// Retrieve and set environment settings
OSVersion = EnvironmentSettings.GetOSVersion();
appVersion = EnvironmentSettings.GetAppVersion();
deviceName = EnvironmentSettings.GetDeviceName();
ipAddress = EnvironmentSettings.GetIPAddress();
this.InitializeComponent();
this.Suspending += OnSuspending;
this.Resuming += OnResuming;
Controller = new AppController();
}
示例15: MainPage
public MainPage()
{
this.InitializeComponent();
fileSetting = TextToFileSetting(fileSettingStr);
randomSetting = TextToRandomSetting(randomSettingStr);
serialSetting = TextToSerialSetting(serialSettingStr);
remoteSetting = TextToRemoteSetting(remoteSettingStr);
comboBoxDataSource.Items.Add(DataSourceFileStr);
comboBoxDataSource.Items.Add(DataSourceSerialStr);
comboBoxDataSource.Items.Add(DataSourceRandomStr);
comboBoxDataSource.Items.Add(DataSourceRemoteClientStr);
comboBoxStreaming.Items.Add(StreamNothingStr);
comboBoxStreaming.Items.Add(StreamLogStr);
comboBoxStreaming.Items.Add(StreamPowerStr);
comboBoxStreaming.Items.Add(StreamBothStr);
comboBoxStreaming.Items.Add(StreamRealDataStr);
dTimerUpdateData = new DispatcherTimer();
dTimerUpdateData.Tick += UpdateDataTick;
dTimerUpdateData.Interval = new TimeSpan(0, 0, 0, 0, 250);
dTimerUpdateData.Start();
dTimerUpdateText = new DispatcherTimer();
dTimerUpdateText.Tick += UpdateTextTick;
dTimerUpdateText.Interval = new TimeSpan(0, 0, 0, 1, 0);
}