Esempio n. 1
0
        public RobotManagerVM(IGamepad gamepad, INavigationService navigation, IDialogService dialog, ISettingsService settings)
        {
            //set fields
            Gamepad    = new GamepadVM(gamepad);
            Navigation = navigation;
            Dialog     = dialog;
            Settings   = settings;
            Connection = CreateConnection();
            Connection.NewConnectionCreated += NewConnectionCreated;
            Robots               = new ObservableCollection <RobotVM>();
            ConnectionStorage    = new ConnectionStorage(Settings);
            NewConnectionCommand = new RelayCommand(NewConnection);

            //load previous robots
            var robotList = Settings.Get <string[]>("RobotList");

            if (robotList != null)
            {
                foreach (var robotName in robotList)
                {
                    var conn = ConnectionStorage.Get(robotName);
                    if (conn != null)
                    {
                        AddRobot(conn);
                    }
                }
            }
        }
Esempio n. 2
0
 public Robot(IRobotConnectionInfoStorage connectionInfoStorage = null) : base(new RobotConnection())
 {
     //set fields
     _isPersonalitySuppressed = new TaskCompletionSource <bool>();
     ConnectionInfoStorage    = connectionInfoStorage ?? new RobotConnectionInfoStorage();
     Audio     = new RobotAudio(Connection);
     Motors    = new RobotMotors(Connection, this);
     Animation = new RobotAnimation(Connection);
     Screen    = new RobotScreen(Connection);
     Camera    = new RobotCamera(Connection);
     World     = new RobotWorld(Connection, this);
 }