public ImageBoxScrollbarView(ImageBox imageBox, ServerEventMediator eventMediator) { _eventMediator = eventMediator; IsTabStop = true; // allow focus ServerEntity = imageBox; DataContext = imageBox; InitializeComponent(); LayoutRoot.IsHitTestVisible = !imageBox.Tiles.Any(t => t.HasCapture); _eventMediator.TileHasCaptureChanged += EventBrokerTileHasCaptureChanged; ImageScrollBar.SetBinding(RangeBase.ValueProperty, new Binding(TopLeftPresentationImageIndexPropertyName) { Mode = BindingMode.OneTime }); ImageScrollBar.Maximum = ServerEntity.ImageCount - ServerEntity.Tiles.Count; ImageScrollBar.Visibility = ImageScrollBar.Maximum > 0 ? Visibility.Visible : Visibility.Collapsed; ServerEntity.PropertyChanged += OnPropertyChanged; _scrollbarEventPublisher = new DelayedEventPublisher<ScrollBarUpdateEventArgs>( (s, ev) => _eventMediator.DispatchMessage(new UpdatePropertyMessage { Identifier = Guid.NewGuid(), PropertyName = TopLeftPresentationImageIndexPropertyName, TargetId = ServerEntity.Identifier, Value = ev.ScrollbarPosition }), 100); }
public void Destroy() { _destroyed = true; if (_eventMediator != null) { _eventMediator.UnregisterEventHandler(ServerEntity.Identifier); _eventMediator.TileHasCaptureChanged -= EventBrokerTileHasCaptureChanged; _eventMediator = null; } if (_menu != null) { _menu.Dispose(); _menu = null; } if (_fpsPublisher != null) { _fpsPublisher.Dispose(); _fpsPublisher = null; } StopMouseMoveTimer(); }
public TileView(Tile serverEntity, ServerEventMediator mediator) { IsTabStop = true; // allow focus ServerEntity = serverEntity; if (ServerEntity.Selected) { MouseHelper.SetActiveElement(this); } _eventMediator = mediator; _eventMediator.RegisterEventHandler(ServerEntity.Identifier, OnTileEvent); InitializeComponent(); //TODO (CR May 2010): would mediator design pattern simplify this by giving the mousehelper more control? TileImage.MouseRightButtonDown += OnDirectMouseRightButtonDown; TileImage.MouseLeftButtonDown += OnDirectMouseLeftButtonDown; TileCanvas.MouseLeave += OnMouseLeave; TileCanvas.MouseEnter += OnMouseEnter; _eventMediator.TileHasCaptureChanged += EventBrokerTileHasCaptureChanged; }
public ImageBoxView(ImageBox serverEntity, ServerEventMediator eventMediator) { ServerEntity = serverEntity; _eventMediator = eventMediator; _eventMediator.RegisterEventHandler(serverEntity.Identifier, OnImageBoxEvent); InitializeComponent(); UpdateTileViews(); }
public StudyView(ServerEventMediator eventMediator) { InitializeComponent(); _eventMediator = eventMediator; _imageBoxViews = new List<ImageBoxView>(); SizeChanged += OnSizeChanged; _resizePublisher = new DelayedEventPublisher<EventArgs>(ResizeEvent, 350); }
public void Destroy() { if (_eventMediator != null) { _eventMediator.UnregisterEventHandler(ServerEntity.Identifier); _eventMediator = null; } DestroyTileViews(); ServerEntity = null; }
public ImageViewer(StartViewerApplicationRequest startRequest) { InitializeComponent(); ViewModel = new ImageViewerViewModel { IsLoading = true }; DataContext = ViewModel; if (ApplicationContext.Current != null) { ApplicationContext.Initialize(); if (ApplicationContext.Current == null) { throw new Exception(); } } EventMediator = new ServerEventMediator(); EventMediator.Initialize(ApplicationContext.Current.Parameters); EventMediator.CriticalError += ErrorHandler_OnCriticalError; EventMediator.RegisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted); EventMediator.RegisterEventHandler(typeof(SessionUpdatedEvent), OnSessionUpdated); EventMediator.RegisterEventHandler(typeof(MessageBoxShownEvent), OnMessageBox); EventMediator.ServerApplicationStopped += OnServerApplicationStopped; _studyView = new StudyView(EventMediator); StudyViewContainer.Children.Add(_studyView); MouseHelper.SetBackgroundElement(LayoutRoot); if (startRequest == null) { //TODO: replace this with the custom dialog. For some reason, it doesn't work here. System.Windows.MessageBox.Show(ErrorMessages.MissingParameters); } else { ToolstripViewComponent.EventDispatcher = EventMediator; LayoutRoot.MouseLeftButtonDown += ToolstripViewComponent.OnLoseFocus; LayoutRoot.MouseRightButtonDown += ToolstripViewComponent.OnLoseFocus; EventMediator.StartApplication(startRequest); TileView.ApplicationRootVisual = _studyView.StudyViewCanvas; LayoutRoot.KeyUp += OnKeyUp; } }
public void Dispose() { if (_eventDispatcher != null) { foreach (Guid g in _map.Keys) { _eventDispatcher.UnregisterEventHandler(g); } _eventDispatcher = null; _map.Clear(); } }
public ImageViewer(StartViewerApplicationRequest startRequest) { InitializeComponent(); ViewModel = new ImageViewerViewModel { IsLoading = true }; DataContext = ViewModel; if (ApplicationContext.Current != null) { ApplicationContext.Initialize(); if (ApplicationContext.Current == null) throw new Exception(); } EventMediator = new ServerEventMediator(); EventMediator.Initialize(ApplicationContext.Current.Parameters); EventMediator.CriticalError += ErrorHandler_OnCriticalError; EventMediator.RegisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted); EventMediator.RegisterEventHandler(typeof(SessionUpdatedEvent), OnSessionUpdated); EventMediator.RegisterEventHandler(typeof(MessageBoxShownEvent), OnMessageBox); EventMediator.ServerApplicationStopped += OnServerApplicationStopped; _studyView = new StudyView(EventMediator); StudyViewContainer.Children.Add(_studyView); MouseHelper.SetBackgroundElement(LayoutRoot); if (startRequest == null) { //TODO: replace this with the custom dialog. For some reason, it doesn't work here. System.Windows.MessageBox.Show(ErrorMessages.MissingParameters); } else { ToolstripViewComponent.EventDispatcher = EventMediator; LayoutRoot.MouseLeftButtonDown += ToolstripViewComponent.OnLoseFocus; LayoutRoot.MouseRightButtonDown += ToolstripViewComponent.OnLoseFocus; EventMediator.StartApplication(startRequest); TileView.ApplicationRootVisual = _studyView.StudyViewCanvas; LayoutRoot.KeyUp += OnKeyUp; } }
public virtual void Dispose(bool disposing) { if (!_disposed) { Shutdown(); // Must do this beofre we work with the EventMediator ToolstripViewComponent.Dispose(); if (_studyView != null) { StudyViewContainer.Children.Clear(); if (disposing) { _studyView.Dispose(); } _studyView = null; } if (EventMediator != null) { if (_serverApplication != null) { EventMediator.UnregisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted); EventMediator.UnregisterEventHandler(_serverApplication.Viewer.Identifier); EventMediator.ServerApplicationStopped -= OnServerApplicationStopped; _serverApplication = null; } EventMediator.Dispose(); EventMediator = null; } _disposed = true; } }
protected virtual void Dispose(bool disposing) { if (!_disposed) { System.Windows.Application.Current.Host.Content.Resized -= OnApplicationResized; if (disposing) { foreach (var c in LayoutRoot.Children) { var d = c as IDisposable; if (d != null) { d.Dispose(); } } } if (_dispatcher != null) { _dispatcher.Dispose(); _dispatcher = null; } if (_eventMediator != null) { _eventMediator.TileHasCaptureChanged -= EventBrokerTileHasCapture; _eventMediator = null; } LayoutRoot.Children.Clear(); _disposed = true; } }
public ImageBoxScrollbarView(ImageBox imageBox, ServerEventMediator eventMediator) { _eventMediator = eventMediator; IsTabStop = true; // allow focus ServerEntity = imageBox; DataContext = imageBox; InitializeComponent(); LayoutRoot.IsHitTestVisible = !imageBox.Tiles.Any(t => t.HasCapture); _eventMediator.TileHasCaptureChanged += EventBrokerTileHasCaptureChanged; ImageScrollBar.SetBinding(RangeBase.ValueProperty, new Binding(TopLeftPresentationImageIndexPropertyName) { Mode = BindingMode.OneTime }); ImageScrollBar.Maximum = ServerEntity.ImageCount - ServerEntity.Tiles.Count; ImageScrollBar.Visibility = ImageScrollBar.Maximum > 0 ? Visibility.Visible : Visibility.Collapsed; ServerEntity.PropertyChanged += OnPropertyChanged; _scrollbarEventPublisher = new DelayedEventPublisher <ScrollBarUpdateEventArgs>( (s, ev) => _eventMediator.DispatchMessage(new UpdatePropertyMessage { Identifier = Guid.NewGuid(), PropertyName = TopLeftPresentationImageIndexPropertyName, TargetId = ServerEntity.Identifier, Value = ev.ScrollbarPosition }), 100); }
public virtual void Dispose(bool disposing) { if(!_disposed) { Shutdown(); // Must do this beofre we work with the EventMediator ToolstripViewComponent.Dispose(); if (_studyView != null) { StudyViewContainer.Children.Clear(); if (disposing) { _studyView.Dispose(); } _studyView = null; } if (EventMediator != null) { if (_serverApplication != null) { EventMediator.UnregisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted); EventMediator.UnregisterEventHandler(_serverApplication.Viewer.Identifier); EventMediator.ServerApplicationStopped -= OnServerApplicationStopped; _serverApplication = null; } EventMediator.Dispose(); EventMediator = null; } _disposed = true; } }
public ActionDispatcher(ServerEventMediator dispatcher) { _eventDispatcher = dispatcher; }
protected virtual void Dispose(bool disposing) { if (!_disposed) { System.Windows.Application.Current.Host.Content.Resized -= OnApplicationResized; if (disposing) { foreach (var c in LayoutRoot.Children) { var d = c as IDisposable; if (d!= null) d.Dispose(); } } if (_dispatcher != null) { _dispatcher.Dispose(); _dispatcher = null; } if (_eventMediator != null) { _eventMediator.TileHasCaptureChanged -= EventBrokerTileHasCapture; _eventMediator = null; } LayoutRoot.Children.Clear(); _disposed = true; } }
internal static IPopup BuildContextMenu(WebActionNode model, ServerEventMediator dispatcher) { return(BuildContextMenu(model, new ActionDispatcher(dispatcher))); }
internal static IPopup BuildContextMenu(WebActionNode model, ServerEventMediator dispatcher) { return BuildContextMenu(model, new ActionDispatcher(dispatcher)); }