示例#1
0
        public int ModifySourceInstance(Common.Data.Models.SourceInstanceDto existingSourceInstance)
        {
            using (var context = new ExodusPrototype1Entities())
            {
                var matchingSourceInstance = context.SourceInstances.Find(existingSourceInstance.Id);

                if (matchingSourceInstance == null)
                {
                    return(-1);
                }

                var toCopy = SourceInstanceMapper.GetEntSourceInstanceFromDtoSourceInstance(existingSourceInstance);

                matchingSourceInstance.X      = toCopy.X;
                matchingSourceInstance.Y      = toCopy.Y;
                matchingSourceInstance.Width  = toCopy.Width;
                matchingSourceInstance.Height = toCopy.Height;
                matchingSourceInstance.WallId = toCopy.WallId;

                context.SaveChanges();
                Clients.All.SourceInstanceModified(SourceInstanceMapper.GetDtoSourceInstanceFromEntSourceInstance(matchingSourceInstance));

                this.WriteToWindowConsole($"Client: {Context.ConnectionId} - Modified Source Instance With Id: {matchingSourceInstance.Id}");

                return(matchingSourceInstance.Id);
            }
        }
示例#2
0
        public async Task <int> ModifySourceInstance(UcSourceInstance sourceInstance)
        {
            var sourceInstanceDto = SourceInstanceMapper.GetDtoSourceInstanceFromUcSourceInstance(sourceInstance);
            int id = await HubProxy.Invoke <int>("ModifySourceInstance", sourceInstanceDto);

            return(id);
        }
示例#3
0
 public void RequestSourceInstances()
 {
     using (var context = new ExodusPrototype1Entities())
     {
         Clients.Caller.ReceivedSourceInstances(SourceInstanceMapper.GetDtoSourceInstanceListFromEntSourceInstanceList(context.SourceInstances));
     }
 }
示例#4
0
        public void TryProcessStartupCache()
        {
            //If we've already processed the startup cache, we don't need to.
            if (this._startupCacheProcessed)
            {
                return;
            }

            //If the startup cache does not contain all the necessary data, we can't process it yet.
            if ((this._startupCache.ContainsKey(StartupCacheKey.Sources) &&
                 this._startupCache.ContainsKey(StartupCacheKey.SourceInstances) &&
                 this._startupCache.ContainsKey(StartupCacheKey.DigitalWalls) &&
                 this._startupCache.ContainsKey(StartupCacheKey.SpaceSessions)) == false)
            {
                return;
            }

            var context = SynchronizationContext.Current;

            App.Current.Dispatcher.Invoke((Action) delegate
            {
                this._profile.Sources       = SourceMapper.GetDcSourceListFromDtoSourceList((IEnumerable <SourceDto>) this._startupCache[StartupCacheKey.Sources]);
                var sourceInstances         = SourceInstanceMapper.GetDcSourceInstanceListFromDcSourceListAndDtoSourceInstanceList(this._profile.Sources, (IEnumerable <SourceInstanceDto>) this._startupCache[StartupCacheKey.SourceInstances]);
                this._profile.DigitalWalls  = DigitalWallMapper.GetDcDigitalWallListFromDtoDigitalWallList(sourceInstances, (IEnumerable <DigitalWallDto>) this._startupCache[StartupCacheKey.DigitalWalls]);
                this._profile.SpaceSessions = SpaceSessionMapper.GetDcSpaceSessionListFromDcDigitalWallListAndDtoSpaceSessionList(this._profile.DigitalWalls, (IEnumerable <SpaceSessionDto>) this._startupCache[StartupCacheKey.SpaceSessions]);
            });

            this._startupCacheProcessed = true;
        }
