コード例 #1
0
        protected override void StandbyOnStateChange(CiscoTelePresenceCodec codec, StandbyState state)
        {
            if (!AutoMode)
            {
                return;
            }

            switch (state)
            {
            case StandbyState.Off:
                break;

            case StandbyState.EnteringStandby:
                break;

            case StandbyState.Halfwake:
                break;

            case StandbyState.Standby:
                break;

            default:
                throw new ArgumentOutOfRangeException("state");
            }
        }
コード例 #2
0
        protected override void StandbyOnStateChange(CiscoTelePresenceCodec codec, StandbyState state)
        {
            switch (state)
            {
            case StandbyState.Off:
                foreach (var display in Displays.Where(d => d.Device != null))
                {
                    display.Device.Power = true;
                }
                break;

            case StandbyState.EnteringStandby:
                break;

            case StandbyState.Halfwake:
                break;

            case StandbyState.Standby:
                foreach (var display in Displays.Where(d => d.Device != null))
                {
                    display.Device.Power = false;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException("state");
            }
        }
コード例 #3
0
 public TV()
 {
     OffState     = new OffState(this);
     OnState      = new OnState(this);
     StandbyState = new StandbyState(this);
     StartState   = new StartState(this);
     currentState = OffState;
 }
コード例 #4
0
 //	Aanmaken en toewijzen states.
 void Start()
 {
     standbyState     = new StandbyState(this);
     preSurgeryState  = new PreSurgeryState(this);
     postSurgeryState = new PostSurgeryState(this);
     currentState     = standbyState; // Starten in de standby-fase.
     currentState.Init();             // Aanroepen initialisatie van de huidige fase.
 }
コード例 #5
0
ファイル: Standby.cs プロジェクト: uxav/UX-Simpl-Sharp
        void FeedbackServer_ReceivedData(CodecFeedbackServer server, CodecFeedbackServerReceiveEventArgs args)
        {
            if (args.Path == @"Status/Standby")
            {
#if DEBUG
                CrestronConsole.PrintLine("Status for {0}", args.Path);
                CrestronConsole.PrintLine(args.Data.ToString());
#endif
                StandbyState state = (StandbyState)Enum.Parse(typeof(StandbyState), args.Data.Element("State").Value, true);
#if DEBUG
                CrestronConsole.PrintLine("state = {0}", state.ToString());
#endif
                OnStandbyChange(state);
            }
        }
コード例 #6
0
        protected override void StandbyOnStateChange(CiscoTelePresenceCodec codec, StandbyState state)
        {
            if (!AutoMode)
            {
                return;
            }

            Task task = null;

            switch (state)
            {
            case StandbyState.Off:
                task = new Task(() =>
                {
                    var vcSource = Sources[SourceType.VideoConference];
                    foreach (var display in Displays)
                    {
                        display.Source = vcSource;
                    }
                });
                break;

            case StandbyState.EnteringStandby:
                break;

            case StandbyState.Halfwake:
                break;

            case StandbyState.Standby:
                task = new Task(() =>
                {
                    foreach (var display in Displays)
                    {
                        display.Source = null;
                    }
                });
                break;

            default:
                throw new ArgumentOutOfRangeException("state");
            }

            if (task != null)
            {
                task.Start();
            }
        }
コード例 #7
0
ファイル: Standby.cs プロジェクト: uxav/UX-Simpl-Sharp
        private void OnStandbyChange(StandbyState state)
        {
            _StandbyState = state;

            try
            {
                if (StandbyChanged != null)
                {
                    StandbyChanged(Codec, new CodecStandbyChangeEventArgs(state));
                }
            }
            catch (Exception e)
            {
                ErrorLog.Exception("Exception thrown in CiscoCodec.StandbyChanged event handler", e);
            }

            this.Codec.FusionUpdate();
        }
コード例 #8
0
        static void Main(string[] args)
        {
            //illegal construct example 2
            //PlayerMachine player = new PlayerMachine();
            bool flag = true;
            //games data set
            DataSource data = new DataSource();

            //get the only PlayerMachine object
            Console.WriteLine("Performing machine setup...");
            PlayerMachine playerMachine = PlayerMachine.getInstance();

            //state pattern -- set up the different machine states
            DisplayState displayMode = new DisplayState();
            PlayState    playMode    = new PlayState();
            StandbyState standby     = new StandbyState();

            Console.WriteLine("Setup complete. Current mode: ");
            //get machine base state
            Get_Machine_Current_State(playerMachine);

            while (flag)
            {
                Console.WriteLine("You now have the following options: \n 1 - Display games \n 2 - Display filters");

                //display games
                bool inputValid  = true;
                bool canPlayGame = false;
                int  input;
                input = GetInput();
                displayMode.DoAction(playerMachine);

                if (input == 1)
                {
                    PrintResults(data.GetGames());
                    canPlayGame = true;
                }
                else if (input == 2)
                {
                    Console.WriteLine("You can chose one of the following filters : \n Filter by game types :\n 1 - Adventure \n 2 - Action \n 3 - RolePlay \n Filter by platform :\n 4 - PS4 \n 5 - Nintendo  \n 6 - Xbox  \n 7 - PC  \n Other filters :  \n 8 - 90's Games \n 9 - This year  \n 10 - Top 5 rated \n \n You can also combine filters by using 'and' and 'or'. \n Examples: 3and10 ; 5or6 ; 2 ");

                    var            input2        = Console.ReadLine();
                    FilterCriteria finalCriteria = new CriteriaAdventure();

                    if (IsInputString(input2))
                    {
                        //display games filtered by 2 criteria
                        if (input2.Contains("and"))
                        {
                            var splitinput = input2.Split(new[] { "and" }, StringSplitOptions.None);

                            int id1 = Int32.Parse(splitinput[0]);
                            int id2 = Int32.Parse(splitinput[1]);

                            if (IsIdValid(id1) && IsIdValid(id2))
                            {
                                FilterCriteria criteria1 = GetFilterCriteria(id1);
                                FilterCriteria criteria2 = GetFilterCriteria(id2);
                                finalCriteria = new AndCriteria(criteria1, criteria2);
                            }
                            else
                            {
                                inputValid = false;
                                Console.WriteLine("Input invalid, please retry.");
                            }
                        }
                        else if (input2.Contains("or"))
                        {
                            var splitinput = input2.Split(new[] { "or" }, StringSplitOptions.None);

                            int id1 = Int32.Parse(splitinput[0]);
                            int id2 = Int32.Parse(splitinput[1]);

                            if (IsIdValid(id1) && IsIdValid(id2))
                            {
                                FilterCriteria criteria1 = GetFilterCriteria(id1);
                                FilterCriteria criteria2 = GetFilterCriteria(id2);
                                finalCriteria = new OrCriteria(criteria1, criteria2);
                            }
                            else
                            {
                                inputValid = false;
                                Console.WriteLine("Input invalid, please retry.");
                            }
                        }
                    }
                    else
                    {
                        //display games filtered by 1 criteria
                        int id = Int32.Parse(input2);

                        if (IsIdValid(id))
                        {
                            finalCriteria = GetFilterCriteria(id);
                        }
                        else
                        {
                            inputValid = false;
                            Console.WriteLine("Input invalid, please retry.");
                        }
                    }

                    if (inputValid) //display filter criterias only if they are valid
                    {
                        Console.WriteLine(finalCriteria + " Games :");
                        PrintResults(finalCriteria.MeetCriteria(data.GetGames()));
                        canPlayGame = true;
                    }
                }
                else //input was not 2 or 1
                {
                    Console.WriteLine("Input invalid, please retry.");
                }

                if (canPlayGame)
                {
                    //select a game
                    Console.WriteLine("Write the id of the game you wish to play: ");
                    input = GetInput();
                    if (input <= 0 || input > 11)
                    {
                        Console.WriteLine("Input invalid, please retry.");
                    }
                    else
                    {
                        // valid id, switch to play mode
                        playMode.DoAction(playerMachine);

                        //play game
                        playerMachine.PlayGame(data.GetGames().FirstOrDefault(g => g.Id == input));

                        if (input == 7) // ask to play a DLC for this game
                        {
                            Console.WriteLine("\n This game has DLC available. Press 1 to play.");
                            var inp = Console.ReadLine();
                            if (!IsInputString(inp) && Int32.Parse(inp) == 1)
                            {
                                // decorator pattern

                                //get the game for which we want to play a DLC
                                Game originalGame = data.GetGames().FirstOrDefault(g => g.Id == input);

                                //create the dlc linked to the originalGame
                                Game_DLC fallout_DLC = new Game_DLC(originalGame.Title, "NewVegas");

                                //Make the DLC for game playable / wrap dlc in playable
                                PlayableDLC playableDLC = new PlayableDLC(fallout_DLC);

                                //play DLC
                                playableDLC.Play_Dlc();
                            }
                            else
                            {
                                Console.WriteLine("Input invalid");
                            }
                        }
                    }
                    Console.ReadKey();
                    Console.WriteLine();

                    //TODO: add a timer component here

                    // go back to standby
                    standby.DoAction(playerMachine);

                    Console.WriteLine("\n \nPress enter to go back to display mode.");
                    Console.ReadLine();
                }
            }

            Console.WriteLine("\n Press any key to exit.");
            Console.ReadLine();
        }
コード例 #9
0
ファイル: Standby.cs プロジェクト: uxav/UX-Simpl-Sharp
 public CodecStandbyChangeEventArgs(StandbyState state)
 {
     this.State = state;
 }
コード例 #10
0
ファイル: VCRoom.cs プロジェクト: microdave007/JaneStreetAV
 protected abstract void StandbyOnStateChange(CiscoTelePresenceCodec codec, StandbyState state);