コード例 #1
0
        public MessageListViewModel(Prism.Events.IEventAggregator ea)
        {
            _ea      = ea;
            Messages = new System.Collections.ObjectModel.ObservableCollection <string>();

            _ea.GetEvent <UsingEventAggregator.Core.MessageSentEvent>().Subscribe(MessageReceived);
        }
コード例 #2
0
        public MessageListViewModel(Prism.Events.IEventAggregator ea)
        {
            _ea      = ea;
            Messages = new System.Collections.ObjectModel.ObservableCollection <string>();

            _ea.GetEvent <UsingFilteringEvents.Core.MessageSentEvent>().Subscribe(MessageReceived, Prism.Events.ThreadOption.PublisherThread, false, (filter) => filter.Contains("Brian"));
        }
コード例 #3
0
        public MainWindow(Prism.Events.IEventAggregator eventAggregator)
        {
            InitializeComponent();

            eventAggregator.GetEvent <Events.ErrorNotificationEvent>()
            .Subscribe((x) => {
                this.Dispatcher.Invoke(() =>
                {
                    var dialogView         = new ErrorMessageDialog();
                    dialogView.DataContext = x;
                    MaterialDesignThemes.Wpf.DialogHostEx.ShowDialog(this, dialogView);
                });
            });


            eventAggregator.GetEvent <Events.NowLoadingEvent>()
            .Subscribe(async(x) => {
                var dialogView         = new Loading();
                var vm                 = new ViewModels.LoadingViewModel(x);
                dialogView.DataContext = vm;
                await x.Semaphore.WaitAsync();
                try
                {
                    x.Result = (bool)await MaterialDesignThemes.Wpf.DialogHostEx.ShowDialog(this, dialogView);
                }
                finally
                {
                    x.Semaphore.Release();
                }
            });

            eventAggregator.GetEvent <Events.SelectedIndexForTabControlChangedEvent>()
            .Subscribe(async(x) =>
            {
                tabCtrl.SelectedIndex = x.SelectedIndex;
            });
        }
コード例 #4
0
 public MessageViewModel(Prism.Events.IEventAggregator ea)
 {
     _ea = ea;
     this.SendMessageCommand = new DelegateCommand(SendMessage);
 }
コード例 #5
0
        public MainPageViewModel(INavigationService navigationService, IDataService sourcesService, Prism.Events.IEventAggregator e) :
            base(navigationService)
        {
            _sourcesService    = sourcesService;
            _navigationService = navigationService;
            Title = "Holaaaa";
            _weatherDataSourceList = new ObservableCollection <WeatherDataSource>();
            //_OriginalWeatherDataSourcet = new ObservableCollection<WeatherDataSource>();
            //_realm = realm;
            _recentItemsList = new ObservableCollection <RecentItems>();

            //LanguageList = new ObservableCollection<Language>();
            //SearchButtonCommand = new DelegateCommand(ExecuteClick, CanExecuteClick);
            ExecuteCommand = new DelegateCommand(Execute);
            GetWeatherDataSourceFromAPI();
        }
コード例 #6
0
        public MasterContentPageViewModel(INavigationService navigationService, Realm realm, IDataService sourcesService, Prism.Events.IEventAggregator e) :
            base(navigationService)
        {
            Title = "Consulta el clima";
            _navigationService       = navigationService;
            _weatherDataSourceList   = new WeatherDataSource();
            _recentItemsList         = new ObservableCollection <RecentItems>();
            _OriginalrecentItemsList = new ObservableCollection <RecentItems>();
            _sourcesService          = sourcesService;
            _realm = realm;

            SearchButtonCommand   = new DelegateCommand(ExecuteClick, CanExecuteClick);
            ExecuteItemTapCommand = new DelegateCommand(ExecuteItemTap);

            CmdExecuteDeleteItemRecentList = new DelegateCommand <RecentItems>(DeleteItemRecentList);


            SearchCommand     = new  DelegateCommand(ExecuteSearchCommand);
            cmdRefreshCommand = new DelegateCommand(ExecuteRefreshCommand);

            cmdRefreshWhetherCommand = new DelegateCommand(ExecuteRefreshWhetherCommand);

            DeleteRecentItems();
            LoadRecentItemFromLocalDatabase();



            RecentItems itemfirstSelect = new RecentItems();

            itemfirstSelect = RecentItemsList.FirstOrDefault();
            if (itemfirstSelect != null)
            {
                GetWeatherDataSourceFromAPI(itemfirstSelect.Name);
            }
        }
コード例 #7
0
 public MainWindowViewModel(Prism.Events.IEventAggregator eventAggregator)
 {
     eventAggregator.GetEvent <Paver.Common.TileDataSelectedEvent>()
     .Subscribe((data) => SelectedTileData = data, Prism.Events.ThreadOption.UIThread);
 }
コード例 #8
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 /// <param name="eventAggregator"></param>
 public AppCultureService(Prism.Events.IEventAggregator eventAggregator)
 {
     this.ApplicationEventManager = eventAggregator;
     this.LanguageChangedEvent    = eventAggregator.GetEvent <Events.LanguageChangedEvent>();
 }