public MainWindowViewModel(IEventAggregator ea, MinecraftRepository mr) { EventAggregator = ea; MinecraftRepository = mr; Errors = new ObservableCollection <ErrorViewModel>(); MergeLogCommand = new DelegateCommand <ProfileViewModel>(async(p) => await MergeLogAsync(p)); EventAggregator.GetEvent <ProgressNotificationEvent>().Subscribe(OnProgress, ThreadOption.UIThread); EventAggregator.GetEvent <ProfilesRefreshEvent>().Subscribe(async(param) => await RefreshProfilesAsync(), ThreadOption.UIThread); EventAggregator.GetEvent <ErrorNotificationEvent>().Subscribe(AddError, ThreadOption.UIThread); ErrorClearCommand = new DelegateCommand(ClearError); Task.Run(async() => await RefreshProfilesAsync()); }
public ProfileViewModel(IEventAggregator ea, MinecraftRepository mr, Profile pr) { EventAggregator = ea; MinecraftRepository = mr; Profile = pr; IsExistFolder = Directory.Exists(Profile.gameDir); IsExistLogFolder = Directory.Exists(Profile.LogFolderPath); IsExistMergedLog = File.Exists(Profile.MergedLogFilePath); NotificationRequest = new InteractionRequest <INotification>(); OpenRefreshedMergedLogCommand = new DelegateCommand(async() => await OpenRefreshedMergedLogAsync(), CanOpenRefreshedMergedLog); OpenMergedLogCommand = new DelegateCommand(OpenMergedLog, CanOpenMergedLog); OpenFolderCommand = new DelegateCommand(OpenFolder, CanOpenFolder); }