示例#5
0
        public void TryProcessStartupCache()
        {
            //If we've already processed the startup cache, we don't need to.
            if (this._startupCacheProcessed)
            {
                return;
            }

            //If the startup cache does not contain all the necessary data, we can't process it yet.
            if ((this._startupCache.ContainsKey(StartupCacheKey.Sources) &&
                 this._startupCache.ContainsKey(StartupCacheKey.SourceInstances) &&
                 this._startupCache.ContainsKey(StartupCacheKey.DigitalWalls) &&
                 this._startupCache.ContainsKey(StartupCacheKey.SpaceSessions)) == false)
            {
                return;
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                this._profile.Sources       = SourceMapper.GetMcSourceListFromDtoSourceList((IEnumerable <SourceDto>) this._startupCache[StartupCacheKey.Sources]);
                var sourceInstances         = SourceInstanceMapper.GetMcSourceInstanceListFromMcSourceListAndDtoSourceInstanceList(this._profile.Sources, (IEnumerable <SourceInstanceDto>) this._startupCache[StartupCacheKey.SourceInstances]);
                this._profile.DigitalWalls  = DigitalWallMapper.GetMcDigitalWallListFromDtoDigitalWallList(sourceInstances, (IEnumerable <DigitalWallDto>) this._startupCache[StartupCacheKey.DigitalWalls]);
                this._profile.SpaceSessions = SpaceSessionMapper.GetMcSpaceSessionListFromMcDigitalWallListAndDtoSpaceSessionList(this._profile.DigitalWalls, (IEnumerable <SpaceSessionDto>) this._startupCache[StartupCacheKey.SpaceSessions]);
            });

            this._startupCacheProcessed = true;
        }
示例#6
0
        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);
        }
示例#7
0
 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);
     });
 }
示例#8
0
        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);
            });
        }
示例#9
0
        public int AddSourceInstance(Common.Data.Models.SourceInstanceDto newSourceInstance)
        {
            using (var context = new ExodusPrototype1Entities())
            {
                var newSourceInstanceEnt = SourceInstanceMapper.GetEntSourceInstanceFromDtoSourceInstance(newSourceInstance);
                context.SourceInstances.Add(newSourceInstanceEnt);
                context.SaveChanges();
                Clients.All.SourceInstanceAdded(SourceInstanceMapper.GetDtoSourceInstanceFromEntSourceInstance(newSourceInstanceEnt));

                this.WriteToWindowConsole($"Client: {Context.ConnectionId} - Added Source Instance With Id: {newSourceInstanceEnt.Id}");

                return(newSourceInstanceEnt.Id);
            }
        }
示例#10
0
        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;
            });
        }
示例#11
0
        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;
            });
        }
示例#12
0
        public void TryProcessStartupCache()
        {
            //If we've already processed the startup cache, we don't need to.
            if (this._startupCacheProcessed)
            {
                return;
            }

            //If the startup cache does not contain all the necessary data, we can't process it yet.
            if ((this._startupCache.ContainsKey(StartupCacheKey.Sources) &&
                 this._startupCache.ContainsKey(StartupCacheKey.SourceInstances) &&
                 this._startupCache.ContainsKey(StartupCacheKey.DigitalWalls) &&
                 this._startupCache.ContainsKey(StartupCacheKey.SpaceSessions)) == false)
            {
                return;
            }

            this._unityMainThreadDispatcher.Enqueue(() =>
            {
                this._profile.Sources       = SourceMapper.GetUcSourceListFromDtoSourceList((IEnumerable <SourceDto>) this._startupCache[StartupCacheKey.Sources]);
                var sourceInstances         = SourceInstanceMapper.GetUcSourceInstanceListFromUcSourceListAndDtoSourceInstanceList(this._profile.Sources, (IEnumerable <SourceInstanceDto>) this._startupCache[StartupCacheKey.SourceInstances], this._commonValues.PixelToUnityUnitScale, this._unityMainThreadDispatcher);
                this._profile.DigitalWalls  = DigitalWallMapper.GetUcDigitalWallListFromDtoDigitalWallList(sourceInstances, (IEnumerable <DigitalWallDto>) this._startupCache[StartupCacheKey.DigitalWalls], this._commonValues.PixelToUnityUnitScale, this._commonValues.WallCenter, this._unityMainThreadDispatcher);
                this._profile.SpaceSessions = SpaceSessionMapper.GetUcSpaceSessionListFromUcDigitalWallListAndDtoSpaceSessionList(this._profile.DigitalWalls, (IEnumerable <SpaceSessionDto>) this._startupCache[StartupCacheKey.SpaceSessions]);

                //If we have any digital walls, render the first.
                UcDigitalWall firstWall = this._profile.DigitalWalls.FirstOrDefault();
                if (firstWall != null)
                {
                    firstWall.Render();
                    this._profile.SelectedWall = firstWall;
                }
            });


            this._startupCacheProcessed = true;
        }
示例#13
0
        public async Task <int> AddSourceInstance(UcSourceInstance sourceInstance)
        {
            int id = await HubProxy.Invoke <int>("AddSourceInstance", SourceInstanceMapper.GetDtoSourceInstanceFromUcSourceInstance(sourceInstance));

            return(id);
        }