示例#1
0
        // Called through export
        private void OnPlay(string screenName, string videoUrl)
        {
            var screen = this.screenCollection.FindOne(s => s.Name == screenName);

            if (screen == null)
            {
                Logger.Error($"play on screen \"{screenName}\" failed. Screen not found");
                return;
            }

            var playEvent = new PlayEvent()
            {
                Screen = screen, Url = videoUrl
            };

            if (!playEvent.IsValid)
            {
                Logger.Error($"play \"{playEvent.Url}\" on screen \"{playEvent.Url}\" failed. Reason: Invalid url");
                return;
            }

            this.Play.Invoke(null, playEvent);

            this.screenStateManager.OnPlay(screen, videoUrl);

            Logger.Debug($"playing: {playEvent.Url} on \"{playEvent.Screen.Name}\"");
        }
示例#2
0
        private void OnEditScreen(string jsonScreen)
        {
            var screen = JsonConvert.DeserializeObject <Screen>(jsonScreen);

            if (screen == null)
            {
                Logger.Error("Failed to edit screen. Received empty or wrong argument");
                return;
            }

            if (!screen.IsValid)
            {
                Logger.Error("Failed to edit screen. Received invalid screen argument");
                return;
            }

            var found = this.screenCollection.Update(screen);

            if (!found)
            {
                Logger.Error($"Editing failed. screen \"{screen.Name}\" not found.");
                return;
            }

            this.EditScreen.Invoke(null, screen);
            this.GetScreenList.Invoke(null, this.GetScreensList());
        }
示例#3
0
        // Called through export
        private void OnPause(string screenName)
        {
            var screen = this.screenCollection.FindOne(s => s.Name == screenName);

            if (screen == null)
            {
                Logger.Error($"Pausing failed. Screen \"{screenName}\" not found.");
                return;
            }

            this.Pause.Invoke(null, screenName);
            this.screenStateManager.OnPause(screenName);
        }
示例#4
0
        // Export
        private void OnSeek(string screenName, float time)
        {
            var screen = this.screenCollection.FindOne(s => s.Name == screenName);

            if (screen == null)
            {
                Logger.Error($"seeking failed. Cant find {screenName}");
                return;
            }

            this.Seek.Invoke(null, screenName, time);
            this.screenStateManager.OnSeek(screenName, time);
        }
示例#5
0
        private void OnDeleteScreen(string screenName)
        {
            var count = this.screenCollection.Delete(s => s.Name == screenName);

            if (count == 0)
            {
                Logger.Error($"failed to delete screen. screen {screenName} not found.");
                return;
            }

            this.DeleteScreen.Invoke(null, screenName);
            this.GetScreenList.Invoke(null, this.GetScreensList());
        }
示例#6
0
        private void OnCreateScreen(string jsonScreen)
        {
            var screen = JsonConvert.DeserializeObject <Screen>(jsonScreen);

            if (screen == null)
            {
                Logger.Error($"failed to create new screen. invalid argument");
                return;
            }

            var existingScreen = this.screenCollection.FindOne(s => s.Name == screen.Name);

            if (existingScreen != null)
            {
                Logger.Error($"failed to create a new screen. A screen with name \"{screen.Name}\" already exists.");
                return;
            }

            var id = this.screenCollection.Insert(screen);

            screen.Id = id;

            this.GetScreenList.Invoke(null, this.GetScreensList());
        }