using Avalonia.Controls; using kuzminIVProjectWorkOnDemo.Models; using ReactiveUI; namespace kuzminIVProjectWorkOnDemo.ViewModels { public class MainWindowViewModel : ViewModelBase { static KuzmintestprojContext db = new KuzmintestprojContext(); //public string Greeting => "Welcome to Avalonia!"; string adminkey; public string Adminkey { get => adminkey; set { adminkey = value; adminMethod(); } } private UserControl userControl = new ServiceListPage(); public UserControl UserControl { get { return userControl; } set => this.RaiseAndSetIfChanged(ref userControl, value); } #region serviceList private ServiceListPageViewModel serviceListNewWM = new ServiceListPageViewModel(db); public ServiceListPageViewModel ServiceListPageWM { get => serviceListNewWM; set => serviceListNewWM = value; } #endregion void adminMethod() { if (Adminkey == "0000") { Models.Sevice.IsVisibleAdmin = true; UserControl = new ServiceListPage(); } else { Models.Sevice.IsVisibleAdmin = false; UserControl = new ServiceListPage(); } } } }