using Common.PubEvent; using Common.PubEvents; using NLog; using Prism.Dialogs; using Prism.Events; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Input; namespace BaseFrame.ViewModels { public class MainViewModel : BindableBase,INavigationAware,IDialogAware { #region 属性 #endregion #region 命令 public ICommand testcommand { get; set; } #endregion public DialogCloseListener RequestClose { get; set; } private IEventAggregator _eventAggregator; private IDialogService _dialogService; public MainViewModel(IEventAggregator eventAggregator, IDialogService dialogService) { _dialogService = dialogService; _eventAggregator = eventAggregator; testcommand = new DelegateCommand(test); } private void test() { //_eventAggregator.GetEvent().Publish(true); //var parameters = new DialogParameters //{ // { "Title", "提示" }, // { "Message", "操作成功!" }, // { "Icon", "info" }, // { "ShowOk", true } //}; //_dialogService.ShowDialog("MessageBox",parameters); } #region 导航 public void OnNavigatedTo(NavigationContext navigationContext) { } public bool IsNavigationTarget(NavigationContext navigationContext) { return true; } public void OnNavigatedFrom(NavigationContext navigationContext) { } #endregion #region 弹窗 public bool CanCloseDialog() { return true; } public void OnDialogClosed() { } public void OnDialogOpened(IDialogParameters parameters) { } #endregion } }