This commit is contained in:
sc committed 2024-10-28 23:39:22 +08:00
commit 7c5541de04
11 files changed
+101 -1328

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
/// <summary>
/// 变量传递至ui
/// </summary>
public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
if (propertyName != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
public class MainWindowViewModel : ViewModelBase
{
}
}
+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommonServiceLocator;
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
public class ViewModelLocator
{
public ViewModelLocator()
{
}
public MainWindowViewModel Main
{
get
{
return ServiceLocator.Current.GetInstance<MainWindowViewModel>();
}
}
}
}