本文整理汇总了C#中IEventAggregator.GetEvent方法的典型用法代码示例。如果您正苦于以下问题:C# IEventAggregator.GetEvent方法的具体用法?C# IEventAggregator.GetEvent怎么用?C# IEventAggregator.GetEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEventAggregator
的用法示例。
在下文中一共展示了IEventAggregator.GetEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BadgerControlDrive
public BadgerControlDrive()
{
isEnabled = false;
hasControl = false;
isReady = false;
triedJoystick = false;
joystickMessageGiven = false;
componentOneActive = componentTwoActive = componentThreeActive = false;
joystickConfirmedFromVisualView = false;
joystickConfirmedFromStatusView = false;
_eventAggregator = ApplicationService.Instance.EventAggregator;
// create an empty ConnectionDetails struct and keep it around
connectionDetails = new ConnectionDetails();
connectionDetails.ai = ConnectionOption.DISCONNECTED;
connectionDetails.remote = ConnectionOption.DISCONNECTED;
connectionDetails.direct = ConnectionOption.DISCONNECTED;
// record which classes have confirmed the joystick. write to the console only when both have confirmed
_eventAggregator.GetEvent<ConfirmJoystickEvent>().Subscribe((confirmationID) =>
{
if (confirmationID == BadgerControlStatusView.JOYSTICK_ID)
joystickConfirmedFromStatusView = true;
else if (confirmationID == BadgerControlVisualView.JOYSTICK_ID)
joystickConfirmedFromVisualView = true;
if (JoyStickConfirmed && !joystickMessageGiven)
{
_eventAggregator.GetEvent<LoggerEvent>().Publish("Joystick connected.");
joystickMessageGiven = true; // jank hack to fix the duplicate event publishing due to multithreading
}
});
}
示例2: BasketViewModel
public BasketViewModel(
ILookAfterPets petRepository,
ILookAfterAccessories accessoryRepository,
IHandleMessages messenger,
IEventAggregator events)
{
_petRepository = petRepository;
_accessoryRepository = accessoryRepository;
_messenger = messenger;
_petBasket = new List<Pet>();
_accessoryBasket = new List<Accessory>();
events.GetEvent<NewPetEvent>().Subscribe(pet => NotifyPropertyChanged("AllAvailablePets"));
events.GetEvent<SoldPetEvent>().Subscribe(pet => NotifyPropertyChanged("AllAvailablePets"));
_accessoryRepository.OnAccessorySelected((o, e) =>
{
foreach (var accessory in e.Accessories)
{
if (!_accessoryBasket.Contains(accessory))
{
_accessoryBasket.Add(accessory);
}
}
NotifyPropertyChanged("Basket", "HasItemsInBasket", "Total", "PurchaseAllowed");
});
_accessoryRepository.OnAccessoryUnselected((o, e) =>
{
_accessoryBasket.RemoveAll(
a => e.Accessories.Contains(a));
NotifyPropertyChanged("Basket", "HasItemsInBasket", "Total", "PurchaseAllowed");
});
}
示例3: AdminAreaViewModel
public AdminAreaViewModel(IEventAggregator eventAggregator, QuestionGridViewModel questionGridViewModel,
RoundService roundService, StandingsService standingsService, InputService inputService)
{
_eventAggregator = eventAggregator;
_roundService = roundService;
_standingsService = standingsService;
_inputService = inputService;
QuestionGridViewModel = questionGridViewModel;
_round = 1;
ChangeRoundCommand = new DelegateCommand<object>(ChangedRound);
ShowScoresCommand = new DelegateCommand(() => _standingsService.ToggleShowScores());
IsSelecting = _standingsService.Players[new Random().Next(0, 4)];
_eventAggregator.GetEvent<CategoryClickedEvent>().Subscribe(DisplayQuestion);
_eventAggregator.GetEvent<ActivePlayerChangedEvent>().Subscribe(ActivePlayerChangedEventHandler);
_eventAggregator.GetEvent<NewSelectorEvent>().Subscribe((i) =>
{
IsSelecting = _standingsService.Players[i - 1];
});
_inputService.PropertyChanged +=
(s, e) =>
{
if(e.PropertyName.Equals("ActiveController"))
RaisePropertyChanged(() => CurrentActive);
};
_standingsService.PropertyChanged +=
(s, e) =>
{
if (e.PropertyName.Equals("TimeLeft"))
RaisePropertyChanged(() => TimeLeft);
};
}
示例4: MainPageViewModel
public MainPageViewModel(IDataRepository citiesRepository, INavigationService navigation, IEventAggregator eventAggregator)
{
_citiesRepository = citiesRepository;
_navigation = navigation;
_eventAggregator = eventAggregator;
var clocks = _citiesRepository.GetUsersCities();
Clocks = new ObservableCollection<CityInfo>(clocks);
_eventAggregator.GetEvent<AddCityMessage>().Subscribe(HandleAddCity, true);
_eventAggregator.GetEvent<DeleteCityMessage>().Subscribe(HandleDeleteCity, true);
Add = new RelayCommand(() =>
{
_navigation.Navigate(Experiences.CitySelector.ToString(), null);
});
Donate = new RelayCommand(() => Launcher.LaunchUriAsync(new Uri("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UFS2JX3EJGU3N")));
GoToDetails = new DelegateCommand<CityInfo>(HandleGotoDetails);
SetShowMenu = new RelayCommand(() =>
{
MenuActive = !MenuActive;
});
GoToSettings = new RelayCommand(() =>
{
_navigation.Navigate(Experiences.Settings.ToString(), null);
});
}
示例5: Shell
public Shell(IEventAggregator aggregator)
{
InitializeComponent();
aggregator.GetEvent<SaveLayoutEvent>().Subscribe(this.SaveLayout, ThreadOption.PublisherThread);
aggregator.GetEvent<LoadLayoutEvent>().Subscribe(this.LoadLayout, ThreadOption.PublisherThread);
Application.Current.Exit += (s, e) => this.SaveLayout(null);
}
示例6: PuzzleViewModel
public PuzzleViewModel(ICreateNinerViewModels ninerViewModelFactory, IEventAggregator events)
{
_numberRequestCommand = new NumberRequestCommand(events.GetEvent<NumberRequestEvent>());
_newGameRequestCommand = new DelegateCommand<Mode>(p =>
{
events.GetEvent<ModeRequestEvent>().Publish(Mode.NewGame);
GameCreated = false;
NotifyPropertyChanged(() => GameCreated);
});
_playGameRequestCommand = new DelegateCommand<Mode>(p =>
{
events.GetEvent<ModeRequestEvent>().Publish(Mode.PlayGame);
GameCreated = true;
NotifyPropertyChanged(() => GameCreated);
});
_askForHelpCommand = new DelegateCommand<object>(b => events.GetEvent<HintRequestEvent>().Publish(null));
events.GetEvent<HintProvidedEvent>().Subscribe(hint => HintText = hint.Text);
var ninerModels = new List<NinerViewModel>();
foreach (var id in Enumerable.Range(0, 9))
{
ninerModels.Add(ninerViewModelFactory.Create(id));
}
_niners = ninerModels;
}
示例7: CompareSentenceEditorView
public CompareSentenceEditorView(
SentenceEditorViewModel sentenceEditorViewModel,
IEventAggregator eventAggregator,
IAppConfig appConfig)
: this(eventAggregator, appConfig)
{
if (sentenceEditorViewModel == null)
{
throw new ArgumentNullException("sentenceEditorViewModel");
}
Loaded += SentenceEditorView_Loaded;
viewModel = sentenceEditorViewModel;
viewModel.ViewId = viewUniqueId;
DataContext = viewModel;
GgArea.ShowAllEdgesArrows();
GgArea.ShowAllEdgesLabels();
GgZoomCtrl.MouseLeftButtonUp += GgZoomCtrlMouseLeftButtonUp;
GgArea.GenerateGraphFinished += GgAreaGenerateGraphFinished;
GgArea.EdgeLabelFactory = new DefaultEdgelabelFactory();
eventAggregator.GetEvent<GenerateGraphEvent>().Subscribe(OnGenerateGraph);
eventAggregator.GetEvent<ZoomOnWordVertexEvent>().Subscribe(OnZoomOnWordVertex);
eventAggregator.GetEvent<ZoomToFillEvent>().Subscribe(ZoomToFill);
}
示例8: PackageDatabaseTreeViewModel
public PackageDatabaseTreeViewModel(CompositionContainer container, IEventAggregator eventAggregator, IPackageRepository repository)
{
this._eventAggregator = eventAggregator;
this._rootNodes = new ObservableCollection<PackageTreeNodeViewModel>();
this._container = container;
this._contextMenuStyleSelector = new ContextMenuItemStyleSelector();
this._repository = repository;
this._eventAggregator.GetEvent<CompositePresentationEvent<PackageDatabaseOpenedEvent>>()
.Subscribe(PackageDatabaseOpened, ThreadOption.UIThread, true);
eventAggregator.GetEvent<CompositePresentationEvent<PackageCreatedEvent>>().Subscribe(
x =>
{
_rootNodes.First().AddChild(new PackageNodeViewModel(x.NewPackage, this, container, _repository));
}, ThreadOption.UIThread, true);
eventAggregator.GetEvent<CompositePresentationEvent<AssetCreatedEvent>>().Subscribe(
x =>
{
var packageNode = _rootNodes.First().Children.Where(node => ((Package)node.Model).Id == x.NewAsset.PackageId).Single();
packageNode.AddChild(new AssetNodeViewModel(x.NewAsset, this, container));
}, ThreadOption.UIThread, true);
eventAggregator.GetEvent<CompositePresentationEvent<PackageDeletedEvent>>().Subscribe(
x =>
{
var packageNode = _rootNodes.First().Children.Where(node => ((Package)node.Model).Id == x.PackageId).Single();
_rootNodes.First().RemoveChild(packageNode);
}, ThreadOption.UIThread, true);
}
示例9: MainViewModel
public MainViewModel(IEventAggregator eventAggregator, IWindowDialogService dialogService, IConfirmDialogService confirmService, IRegionManager regionManager)
{
NavigationDetails = new Dictionary<string, NavigationDetails>
{
{
"Event Query", new NavigationDetails
{
SubNavigationPath = "/EventQuerySubView",
MainPath = "/EventQueryMainView"
}
},
{
"Data Maintenance", new NavigationDetails
{
SubNavigationPath = "/DataMaintenanceSubView",
MainPath = "/DataMaintenanceMainView"
}
}
};
ShowView = new DelegateCommand<string>(OnShowExecuted);
ExitCommand = new DelegateCommand(OnExit);
_regionManager = regionManager;
_eventAggregator = eventAggregator;
_dialogService = dialogService;
_confirmService = confirmService;
// Subscribe to user notification messages that we need to display
_eventAggregator.GetEvent<UserNotificationEvent>().Subscribe(DisplayUserMessage);
_eventAggregator.GetEvent<UserConfirmationEvent>().Subscribe(DisplayUserConfirmation);
_eventAggregator.GetEvent<BusyStartedEvent>().Subscribe(BusyStarted);
_eventAggregator.GetEvent<BusyFinishedEvent>().Subscribe(BusyFinished);
}
示例10: ProductsPresenterService
public ProductsPresenterService(IDatabaseAccessService databaseAccessService, IEventAggregator eventAggregator, IRegionManager regionManager)
{
this.regionManager = regionManager;
foreach (var databaseHandlerService in databaseAccessService.DatabaseHandlers)
{
var wrapper = new ProductsPresenterWrapper();
var loadingViewModel = new LoadingViewModel();
var loadingGrid = new LoadingGrid(loadingViewModel);
var productsViewModel = new ProductsViewModel(databaseHandlerService, eventAggregator, loadingViewModel);
var productsGrid = new ProductsGrid(productsViewModel);
var productEditorViewModel = new ProductEditorViewModel(databaseHandlerService, eventAggregator, productsViewModel);
var productEditorGrid = new ProductEditorGrid(productEditorViewModel);
wrapper.LoadingGrid = loadingGrid;
wrapper.ProductsGrid = productsGrid;
wrapper.ProductEditorGrid = productEditorGrid;
wrappers.Add(databaseHandlerService.ConnectionString, wrapper);
}
var connectionStringChangedEvent = eventAggregator.GetEvent<ConnectionStringChangedEvent>();
connectionStringChangedEvent.Subscribe(SetCurrentConnectionString);
var visualizeModuleEvent = eventAggregator.GetEvent<VisualizeModuleEvent>();
visualizeModuleEvent.Subscribe(VisualizeModule);
}
示例11: ShellViewModel
public ShellViewModel(IUserService userService, INavigationService navigationService, IEventAggregator eventAggregator)
{
_userService = userService;
_navigationService = navigationService;
_eventAggregator = eventAggregator;
eventAggregator.GetEvent<LoginEvent>().Subscribe(
(u) =>
{
CurrentUser = _userService.GetAuthenticatedUser();
NavigationPaneVisibility = Visibility.Visible;
},true);
eventAggregator.GetEvent<LogoutEvent>().Subscribe(
(u) =>
{
CurrentUser = _userService.GetAuthenticatedUser();
NavigationPaneVisibility = Visibility.Collapsed;
},true);
SingleInstance.SingleInstanceActivated += new EventHandler<SingleInstanceEventArgs>(SingleInstance_SingleInstanceActivated);
try
{
Version = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
}
catch (Exception ex)
{
Version = "Debug build";
}
}
示例12: AccountsPopupController
public AccountsPopupController(IEventAggregator eventAggregator)
{
eventAggregator.GetEvent<CreateAccountRequestEvent>().Subscribe(
OnCreateAccountRequest, ThreadOption.UIThread, true);
eventAggregator.GetEvent<EditAccountRequestEvent>().Subscribe(
OnEditAccountRequest, ThreadOption.UIThread, true);
}
示例13: CellViewModel
public CellViewModel(Cell cell, IEventAggregator events)
{
_cell = cell;
GotFocus = new DelegateCommand<string>( CellFocused);
_selectionEvent = events.GetEvent<CellSelectedEvent>();
_selectionEvent.Subscribe( c =>
{
Selected = _cell == c;
}); // Note: Could be memory leak due to event link
events.GetEvent<HintProvidedEvent>().Subscribe( hint =>
{
if( hint.Cells.Contains( _cell ) )
{
if (CellHinted != null) CellHinted(this, EventArgs.Empty);
}
});
var numberRequestEvent = events.GetEvent<NumberRequestEvent>();
numberRequestEvent.Subscribe(ToggleNumber);
var modeRequestEvent = events.GetEvent<ModeRequestEvent>();
modeRequestEvent.Subscribe(ChangeMode);
}
示例14: HistoryViewModel
public HistoryViewModel(PetRepository repository, IEventAggregator events)
{
_repository = repository;
_history = repository.History;
events.GetEvent<NewPetEvent>().Subscribe(pet => PetsChanged());
events.GetEvent<SoldPetEvent>().Subscribe(pet => PetsChanged());
}
示例15: HeadPageViewModel
public HeadPageViewModel(
IEventAggregator events,
MouthViewModel mouth,
RightEyeViewModel rightEye,
LeftEyeViewModel leftEye,
NoseViewModel nose,
INavigationService navService,
MotionActivatedSimpleAnimation animation)
{
_events = events;
_actionFacialCodingEventToken = _events.GetEvent<Events.ActionFacialCodingEvent>().Subscribe((args) =>
{
this.OnActionFacialCodingCommand(args);
}, ThreadOption.UIThread);
_sensorChangedEventToken = _events.GetEvent<Events.RangeSensorEvent>().Subscribe((args) =>
{
this.OnRangeSensorChanged(args);
}, ThreadOption.UIThread);
_navService = navService;
GoBackCommand = new DelegateCommand(_navService.GoBack);
NavigateControlCommand = new DelegateCommand(() => navService.Navigate("Control", null));
HideCommand = new DelegateCommand(this.Hide);
_mouth = mouth;
_rightEye = rightEye;
_leftEye = leftEye;
_nose = nose;
_animationService = animation;
Image = new BitmapImage(new Uri(@"ms-appx:///Assets/pumpkinbackground.png", UriKind.RelativeOrAbsolute));
}