Exemple #1
0
        public MainWindowViewModel(ILogger <MainWindowViewModel> logger,
                                   IWDClientServices wdClientServices,
                                   string[] streamingTypes,
                                   UInt16 preferredServerPort     = 80,
                                   UInt16 preferredStreamingPort  = 5500,
                                   int preferredLocalScreenWidth  = 1024,
                                   int preferredRemoteScreenWidth = 1024)
        {
            _logger                     = logger;
            _wdClientServices           = wdClientServices;
            _preferredServerPort        = preferredServerPort;
            _preferredStreamingPort     = preferredStreamingPort;
            _preferredLocalScreenWidth  = preferredLocalScreenWidth;
            _preferredRemoteScreenWidth = preferredRemoteScreenWidth;

            // Initialize bound properties
            ServerPort = _preferredServerPort;
            InitialLocalScreenResolution = _wdClientServices.GetInitalLocalScreenResolution();
            CurrentLocalScreenResolution = _wdClientServices.GetCurrentLocalScreenResolution();
            //InitialRemoteScreenResolution = _wdClientServices.GetInitalRemoteScreenResolution();
            //CurrentRemoteScreenResolution = await _wdClientServices.GetCurrentRemoteScreenResolution();

            AvailableLocalScreenResolutions     = new ObservableCollection <string>();
            SelectedLocalScreenResolutionIndex  = -1;
            AvailableRemoteScreenResolutions    = new ObservableCollection <string>();
            SelectedRemoteScreenResolutionIndex = -1;

            StreamingTypes = new ObservableCollection <string>(streamingTypes);

            // pre-select first of the provided straming-types
            SelectedStreamingTypeIndex = 0;

            StreamingPort = _preferredStreamingPort;
        }
Exemple #2
0
        public void ManageLocalScreenResolutions_NormalUseCase_ShouldPass()
        {
            Console.WriteLine("Testing managing of screen-resolutions on local computer:");
            Console.WriteLine("=========================================================");

            string initialLocalScreenResolution =
                _wdClientServices.GetInitalLocalScreenResolution();

            Assert.False(string.IsNullOrEmpty(initialLocalScreenResolution));
            Console.WriteLine($"Initial local screen-resolution is: {initialLocalScreenResolution}");

            List <string> availableLocalScreenResolutions =
                _wdClientServices.GetAvailableLocalScreenResolutions();

            Assert.True(availableLocalScreenResolutions.Count > 0);
            Console.WriteLine("Available local sreen-resolutions:");
            foreach (string res in availableLocalScreenResolutions)
            {
                Console.WriteLine($"   {res}");
            }

            Console.WriteLine("Switching to second available local screen-resolution.");
            Assert.DoesNotThrow(() =>
            {
                _wdClientServices.SetLocalScreenResolution(
                    availableLocalScreenResolutions[1]);
            });
            Thread.Sleep(2000);

            Console.WriteLine("Getting current local screen-resolution:");
            string currentLocalScreenResoltuion =
                _wdClientServices.GetCurrentLocalScreenResolution();

            Assert.False(string.IsNullOrEmpty(currentLocalScreenResoltuion));
            Console.WriteLine($"Current local screen-resolution is: {currentLocalScreenResoltuion}");

            Console.WriteLine("Switching back to initial local screen-resolution.");
            Assert.DoesNotThrow(() =>
            {
                _wdClientServices.SetLocalScreenResolution(
                    initialLocalScreenResolution);
            });
        }