public NotificationPageViewModel(IAllPageModel page, INotificationOnAndOff NotificationOnAndOff) { //_page = page; //OnCommand = new DelegateCommand(() => _page.NotificationOn()); //OffCommand = new DelegateCommand(() => _page.NotificationOff()); _NotificationOnAndOff = NotificationOnAndOff; OnCommand = new DelegateCommand(() => _NotificationOnAndOff.NotificationOn()); OffCommand = new DelegateCommand(() => _NotificationOnAndOff.NotificationOff()); }
// いったんコメントアウト これが実行されない // ^> IDependencyService dependencyServiceすればいけるけど解せない // https://prismlibrary.com/docs/xamarin-forms/Dependency-Service.html public MainPageViewModel(IPageDialogService pageDialogService, INavigationService navigationService, IDependencyService dependencyService) : base(navigationService) { System.Diagnostics.Debug.WriteLine("(´・ω・`)ViewModel start"); ISaveAndLoad sal = dependencyService.Get <ISaveAndLoad>(); INotificationOnAndOff ins = dependencyService.Get <INotificationOnAndOff>(); ICreateService ics = dependencyService.Get <ICreateService>(); Model = new MainPageModel(sal, ins, ics); this.Model.PropertyChanged += Model_PropertyChanged; _pageDialogService = pageDialogService; Title = "通知メモ"; // _pageDialogService.DisplayAlertAsync("確認", "利用するには他のアプリの上に重ねて表示する権限を許可してください。", "はい"); //if (!ics.CheckPermission()) //{ // _pageDialogService.DisplayAlertAsync("確認", "利用するには他のアプリの上に重ねて表示する権限を許可してください。", "はい"); //} }
/// <summary> /// コンストラクタです。VMからInterfaceを受け取りModelで使用可能にします。 /// </summary> /// <param name="sal">ISaveAndLoad インターフェイス型</param> /// <param name="ins">INotificationOnAndOff インターフェイス型</param> /// <param name="ics">ICreateService インターフェイス型</param> public MainPageModel(ISaveAndLoad sal, INotificationOnAndOff ins, ICreateService ics) { SaveAndLoad = sal; NotificationService = ins; CreateService = ics; }
public AllPageModel(INotificationOnAndOff notificationOnAndOff, ICreateOverrayView createOverrayView, IUsageStatsManager usageStatsManager) { this.NotificationOnOff = notificationOnAndOff; this.CreateOverrayView = createOverrayView; this.UsageStatsManager = usageStatsManager; }