private void RotateImage(RotateImageEvent ri) { if (ri.PresenterID == ViewModelID) { DisplayedImage = ri.Image; if (IsSynchronized) { _aggregator.GetEvent <SynchronizeRotationEvent>().Publish(ri); } } }
private void SynchronizeRotation(RotateImageEvent ri) { if (ri.SynchronizedPresenters.Contains(ViewModelID)) { return; } Rotate rotate = new Rotate(); Dictionary <String, Object> parameters = new Dictionary <String, Object>(); parameters.Add("DisplayedImage", DisplayedImage); parameters.Add("PresenterID", ViewModelID); parameters.Add("SynchronizedPresenters", ri.SynchronizedPresenters); rotate.AffectImage(parameters); }
public void AffectImage(Dictionary <String, Object> args) { Image image = (Image)args["DisplayedImage"]; int presenterID = (int)args["PresenterID"]; int angle = (int)args["Angle"]; List <int> presenters = (List <int>)args["SynchronizedPresenters"]; image.Bitmap = SingleBitmapRotation(angle, image.Bitmap); image.Rotation = (Rotation)((int)image.Rotation + (int)(angle / 90) % 4); RotateImageEvent ri = new RotateImageEvent(); IEventAggregator aggregator = GlobalEvent.GetEventAggregator(); presenters.Add(presenterID); ri.Image = image; ri.PresenterID = presenterID; ri.SynchronizedPresenters = presenters; ri.Angle = angle; aggregator.GetEvent <RotateImageEvent>().Publish(ri); }
public void AffectImage(Dictionary <String, Object> args) { Image image = (Image)args["DisplayedImage"]; int presenterID = (int)args["PresenterID"]; List <int> presenters = (List <int>)args["SynchronizedPresenters"]; var transformedBitmap = new TransformedBitmap(); transformedBitmap.BeginInit(); transformedBitmap.Source = image.Bitmap; transformedBitmap.Transform = new RotateTransform(90); transformedBitmap.EndInit(); image.Bitmap = transformedBitmap; RotateImageEvent ri = new RotateImageEvent(); IEventAggregator aggregator = GlobalEvent.GetEventAggregator(); presenters.Add(presenterID); ri.Image = image; ri.PresenterID = presenterID; ri.SynchronizedPresenters = presenters; aggregator.GetEvent <RotateImageEvent>().Publish(ri); }