private void SourceInstanceAdded(SourceInstanceDto sourceInstance) { var matchingSource = this._profile.Sources.FirstOrDefault(s => s.SourceId == sourceInstance.SourceId); var newSourceInstance = SourceInstanceMapper.GetUcSourceInstanceFromUcSourceAndDtoSourceInstance(matchingSource, sourceInstance, this._commonValues.PixelToUnityUnitScale, this._unityMainThreadDispatcher); var matchingWall = this._profile.DigitalWalls.FirstOrDefault(w => w.WallId == newSourceInstance.WallId); matchingWall.SourceInstances.Add(newSourceInstance); }
private void SourceInstanceAdded(SourceInstanceDto sourceInstance) { Device.BeginInvokeOnMainThread(() => { var matchingSource = this._profile.Sources.FirstOrDefault(s => s.SourceId == sourceInstance.SourceId); var newSourceInstance = SourceInstanceMapper.GetMcSourceInstanceFromMcSourceAndDtoSourceInstance(matchingSource, sourceInstance); var matchingWall = this._profile.DigitalWalls.FirstOrDefault(w => w.WallId == newSourceInstance.WallId); matchingWall.SourceInstances.Add(newSourceInstance); }); }
private void SourceInstanceAdded(SourceInstanceDto sourceInstance) { var context = SynchronizationContext.Current; App.Current.Dispatcher.Invoke((Action) delegate { var matchingSource = this._profile.Sources.FirstOrDefault(s => s.SourceId == sourceInstance.SourceId); var newSourceInstance = SourceInstanceMapper.GetDcSourceInstanceFromDcSourceAndDtoSourceInstance(matchingSource, sourceInstance); var matchingWall = this._profile.DigitalWalls.FirstOrDefault(w => w.WallId == newSourceInstance.WallId); matchingWall.SourceInstances.Add(newSourceInstance); }); }
private void SourceInstanceModified(SourceInstanceDto sourceInstance) { var matchingWall = this._profile.DigitalWalls.FirstOrDefault(w => w.WallId == sourceInstance.WallId); var matchingSourceInstance = matchingWall?.SourceInstances.FirstOrDefault(s => s.SourceInstanceId == sourceInstance.Id); //Necessary? //var toCopy = SourceInstanceMapper.GetUcSourceInstanceFromUcSourceAndDtoSourceInstance((UcSource)matchingSourceInstance, sourceInstance); this._unityMainThreadDispatcher.Enqueue(() => { matchingSourceInstance.X = sourceInstance.X; matchingSourceInstance.Y = sourceInstance.Y; matchingSourceInstance.Width = sourceInstance.Width; matchingSourceInstance.Height = sourceInstance.Height; matchingSourceInstance.WallId = sourceInstance.WallId; }); }
private void SourceInstanceModified(SourceInstanceDto sourceInstance) { Device.BeginInvokeOnMainThread(() => { var matchingWall = this._profile.DigitalWalls.FirstOrDefault(w => w.WallId == sourceInstance.WallId); var matchingSourceInstance = matchingWall?.SourceInstances.FirstOrDefault(s => s.SourceInstanceId == sourceInstance.Id); var toCopy = SourceInstanceMapper.GetMcSourceInstanceFromMcSourceAndDtoSourceInstance((McSource)matchingSourceInstance, sourceInstance); matchingSourceInstance.X = toCopy.X; matchingSourceInstance.Y = toCopy.Y; matchingSourceInstance.Width = toCopy.Width; matchingSourceInstance.Height = toCopy.Height; matchingSourceInstance.WallId = toCopy.WallId; }); }
private void SourceInstanceModified(SourceInstanceDto sourceInstance) { var context = SynchronizationContext.Current; App.Current.Dispatcher.Invoke((Action) delegate { var matchingWall = this._profile.DigitalWalls.FirstOrDefault(w => w.WallId == sourceInstance.WallId); var matchingSourceInstance = matchingWall?.SourceInstances.FirstOrDefault(s => s.SourceInstanceId == sourceInstance.Id); var toCopy = SourceInstanceMapper.GetDcSourceInstanceFromDcSourceAndDtoSourceInstance((DcSource)matchingSourceInstance, sourceInstance); matchingSourceInstance.X = toCopy.X; matchingSourceInstance.Y = toCopy.Y; matchingSourceInstance.Width = toCopy.Width; matchingSourceInstance.Height = toCopy.Height; matchingSourceInstance.WallId = toCopy.WallId; }); }
public static UcSourceInstance GetUcSourceInstanceFromUcSourceAndDtoSourceInstance(UcSource appropriateSource, SourceInstanceDto dtoSourceInstance, float pixelToUnityUnitScale, IUnityMainThreadDispatcher dispatcher) { return(new UcSourceInstance(appropriateSource, dtoSourceInstance.WallId, dtoSourceInstance.X, dtoSourceInstance.Y, dtoSourceInstance.Width, dtoSourceInstance.Height, pixelToUnityUnitScale, dispatcher, dtoSourceInstance.Id)); }