Squashed 'FSI.Lib/' content from commit dceb500
git-subtree-dir: FSI.Lib git-subtree-split: dceb5008a2176c2b8ab5e55a73b1c25d31a7f841
This commit is contained in:
40
FSI.Lib/MVVM/ViewModel/CurrentTimeViewModel.cs
Normal file
40
FSI.Lib/MVVM/ViewModel/CurrentTimeViewModel.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FSI.Lib.MVVM.ViewModel
|
||||
{
|
||||
public class CurrentTimeViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private string _currentTime;
|
||||
|
||||
public CurrentTimeViewModel()
|
||||
{
|
||||
UpdateTime();
|
||||
}
|
||||
|
||||
private async void UpdateTime()
|
||||
{
|
||||
CurrentTime = DateTime.Now.ToString("G");
|
||||
await Task.Delay(1000);
|
||||
UpdateTime();
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public string CurrentTime
|
||||
{
|
||||
get { return _currentTime; }
|
||||
set { _currentTime = value; OnPropertyChanged(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user