본문 바로가기
C#/C# WPF

Timer

by doublerabbits 2022. 7. 29.
using MCP_Starter.Models;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Windows.Input;
using System.Windows.Threading;

namespace MCP_Starter.ViewModels
{
    public partial class MainWindowViewModel : BindableBase
    {
    	
        ...
        
        DispatcherTimer timer;

        void Initialize_Update(int updateInterval = 100)
        {
            timer = new DispatcherTimer();
            timer.Tick += Update;
            timer.Interval = TimeSpan.FromMilliseconds(updateInterval);
            timer.Start();
        }

        void Update(object sender, EventArgs e)
        {
            Msg.HideProcedure();
        }
        
        public MainWindowViewModel()
        {
            Initialize_Update();
        }

		...
        
    }
}

'C# > C# WPF' 카테고리의 다른 글

View - ViewModel 바인딩 이름  (0) 2022.08.15
Prism Template Pack  (0) 2022.08.15
Command Binding  (0) 2022.07.29
Converter  (0) 2022.07.23
WPF Label Underline  (0) 2022.07.16