public void BuildingLoaded(object sender, NotificationEventArgs<Project> e) { // if (Project==null || e.Data.ProjectID != Project.ProjectID) return; //model.Initialize(); var view = this; var project = e.Data; view.DataContext = project; var buildingModel = new ThermalBuildingModel(project); if (view != null) { view.Mediator = new Mediator(buildingModel); //view.Mediator.Add3DView(view.mainView3D); view.Mediator.Add3DView(Mediator.Instance.MainView3D); } var model = (ThermalBuildingModel)Mediator.Controller3D.Model; if (e.Data.Building != null) { model.LoadBuildingData(e.Data.Building.ToList().FirstOrDefault()); Mediator.Controller3D.View.Clear(); Mediator.Controller3D.SetUpScene(); //this.Region3D.Content = Mediator.Instance.MainView3D; } }
private void OnModifyOrderNotice(object sender, NotificationEventArgs<Order> eventArgs) { // Create order view model and view var orderDetail = new OrderDetailView(eventArgs.Data); orderDetail.Owner = Window.GetWindow(this); // Show order detail dialog orderDetail.ShowDialog(); }
private void OnDeleteOrderNotice(object sender, NotificationEventArgs<Order, bool> eventArgs) { // Prompt user to delete order if (MessageBox.Show("Do you wish to delete this order?", "Delete Order", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) { eventArgs.Completed(true); } }
public void BuildingLoaded(object sender, NotificationEventArgs<Project> e) { if (Project==null || e.Data.ProjectID != Project.ProjectID) return; var model = (ThermalBuildingModel)Mediator.Controller3D.Model; //model.Initialize(); if (e.Data.Building != null) { model.LoadBuildingData(e.Data.Building.ToList().FirstOrDefault()); Mediator.Controller3D.SetUpScene(); } }
private void OnCreateOrderNotice(object sender, NotificationEventArgs<Order> eventArgs) { // Create order view model and view var orderDetail = new OrderDetailView(eventArgs.Data); orderDetail.Owner = Window.GetWindow(this); // Show order detail dialog if (orderDetail.ShowDialog() == false) return; // Add new order _viewModel.AddNewOrder(orderDetail.ViewModel.Model); }
public void SwapPuzzlePieces(object sender, NotificationEventArgs e) { var orbMove = sender as OrbMove; var movingPiece = _puzzlePieces.SingleOrDefault(pp => pp.Location.Row == orbMove.Origin.Row && pp.Location.Column == orbMove.Origin.Column); var pieceToSwap = _puzzlePieces.SingleOrDefault(pp => pp.Location.Row == orbMove.Destination.Row && pp.Location.Column == orbMove.Destination.Column); pieceToSwap.SetPosition(orbMove.Origin.Row, orbMove.Origin.Column); movingPiece.Location.Row = orbMove.Destination.Row; movingPiece.Location.Column = orbMove.Destination.Column; }
private async void OnEndTurn(object sender, NotificationEventArgs e) { PopupUtils.CoverScreen(5); await _puzzleGrid.MatchAndReplacePuzzlePieces(); var matches = _puzzleGrid.MatchedOrbs; await PlayerHeals(_activeTeam, matches, _playerHealth); await PlayerAttacksMonster(_monsterGrid, _activeTeam, matches); if (MonsterIsAlive()) { await MonsterAttacksPlayer(_monsterGrid.ActiveMonster, _activeTeam, _playerHealth); if (PlayerIsAlive()) { StartNewTurn(); } else { //This was annoying me so I commented it out lol //DisplayDeathDialog(); AppGlobals.ActiveDungeonScore.PlayerWins = false; EndGame(); } } else { await _monsterGrid.AnimateMonsterDeath(); AppGlobals.ActiveDungeonScore.MonstersSlain.Add(_monsterGrid.ActiveMonster); var hasAnotherFloor = _monsterGrid.LoadNextFloor(); if (hasAnotherFloor) { StartNewTurn(); } else { //This was annoying me so I commented it out lol //DisplayDeathDialog(); AppGlobals.ActiveDungeonScore.PlayerWins = true; EndGame(); } } }
void OnSaveChangesNotice(object sender, NotificationEventArgs<object, bool> e) { // Prompt user to save changes var mbResult = MessageBox.Show("Save changes?", "Save Changes", MessageBoxButton.OKCancel); // Call back ViewModel with response e.Completed(mbResult == MessageBoxResult.OK); }
void OnErrorNotice(object sender, NotificationEventArgs<Exception> e) { // Show user message string MessageBox.Show(e.Message, "Error", MessageBoxButton.OK); // Trace information Debug.WriteLine(e.Data.ToString()); }
void OnItemsSavedNotice(object sender, NotificationEventArgs e) { // Inform user product was saved MessageBox.Show(e.Message, "Save Changes", MessageBoxButton.OK); }
/// <summary> /// Notify registered subscribers. /// Call is transparently marshalled to UI thread. /// </summary> /// <param name="token">String identifying a message token</param> /// <param name="sender">Sender of notification</param> /// <param name="e">Event args carrying message</param> public void Notify(string token, object sender, NotificationEventArgs e) { // Notify subscriber on UI thread InternalNotify(token, sender, e, true); }
private void OnShowHeroDetails(object sender, NotificationEventArgs e) { var id = e.Message; this.NavigationService.Navigate(new Uri("/HeroDetails.xaml?playerOwnedHeroId=" + id, UriKind.RelativeOrAbsolute)); }
/// <summary> /// Notify registered subscribers. /// Call is transparently marshalled to UI thread. /// </summary> /// <typeparam name="TOutgoing">Type used by notifier to send data</typeparam> /// <typeparam name="TIncoming">Type sent by subscriber to send data back to notifier</typeparam> /// <param name="token">String identifying a message token</param> /// <param name="sender">Sender of notification</param> /// <param name="e">Event args carrying message</param> public void Notify <TOutgoing, TIncoming>(string token, object sender, NotificationEventArgs <TOutgoing, TIncoming> e) { // Notify subscriber on UI thread InternalNotify(token, sender, e, true); }
private void OnEndGame(object sender, NotificationEventArgs e) { NavigationService.Navigate(new Uri("/DungeonSummary.xaml", UriKind.RelativeOrAbsolute)); }
private void OnResultNotice(object sender, NotificationEventArgs<bool> eventArgs) { DialogResult = eventArgs.Data; }
/// <summary> /// Notify registered subscribers asynchronously. /// Call is not marshalled to UI thread. /// </summary> /// <typeparam name="TOutgoing">Type used by notifier to send data</typeparam> /// <typeparam name="TIncoming">Type sent by subscriber to send data back to notifier</typeparam> /// <param name="token">String identifying a message token</param> /// <param name="sender">Sender of notification</param> /// <param name="e">Event args carrying message</param> public void BeginNotify <TOutgoing, TIncoming>(string token, object sender, NotificationEventArgs <TOutgoing, TIncoming> e) { // Notify subscriber on ThreadPool thread InternalNotify(token, sender, e, false); }
private void OnDeleteVerifiedNotice(object sender, NotificationEventArgs eventArgs) { MessageBox.Show("Order has been deleted", "Order Deleted", MessageBoxButton.OK, MessageBoxImage.Information); }
private void ProjectListViewModel_SelectedProjectChanged(object sender, NotificationEventArgs<Project> e) { // var preview = new ProjectsPreviewViewSingleProject() {Height = 500,Width = 500,AllowRotation = false}; // preview.Project = e.Data; // Mediator.OpenInRegion(projectPreviewRegion,preview); }
private void OnEnterDungeon(object sender, NotificationEventArgs e) { var dungeonToEnter = e.Message; this.NavigationService.Navigate(new Uri("/PlayDungeon.xaml?dungeonToEnter=" + dungeonToEnter, UriKind.RelativeOrAbsolute)); }
private void OnErrorNotice(object sender, NotificationEventArgs<Exception> eventArgs) { MessageBox.Show(eventArgs.Data.Message, "Error"); }
public void ProjectListViewModelSelectedProjectChanged(object sender, NotificationEventArgs<Project> e) { ThermalBuildingModel.Instance.Project = e.Data; }
private void OnNavItemTapped(object sender, NotificationEventArgs e) { var url = e.Message; NavigationService.Navigate(new Uri(url, UriKind.RelativeOrAbsolute)); }
/// <summary> /// Notify registered callbacks. /// </summary> /// <param name="token">String identifying a message token</param> /// <param name="sender">Sender of notification</param> /// <param name="e">Event args carrying message</param> void INotifyable.Notify(string token, object sender, NotificationEventArgs e) { // Notify subscriber on UI thread InternalNotify(token, sender, e); }