Example #1
0
        public MainModel(RootModel root,
                         MainTargetsModel targets,
                         MainSettingsModel settings,
                         SourcesModel sources,
                         StreamSettingsModel streamSettings,
                         MainStreamerModel streamer,
                         MainIndicatorsModel indicators,
                         MainVpnModel vpn,
                         MainAboutModel about,
                         AudioModel audio,
                         HubConnectionService hubConnectionService,
                         IWindowStateManager windowStateManager,
                         IAppEnvironment environment,
                         CoreData coreData,
                         StateLoggerService stateLoggerService,
                         LocalSettingsService localSettingsService,
                         IUpdateManager updateManager,
                         TransientMessageModel transientMessageModel,
                         IAppResources appResources,
                         SceneEditingModel sceneEditingModel,
                         ResourceService resourceService)
        {
            Root                  = root;
            Targets               = targets;
            Settings              = settings;
            Sources               = sources;
            StreamSettings        = streamSettings;
            Streamer              = streamer;
            Indicators            = indicators;
            Vpn                   = vpn;
            About                 = about;
            Audio                 = audio;
            _hubConnectionService = hubConnectionService;
            _windowStateManager   = windowStateManager;
            _environment          = environment;
            _coreData             = coreData;
            _stateLoggerService   = stateLoggerService;
            _localSettingsService = localSettingsService;
            _updateManager        = updateManager;
            TransientMessage      = transientMessageModel;
            _appResources         = appResources;
            SceneEditing          = sceneEditingModel;
            _resourceService      = resourceService;
            _serverClient         = new ModelClient {
                Filter = new FilterConfigurator(true).Build()
            };
            _coreData.GetManager().Register(_serverClient);
            _serverClient.SerializeAndClearChanges();

            _coreData.Subscriptions.OnChangeForSubscriptions = async() => await ProcessLocalOrRemoteChange();

            _coreData.Subscriptions.OnLocalChange = async() => await ProcessLocalChange();
        }
        public StreamSettingsModel(CoreData coreData,
                                   ConnectionService connectionService,
                                   RootModel rootModel,
                                   TransientMessageModel transientMessage,
                                   MainVpnModel vpn)
        {
            CoreData           = coreData;
            _connectionService = connectionService;
            _rootModel         = rootModel;
            _transientMessage  = transientMessage;
            Vpn = vpn;
            SelectResolution = o => CoreData.Settings.Resolution = (Resolution)o;
            SelectLayout     = o =>
            {
                _lastLayout          = SelectedLayout.Value;
                SelectedLayout.Value = ((SettingsSelectorData <LayoutType>)o).Value;
            };
            SelectFps   = o => CoreData.Settings.Fps = (int)o;
            ShowPreview = () => SelectedLayout.Value = _lastLayout;


            SetActualBitrate(0, IndicatorState.Disabled);
        }