public ChannelModel(IChannel source, IAppEnvironment environment, CoreData coreData, MainTargetsModel parent) { Source = source; Parent = parent; if (source.TargetId != null) { Target = coreData.Root.Targets[source.TargetId]; HasRtmpUrlInFront = (Target.Flags & TargetFlags.Url) > 0; } else { Target = parent.CustomTarget; HasRtmpUrlInFront = true; } HasRtmpUrlInOptions = true;// (Target.Flags & TargetFlags.Url) > 0; Delete = () => parent.Remove(this); Start = DoStart; Stop = () => Source.IsOn = false; GoToHelp = () => environment.OpenUrl(string.Format(parent.AppData.TargetHintTemplate, source.TargetId ?? "Custom")); GoToWebUrl = () => environment.OpenUrl(WebUrl.Value); WebUrl.OnChange = (o, n) => Source.WebUrl = n == Target.WebUrl ? null : n; Name.OnChange = (o, n) => Source.Name = n == Target.Name ? null : n; RtmpUrl.OnChange = (o, n) => Source.RtmpUrl = n == Target.DefaultRtmpUrl ? null : n; IsTranscoded.OnChange = (o, n) => Transcoding.SetTranscoding(Source, n); TaskHelper.RunUnawaited(() => parent.GetImageAsync(Logo, source.TargetId), "Get image for channel"); }
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(); }