public ListChannelsViewModel(NavigationService navigationService) { this.navigationService = navigationService; chatRooms = new ObservableCollection <ChatRoom>(); channelService = new ChannelsService(); Header = new HeaderViewModel(navigationService); }
public RocketChat(string serverUrl) { IRestClient restClient = new RestClient(serverUrl); IJsonSerializer jsonSerializer = new JsonSerializer(); IAuthHelper authHelper = new AuthHelper(); IRestClientService restClientService = new RestClientService(authHelper, restClient, jsonSerializer); IFileRestClientService fileRestClientService = new FileRestClientService(authHelper, restClient, jsonSerializer); IAuthenticationService authService = new AuthenticationService(authHelper, restClientService); IChannelsService channelsService = new ChannelsService(restClientService); IGroupsService groupsService = new GroupsService(restClientService); IUsersService usersService = new UsersService(restClientService); IChatService chatService = new ChatService(restClientService); IRoomService roomService = new RoomService(restClientService); IAssetsService assetsService = new AssetsService(restClientService); IAutoTranslateService autoTranslateService = new AutoTranslateService(restClientService); ICommandsService commandsService = new CommandsService(restClientService); IEmojisService emojisService = new EmojisService(restClientService, fileRestClientService); Api = new RocketChatApi( chatService, usersService, groupsService, channelsService, authService, roomService, assetsService, autoTranslateService, commandsService, emojisService); }
public RolesWithAccessToComplaintsChannelChangesHandler(IQueryBus queryBus, DiscordServersService discordServersService, UsersRolesService usersRolesService, ChannelsService channelsService) { this._discordServersService = discordServersService; this._usersRolesService = usersRolesService; this._channelsService = channelsService; this._queryBus = queryBus; }
public ComplaintsChannelService(IQueryBus queryBus, ICommandBus commandBus, IConfigurationService configurationService, ChannelsService channelsService, UsersRolesService usersRolesService, DiscordServersService discordServersService) { this._queryBus = queryBus; this._commandBus = commandBus; this._configurationService = configurationService; this._channelsService = channelsService; this._usersRolesService = usersRolesService; this._discordServersService = discordServersService; }
private async void RefreshChannelsButton_Click(object sender, RoutedEventArgs e) { try { using (var channelsService = new ChannelsService()) { ChannelLoadingProgress.IsActive = true; ChannelsListView.ItemsSource = await channelsService.GetChannels(); ChannelLoadingProgress.IsActive = false; } } catch (Exception ex) { ModernDialog.ShowMessage(ex.Message, "Error", MessageBoxButton.OK); } }
public async void OnNavigatedTo(FirstFloor.ModernUI.Windows.Navigation.NavigationEventArgs e) { try { using (var channelsService = new ChannelsService()) { ChannelLoadingProgress.IsActive = true; ChannelsListView.ItemsSource = await channelsService.GetChannels(); ChannelLoadingProgress.IsActive = false; } } catch (Exception ex) { ModernDialog.ShowMessage(ex.Message, "Error", MessageBoxButton.OK); } }
// GET api/archives?channelId=nb:cid:UUID:bf111377-83ac-4907-a5ca-5e8052eeaeef×tamp=1421934256 public IEnumerable <ArchiveProgram> Get(string channelId, long timestamp) { // Convert timestamp into DateTime (UTC based) DateTime requestedTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); requestedTime = requestedTime.AddSeconds(timestamp); // Retrieve Channel var channel = ChannelsService.GetChannel(channelId); if (channel == null) { return(null); } // Convert into our own object var returnChannel = Projections.ProjectChannel(channel, ServiceConfiguration.ArchivalWindowMinutes, ServiceConfiguration.OverlappingArchivalWindowMinutes); return(returnChannel.Programs.Where(p => p.Finished >= requestedTime && p.Started <= requestedTime)); }
public ChannelsServiceTests() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()); var acc = new Account(); acc.Cloud = "CloudName"; this.channelRepository = new EfDeletableEntityRepository <Channel>(new ApplicationDbContext(options.Options)); this.imageRepository = new EfDeletableEntityRepository <Image>(new ApplicationDbContext(options.Options)); this.videoRepository = new EfDeletableEntityRepository <Video>(new ApplicationDbContext(options.Options)); this.cloudinary = new Cloudinary(acc); this.service = new ChannelsService(this.channelRepository, this.imageRepository, this.videoRepository, this.cloudinary); this.user = new ApplicationUser { Id = "user-id", UserName = "******", Email = "*****@*****.**", }; this.channel1 = new Channel { Id = "first-id", Title = "Enduro", Description = "Desc of channel", Image = null, UserId = this.user.Id, }; this.channel2 = new Channel { Id = "second-id", Title = "Music", Description = "Music desc", Image = null, UserId = this.user.Id, }; }
public MainWindowViewModel() { _container = new UnityContainer(); _container.RegisterType <ICheckStatusService, TelegramJoinChannel.BLL.Services.CheckStatusService>(); _container.RegisterType <IChannelsService, TelegramJoinChannel.BLL.Services.ChannelsService>(); IsAuthorisation = true; _channelsService = new ChannelsService(_container); _checkStatusService = new CheckStatusService(_container); InfoChannels = _channelsService.GetChannelsInfo(); StatChannels = _checkStatusService.GetCheckChannelsInfo(); if (StatChannels.Count != 0) { LastCheck = StatChannels.Last().CheckDate; } SetCode = new RelayCommand(OnSetCode); Authenticate = new RelayCommand(OnAuthenticate); CheckMarked = new RelayCommand(OnCheckMarked); CheckAll = new RelayCommand(OnCheckAll); DeleteSelected = new RelayCommand(OnDeleteSelected); Search = new RelayCommand(OnSearch); UpdateChannale = new RelayCommand(OnUpdateChannale); AddChannel = new RelayCommand(OnAddChannel); _files = new List <string>(); _updateChannelsBD = new List <ChannelsInfo>(); _tLChannelFull = new List <TLChannelFull>(); _tLChannels = new List <TLChannel>(); UriList = new ObservableCollection <AddChannels>(); _numberPhone = "+375293232203"; Application.Current.MainWindow.Closing += MainWindow_Closing; }
public MuteRoleInitService(UsersRolesService usersRolesService, ChannelsService channelsService) { this._usersRolesService = usersRolesService; this._channelsService = channelsService; }
// POST api/archives //[Authorize] public HttpResponseMessage Post(SchedulerParameters schedulerParameters) { System.Diagnostics.Trace.TraceInformation("Archiving requested for Channel ID [{0}], Program ID [{1}], Job Name [{2}]", schedulerParameters.ChannelId, schedulerParameters.ProgramId, schedulerParameters.JobName); // Fire and forget because otherwise, the scheduler will timeout after 30 seconds Task.Run(async() => { try { var cloudServiceName = NamingHelpers.GetSchedulerCloudServiceName(ServiceConfiguration.MediaServiceAccountName); var jobCollectionName = NamingHelpers.GetSchedulerJobCollectionName(ServiceConfiguration.MediaServiceAccountName); // Ensure that the scheduler is prepared await PrepareScheduler(); // Get the Channel by Channel Id var currentChannel = ChannelsService.GetChannel(schedulerParameters.ChannelId); System.Diagnostics.Trace.TraceInformation("Retrieved Channel [{0}] is {1}", schedulerParameters.ChannelId, currentChannel); // Update its cross domain access policy if needed ChannelsService.UpdateCrossSiteAccessPoliciesForChannelIfNeeded(currentChannel); // Identify what are we trying to do var runningPrograms = currentChannel.Programs.ToList().Where(p => p.State == Microsoft.WindowsAzure.MediaServices.Client.ProgramState.Running); var countOfRunningPrograms = runningPrograms.Count(); System.Diagnostics.Trace.TraceInformation("Channel [{0}] has [{1}] Running programs", schedulerParameters.ChannelId, countOfRunningPrograms); // If we have more than 2 programs (Default and Archival) running if (countOfRunningPrograms > 2) { // We are in an undefined state System.Diagnostics.Trace.TraceError("Channel [{0}] has [{1}] Running programs. This is an undefined state. Aborting.", schedulerParameters.ChannelId, countOfRunningPrograms); return; } // Now we got this out of the way // If we have no running programs if (countOfRunningPrograms == 0) { // Reset the channel try { System.Diagnostics.Trace.TraceError("Resetting Channel ID [{0}]"); await currentChannel.ResetAsync(); } catch (Exception ex) { System.Diagnostics.Trace.TraceError("Couldn't reset Channel ID [{0}]. \nException: {1}", currentChannel.Id, ex); } System.Diagnostics.Trace.TraceInformation("Starting DefaultProgram"); // Maybe we forgot to run the DefaultProgram from the portal, or deleted it // Start by creating the DefaultProgram then create the first ArchivalProgram and calling the scheduler var defaultProgram = await ChannelsService.CreateDefaultProgramIfNotExistsAsync(currentChannel, ServiceConfiguration.DefaultProgramArchivalWindowMinutes); } // Create an Archival Program System.Diagnostics.Trace.TraceInformation("Starting ArchivalProgram"); var archivalProgram = await ChannelsService.CreateArchivalProgramAsync(currentChannel, DateTime.UtcNow, ServiceConfiguration.ArchivalWindowMinutes, ServiceConfiguration.OverlappingArchivalWindowMinutes); var archivalJobName = NamingHelpers.GetArchivingJobName(currentChannel.Name); // Schedule the next job run System.Diagnostics.Trace.TraceInformation("Scheduling next job run"); var nextProgramJob = await CreateScheduledJob(currentChannel, archivalProgram, archivalJobName); // If we had 2 running programs, then we are trying to schedule the follow-up and toggle the archives if (nextProgramJob != null && countOfRunningPrograms == 2) { System.Diagnostics.Trace.TraceInformation("We had 2 running programs, then we are trying to schedule the follow-up and toggle the archives"); // Stop the current (old) program // Get the Program by Program Id System.Diagnostics.Trace.TraceInformation("Getting current program [{0}]", schedulerParameters.ProgramId); var currentProgram = ChannelsService.GetProgram(schedulerParameters.ProgramId); // Stop it System.Diagnostics.Trace.TraceInformation("Stopping current program [{0}]", schedulerParameters.ProgramId); await currentProgram.StopAsync(); System.Diagnostics.Trace.TraceInformation("Stopped [{0}]", schedulerParameters.ProgramId); } } catch (Exception ex) { System.Diagnostics.Trace.TraceError("Exception: {0}\n", ex); } }); return(Request.CreateResponse(HttpStatusCode.OK)); }
public ArchivesController() { ChannelsService = new ChannelsService(ServiceConfiguration); SchedulerService = new SchedulerService(ServiceConfiguration); }
/// <inheritdoc cref="ChannelsService.GetUserSetting"/> public async Task <UserSetting> GetUserSetting(SettingKey settingKey) => await ChannelsService.GetUserSetting(this, settingKey);
public MixerAPI(string oauthToken = null) { this.Http = new MixerHttpClient(DEFAULT_BASE_PATH, oauthToken); this.UsersService = new UsersService(this); this.ChannelsService = new ChannelsService(this); }
public MuteRoleInitService(IQueryBus queryBus, UsersRolesService usersRolesService, ChannelsService channelsService) { this._queryBus = queryBus; this._usersRolesService = usersRolesService; this._channelsService = channelsService; }
/// <inheritdoc cref="ChannelsService.UpdateUserSetting"/> public async Task UpdateUserSetting(SettingKey settingKey, UpdateUserSetting payload) => await ChannelsService.UpdateUserSetting(this, settingKey, payload);
/// <summary> /// Initializes a new instance of the <see cref="BindableChannel"/> class. /// </summary> /// <param name="model">API Channel Model.</param> /// <param name="guildId">Id of Channel's guild.</param> /// <param name="states">List of VoiceStates for users in a voice channel.</param> public BindableChannel([NotNull] Channel model, [CanBeNull] IEnumerable<VoiceState> states = null) : base(model) { MessengerInstance.Register<GatewayUserGuildSettingsUpdatedMessage>(this, m => { if ((m.Settings.GuildId ?? "DM") == GuildId) { DispatcherHelper.CheckBeginInvokeOnUi(() => { // Updated channel settings ChannelOverride channelOverride = ChannelsService.GetChannelSettings(Model.Id); if (channelOverride != null) { Muted = channelOverride.Muted; } }); } }); MessengerInstance.Register<SettingChangedMessage<bool>>(this, m => { if (m.Key == SettingKeys.ShowNoPermssions) { RaisePropertyChanged(nameof(Hidden)); } }); MessengerInstance.Register<SettingChangedMessage<CollapseOverride>>(this, m => { if (m.Key == SettingKeys.CollapseOverride) { RaisePropertyChanged(nameof(Hidden)); } }); MessengerInstance.Register<SpeakMessage>(this, e => { if (e.EventData.UserId != null && ConnectedUsers.ContainsKey(e.EventData.UserId)) { DispatcherHelper.CheckBeginInvokeOnUi(() => { ConnectedUsers[e.EventData.UserId].Speaking = e.EventData.Speaking > 0; }); } }); MessengerInstance.Register<GatewayVoiceStateUpdateMessage>(this, m => { DispatcherHelper.CheckBeginInvokeOnUi(() => { if (m.VoiceState.ChannelId == Model.Id) { if (ConnectedUsers.ContainsKey(m.VoiceState.UserId)) { ConnectedUsers[m.VoiceState.UserId].Model = m.VoiceState; ConnectedUsers[m.VoiceState.UserId].UpateProperties(); } else { ConnectedUsers.Add(m.VoiceState.UserId, new BindableVoiceUser(m.VoiceState)); } } else if (ConnectedUsers.ContainsKey(m.VoiceState.UserId)) { ConnectedUsers.Remove(m.VoiceState.UserId); } }); }); if (states != null) { foreach (var state in states) { if (state.ChannelId == Model.Id) { state.GuildId = GuildId; ConnectedUsers.Add(state.UserId, new BindableVoiceUser(state)); } } } }
public ChannelsController() { ChannelsService = new ChannelsService(ServiceConfiguration); }
/// <inheritdoc cref="ChannelsService.GetAvailableSettingValues"/> public async Task <List <string> > GetAvailableSettingValues(SettingKey settingKey) => await ChannelsService.GetAvailableSettingValues(this, settingKey);