當前位置: 首頁>>代碼示例>>C#>>正文


C# Xaml.DispatcherTimer類代碼示例

本文整理匯總了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();
 }
開發者ID:RoguePlanetoid,項目名稱:Windows-10-Universal-Windows-Platform,代碼行數:27,代碼來源:Library.cs

示例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;
            }
        }
開發者ID:OPCFoundation,項目名稱:UA-.NETStandardLibrary,代碼行數:31,代碼來源:ServerDiagnosticsCtrl.xaml.cs

示例3: InitTimer

 private void InitTimer()
 {
     timer = new DispatcherTimer();
     timer.Tick += Timer_Tick;
     timer.Interval = TimeSpan.FromMilliseconds(1000);
     timer.Start();
 }
開發者ID:thomasjetzinger,項目名稱:smarthomecloud,代碼行數:7,代碼來源:MainPage.xaml.cs

示例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;

        }
開發者ID:traceyt,項目名稱:SensorTag-Azure,代碼行數:25,代碼來源:HomePage.xaml.cs

示例5: CalibrationBar

 public CalibrationBar()
 {
     this.InitializeComponent();
     _calibrationTimer = new DispatcherTimer();
     _calibrationTimer.Tick += OnAutoDismissTimerExpired;
     _calibrationTimer.Interval = CALIBRATION_POPUP_AUTO_DIMSMISS_TIME;
 }
開發者ID:ckc,項目名稱:WinApp,代碼行數:7,代碼來源:CalibrationBar.xaml.cs

示例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();
 }
開發者ID:shaoyiwork,項目名稱:WindowsIoT_SPIADC,代碼行數:7,代碼來源:MainPage.xaml.cs

示例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();
 }
開發者ID:AlyCrunch,項目名稱:samples,代碼行數:7,代碼來源:Projects.xaml.cs

示例8: DispatcherTimerSetup

 public void DispatcherTimerSetup()
 {
     dispatcherTimer = new DispatcherTimer();
     dispatcherTimer.Tick += dispatcherTimer_Tick;
     dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
     dispatcherTimer.Start();
 }
開發者ID:CarstenCors,項目名稱:BarcodeReader,代碼行數:7,代碼來源:MainPage.xaml.cs

示例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();
 }
開發者ID:toolboc,項目名稱:PhotonRGBHeartRateDisplay-,代碼行數:12,代碼來源:MainPage.xaml.cs

示例10: InkToTextBox

 public InkToTextBox()
 {
     this.DefaultStyleKey = typeof(InkToTextBox);
     timer = new DispatcherTimer();
     timer.Tick += Timer_Tick;
     timer.Interval = TimeSpan.FromSeconds(3);
 }
開發者ID:DanTheManSWE,項目名稱:Template10,代碼行數:7,代碼來源:InkToTextBox.cs

示例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;
        }
開發者ID:jleslie02,項目名稱:Knight-Watch-Windows-App,代碼行數:32,代碼來源:MainPage.xaml.cs

示例12: initTimer

 private void initTimer()
 {
     weathertimer = new DispatcherTimer();
     weathertimer.Interval = TimeSpan.FromHours(1); 
     weathertimer.Tick += Timer_Tick;
     weathertimer.Start();
 }
開發者ID:dotnetcurry,項目名稱:Windows10-UWP-HomePi,代碼行數:7,代碼來源:MainPage.xaml.cs

示例13: Render

 public Render()
 {
     InitializeComponent();
     Loaded += Render_Loaded;
     timer = new DispatcherTimer();
     frameIndex = 0;
 }
開發者ID:CatalystCode,項目名稱:BulletTime,代碼行數:7,代碼來源:Render.cs

示例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;
            };
        }
開發者ID:Nick287,項目名稱:IoTCoreDefaultAppForLEGOProject,代碼行數:30,代碼來源:TutorialMainPage.xaml.cs

示例15: MainPage

 public MainPage()
 {
     this.InitializeComponent();
     timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromSeconds(1);
     timer.Tick += Timer_Tick;
 }
開發者ID:jango2015,項目名稱:PhotonColor,代碼行數:7,代碼來源:MainPage.xaml.cs


注:本文中的Windows.UI.Xaml.DispatcherTimer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。