public ChatApiController(IUserService service, IChatService service2, ICommentService service3, ILiveChat service4) { this._userService = service; this._chatService = service2; this._commentService = service3; this._LiveChat = service4; }
public Chat(IApplicationSettings settings, IResourceProcessor resourceProcessor, IChatService service, IJabbrRepository repository) { _settings = settings; _resourceProcessor = resourceProcessor; _service = service; _repository = repository; }
public SimpleMessagingViewModel(IChatService chatMng, IContactsService contactsMng) : base(chatMng, contactsMng) { Init(); _chatsManager.ConversationUnReadStateChanged += OnUnreadStateChanged; _chatsManager.ConversationDeclineMessageReceived += OnDeclineMessageReceived; }
public InCallMessagingViewModel(IChatService chatMng, IContactsService contactsMng) : base(chatMng, contactsMng) { Init(); _chatsManager.RttReceived += OnRttReceived; _chatsManager.ConversationUpdated += OnChatRoomUpdated; }
public ChatViewModel(IChatService chatService) { this.contacts = new ObservableCollection<Contact>(); this.contactsView = new CollectionView(this.contacts); this.sendMessageRequest = new InteractionRequest<SendMessageViewModel>(); this.showReceivedMessageRequest = new InteractionRequest<ReceivedMessage>(); this.showDetailsCommand = new DelegateCommand<bool?>(this.ExecuteShowDetails, this.CanExecuteShowDetails); this.contactsView.CurrentChanged += this.OnCurrentContactChanged; this.chatService = chatService; this.chatService.Connected = true; this.chatService.ConnectionStatusChanged += (s, e) => this.OnPropertyChanged(() => this.ConnectionStatus); this.chatService.MessageReceived += this.OnMessageReceived; this.chatService.GetContacts( result => { if (result.Error == null) { foreach (var item in result.Result) { this.contacts.Add(item); } } }); }
public ViewViewModel() { chatService = ServiceLocator.Current.GetInstance<IChatService>(); parentViewModel = ServiceLocator.Current.GetInstance<PhotosViewModel>(); timer = new Timer(new TimerCallback((c) => { DispatcherHelper.CheckBeginInvokeOnUI(() => { App.RootFrame.Navigate(new Uri("/View/PhotosPage.xaml", UriKind.RelativeOrAbsolute)); }); }), null, Timeout.Infinite, Timeout.Infinite); HideCommand = new RelayCommand(async () => { timer.Change(TimeSpan.FromSeconds(6), TimeSpan.FromMilliseconds(-1)); var contentList = await chatService.ReadPhotoContentAsync( parentViewModel.SelectedPhoto.PhotoContentSecretId); var content = contentList.FirstOrDefault(); if (content != null) { Uri = chatService.ReadPhotoAsUri(content.Uri); Stream = chatService.ReadPhotoAsStream(content.Uri); } else { Uri = null; Stream = null; } }); }
public Chat(IResourceProcessor resourceProcessor, IChatService service, IJabbrRepository repository, ICache cache) { _resourceProcessor = resourceProcessor; _service = service; _repository = repository; _cache = cache; }
public ChatViewModel(IChatService chatService) { _contacts = new ObservableCollection<Contact>(); _contactsView = new CollectionView(_contacts); _sendMessageRequest = new InteractionRequest<SendMessageViewModel>(); _showReceivedMessageRequest = new InteractionRequest<ReceivedMessage>(); _showDetailsCommand = new ShowDetailsCommandImplementation(this); _contactsView.CurrentChanged += OnCurrentContactChanged; _chatService = chatService; _chatService.Connected = true; _chatService.ConnectionStatusChanged += (s, e) => RaisePropertyChanged(() => CurrentConnectionState); _chatService.MessageReceived += OnMessageReceived; _chatService.GetContacts( result => { if (result.Error != null) return; foreach (var item in result.Result) { _contacts.Add(item); } }); RaisePropertyChanged(() => CurrentConnectionState); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IDataService dataService) { _dataService = dataService; _dataService.GetData( (item, error) => { if (error != null) { // Report error here return; } WelcomeTitle = item.Title; }); ConnectCommand = new RelayCommand(OnConnect, IsNeedConnect); SendCommand = new RelayCommand(OnSend, CanSendMessage); DisConnectCommand = new RelayCommand(OnDisConnect, IsNeedDisConnect); var instanceContext = new InstanceContext(this); var channel = new DuplexChannelFactory<IChatService>(instanceContext, "chartService"); _chatService = channel.CreateChannel(); Nickname = "frank"; MessageText = "Hello!"; RaiseCommandChanged(); }
public ClientViewModel() { var channelFactory = new DuplexChannelFactory<IChatService>(new ClientService(), "IChatEndpoint"); _server = channelFactory.CreateChannel(); _this = this; CreateCommands(); }
public ChatHub(IChatService chatService) { if (chatService == null) { throw new ArgumentNullException("chatService"); } this.chatService = chatService; }
public CommandManager(string clientId, string userId, string roomName, IChatService service, IJabbrRepository repository, INotificationService notificationService) : this(clientId, null, userId, roomName, service, repository, notificationService) { }
/// <summary> /// Initializes a new instance of the <see cref="XamarinChat.ChatViewModel"/> class. /// </summary> /// <param name="chatService">Chat service.</param> public ChatViewModel(IChatService chatService) { ChatService = chatService; Messages = new ObservableCollection<string>(); SendCommand = new Command( async nothing => { await ChatService.Send(new XamarinChat.Models.ClientMessage{ Client = new XamarinChat.Models.Client { Name = Name }, Message = Message }); Message = string.Empty; }, nothing => CanSend); }
/// <summary> /// Initializes a new instance of the <see cref="XamarinChat.ConnectViewModel"/> class. /// </summary> /// <param name="chatService">Chat service.</param> public ConnectViewModel(IChatService chatService) { ChatService = chatService; ConnectCommand = new Command(async nothing => { await ChatService.Connect(); await ChatService.NewClient(new XamarinChat.Models.Client { Name = Name }); OnConnected(); }, nothing => CanConnect); }
public UploadCallbackHandler(UploadProcessor processor, ContentProviderProcessor resourceProcessor, IConnectionManager connectionManager, IChatService service) { _processor = processor; _resourceProcessor = resourceProcessor; _hubContext = connectionManager.GetHubContext<Chat>(); _service = service; }
public Chat(ContentProviderProcessor resourceProcessor, IChatService service, IJabbrRepository repository, ICache cache, ILogger logger) { _resourceProcessor = resourceProcessor; _service = service; _repository = repository; _cache = cache; _logger = logger; }
public MessagingViewModel(IChatService chatMng, IContactsService contactsMng) : this() { this._chatsManager = chatMng; this._contactsManager = contactsMng; this._chatsManager.ConversationUpdated += OnConversationUpdated; this._chatsManager.NewConversationCreated += OnNewConversationCreated; this._chatsManager.ConversationClosed += OnConversationClosed; this._chatsManager.ContactsChanged += OnContactsChanged; this._chatsManager.ContactAdded += OnChatContactAdded; this._chatsManager.ContactRemoved += OnChatContactRemoved; this._contactsManager.LoggedInContactUpdated += OnLoggedContactUpdated; }
public PhotosViewModel() { chatService = ServiceLocator.Current.GetInstance<IChatService>(); RefreshCommand = new RelayCommand(async () => { Photos = await chatService.ReadPhotoRecordsAsync(App.CurrentUser.UserId); }); ViewPhoto = new RelayCommand(() => { App.RootFrame.Navigate(new Uri("/View/ViewPage.xaml", UriKind.RelativeOrAbsolute)); }); }
public CommandManager(string clientId, string userId, string roomName, IChatService service, IJabbrRepository repository, INotificationService notificationService) { _clientId = clientId; _userId = userId; _roomName = roomName; _chatService = service; _repository = repository; _notificationService = notificationService; }
public Chat(ContentProviderProcessor resourceProcessor, IChatService service, IRecentMessageCache recentMessageCache, IJabbrRepository repository, ICache cache, ILogger logger, ApplicationSettings settings) { _resourceProcessor = resourceProcessor; _service = service; _recentMessageCache = recentMessageCache; _repository = repository; _cache = cache; _logger = logger; _settings = settings; }
static void Main(string[] args) { try { Console.Title = "Chat Server Manager"; chatService = new ChatManager(); chatService.OnStart += chatService_OnStart; chatService.OnStop += chatService_OnStop; chatService.EventLog += chatService_EventLog; chatService.StartServer(); } catch (Exception ex) { Console.WriteLine(ex); } Console.ReadLine(); }
public SendViewModel() { chatService = ServiceLocator.Current.GetInstance<IChatService>(); parentViewModel = ServiceLocator.Current.GetInstance<CameraViewModel>(); parentViewModel.PropertyChanged += parentViewModel_PropertyChanged; ResetImageSource(); SendPhoto = new RelayCommand(async () => { PhotoRecord p = new PhotoRecord(); // If they didn't explicitly toggle the list picker, assume // they want the first contact in the list. if (SelectedFriend != null) { p.RecepientUserId = SelectedFriend.UserId; } else { p.RecepientUserId = Friends.First().UserId; } p.SenderUserId = App.CurrentUser.UserId; p.SenderName = App.CurrentUser.Name; await chatService.CreatePhotoRecordAsync(p); System.Net.Http.HttpResponseMessage m = await chatService.UploadPhotoAsync(p.Uri, p.UploadKey, parentViewModel.Image); App.RootFrame.Navigate(new Uri("/View/PhotosPage.xaml", UriKind.RelativeOrAbsolute)); }); RefreshCommand = new RelayCommand(async () => { Friends = await chatService.ReadFriendsAsync(App.CurrentUser.UserId); }); }
/** * Inloggen */ private void loginToolStripMenuItem_Click(object sender, EventArgs e) { try { lblStatus.Text = "Verbinden..."; /** * Loginform openen */ LoginForm loginDialog = new LoginForm(); loginDialog.ShowDialog(this); if (!String.IsNullOrEmpty(loginDialog.UserName)) { //Verbinding maken remoteFactory = new ChannelFactory<IChatService>("ChatConfig"); remoteProxy = remoteFactory.CreateChannel(); clientUser = remoteProxy.ClientConnect(loginDialog.UserName); if (clientUser != null) { usersTimer.Enabled = true; messagesTimer.Enabled = true; loginToolStripMenuItem.Enabled = false; btnSend.Enabled = true; txtMessage.Enabled = true; isConnected = true; lblStatus.Text = "Verbonden als: " + clientUser.UserName; } } else lblStatus.Text = "Verbinding verbroken"; } catch (Exception ex) { MessageBox.Show("Er is een fout opgetreden\nClient kan geen verbinding maken\n:"+ex.Message, "FATAL ERROR",MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Provides APIs to handle requests related to inbox, rules and messages. /// </summary> /// <param name="service"></param> public ChatController(IChatService service) { _service = service; }
public HomeController(IChatService chatService) { _chatService = chatService; }
public MessagesController(IMapper mapper, IChatService chatService) { _mapper = mapper; _chatService = chatService; }
public NotificationsModule(IJabbrRepository repository, IChatService chatService, IChatNotificationService notificationService) : base("/notifications") { Get["/"] = _ => { if (!IsAuthenticated) { return(Response.AsRedirect(String.Format("~/account/login?returnUrl={0}", HttpUtility.UrlEncode(Request.Path)))); } var request = this.Bind <NotificationRequestModel>(); ChatUser user = repository.GetUserById(Principal.GetUserId()); int unreadCount = repository.GetUnreadNotificationsCount(user); IPagedList <NotificationViewModel> notifications = GetNotifications(repository, user, all: request.All, page: request.Page, roomName: request.Room); var viewModel = new NotificationsViewModel { ShowAll = request.All, UnreadCount = unreadCount, Notifications = notifications, }; return(View["index", viewModel]); }; Post["/markasread"] = _ => { if (!IsAuthenticated) { return(HttpStatusCode.Forbidden); } int notificationId = Request.Form.notificationId; Notification notification = repository.GetNotificationById(notificationId); if (notification == null) { return(HttpStatusCode.NotFound); } ChatUser user = repository.GetUserById(Principal.GetUserId()); if (notification.UserKey != user.Key) { return(HttpStatusCode.Forbidden); } notification.Read = true; repository.CommitChanges(); UpdateUnreadCountInChat(repository, notificationService, user); var response = Response.AsJson(new { success = true }); return(response); }; Post["/markallasread"] = _ => { if (!IsAuthenticated) { return(HttpStatusCode.Forbidden); } ChatUser user = repository.GetUserById(Principal.GetUserId()); IList <Notification> unReadNotifications = repository.GetNotificationsByUser(user).Unread().ToList(); if (!unReadNotifications.Any()) { return(HttpStatusCode.NotFound); } foreach (var notification in unReadNotifications) { notification.Read = true; } repository.CommitChanges(); UpdateUnreadCountInChat(repository, notificationService, user); var response = Response.AsJson(new { success = true }); return(response); }; }
public async Task Execute(IChatService chatService, string userName, ReadOnlyMemory <char> rhs) { await chatService.SendMessageAsync("Jeff's Github repository can by found here: https://github.com/csharpfritz/"); }
public CahtController(IChatService _chhatservice) { this._ChatService = _chhatservice; }
public AddCommand(IChatService chatService) { _chatService = chatService; }
public Task Execute(IChatService chatService, string userName, ReadOnlyMemory <char> rhs) { throw new NotImplementedException(); }
public ChatHub(IChatService chatService, ILogger <ChatHub> logger) { _chatService = chatService; _logger = logger; }
public ChatMessageHandler(ConnectionManager webSocketConnectionManager, IChatService service, IUserService serviceUser) : base(webSocketConnectionManager) { ServiceChat = service; ServiceUser = serviceUser; }
public Chat(IApplicationSettings settings, IResourceProcessor resourceProcessor, IChatService service, IJabbrRepository repository, ICache cache) { _settings = settings; _resourceProcessor = resourceProcessor; _service = service; _repository = repository; _cache = cache; }
public static TwitchService AsTwitchService(this IChatService svc) { return(svc as TwitchService); }
/// <summary> /// 关闭标签页 /// </summary> /// <param name="cs"></param> void CloseTab(IChatService cs) { //反绑定事件 cs.FileSendRequest -= cs_FileSendRequest; cs.TaskDiscardRequired -= cs_TaskDiscardRequired; cs.TaskAccepted -= cs_TaskAccepted; cs.RemoveHost(); chats.Remove(cs); this.TabPages.Remove(cs as TabPage); //padding receive task if (cs.PaddingReceiveTask != null) cs.PaddingReceiveTask.ForEach(s => Env.IPMClient.Commander.SendReleaseFilesSignal(cs.Host, s.PackageID)); }
public ListOfPromotedMembersCommand(IChatService chatService) { _chatService = chatService; }
public MainViewModel(INavigationService navigationService, IChatService chatService, FriendListViewModel friendList) { _navigationService = navigationService; _chatService = chatService; FriendList = friendList; }
public Chat(IResourceProcessor resourceProcessor, IChatService service, IJabbrRepository repository) { _resourceProcessor = resourceProcessor; _service = service; _repository = repository; }
public ChatTransport(IChatService chatService, IChatServiceCallbackEvent chatServiceCallbackEvent) { _proxyChat = chatService; _chatServiceCallbackEvent = chatServiceCallbackEvent; }
public CommandHandlerFactory(IChatService chatService) { ChatService = chatService; }
public DeleteMessageCommand(IChatService chatService) { _chatService = chatService; Triggers = new[] { "/del", "/delete" }; }
public WSChatController(IChatService service) { _service = service; }
private void QueueOrSendOnChannelResourceDataCached(IChatService svc, IChatChannel channel, Dictionary <string, IChatResourceData> resources) => QueueOrSendMessage(svc, channel, resources, OnChannelResourceDataCached);
public MessagesController(IChatService chatService) { this.chatService = chatService; }
private void OnChannelResourceDataCached(IChatService svc, IChatChannel channel, Dictionary <string, IChatResourceData> resources) { _chatDisplay.OnChannelResourceDataCached(channel, resources); }
public FriendsViewModel() { chatService = ServiceLocator.Current.GetInstance<IChatService>(); notificationService = ServiceLocator.Current.GetInstance<INotificationService>(); authenticationService = ServiceLocator.Current.GetInstance<IAuthenticationService>(); Contacts contacts = new Contacts(); contacts.SearchCompleted += contacts_SearchCompleted; contacts.SearchAsync(String.Empty, FilterKind.None, null); InviteContacts = new RelayCommand(async () => { if (CurrentUser != null) { StringBuilder emailAddresses = new StringBuilder(); foreach (User contact in Contacts) { emailAddresses.Append(contact.EmailAddresses).Append(" "); } emailAddresses.Remove(emailAddresses.Length - 1, 1); await chatService.CreateFriendsAsync(CurrentUser.UserId, emailAddresses.ToString()); ReadFriends(); } }); RegisterPushCommand = new RelayCommand(() => { /// Holds the push channel that is created or found. HttpNotificationChannel pushChannel; // The name of our push channel. string channelName = "slapchat"; // Try to find the push channel. pushChannel = HttpNotificationChannel.Find(channelName); // If the channel was not found, then create a new connection to the push service. if (pushChannel == null) { pushChannel = new HttpNotificationChannel(channelName); // Register for all the events before attempting to open the channel. pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated); pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred); pushChannel.Open(); // Bind this new channel for Tile events. pushChannel.BindToShellToast(); } else { // The channel was already open, so just register for all the events. pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated); pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred); Debug.WriteLine(pushChannel.ChannelUri.ToString()); PushChannel = pushChannel.ChannelUri; } }); RefreshCommand = new RelayCommand(() => { ReadFriends(); }); PropertyChanged += FriendsViewModel_PropertyChanged; }
public ChatController(IChatService chatService) { _chatService = chatService; }
public ChatHub(IChatService chatService) { _chatService = chatService; }
public ChatHub(IUserService userService, IChatService chatService) : base(userService) { this.chatService = chatService; }
public ChatController(IChatService chatDomain, IAuthService authDomain) { _chatService = chatDomain; _authService = authDomain; }
/// param name="fullCommandText" (this is the URL of the image we already found) public async Task Execute(IChatService chatService, string userName, string fullCommandText) { // Cheer 100 themichaeljolley 01/3/19 // Cheer 300 electrichavoc 01/3/19 // Cheer 300 devlead 01/3/19 // Cheer 100 brandonsatrom 01/3/19 // Cheer 642 cpayette 01/3/19 // Cheer 500 robertables 01/3/19 // Cheer 100 johanb 01/3/19 // Cheer 1000 bobtabor 01/3/19 var result = string.Empty; // TODO: Pull from ASP.NET Core Dependency Injection using (var client = _ClientFactory.CreateClient("ImageDescriptor")) { client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", _AzureApiKey); var requestParameters = "visualFeatures=Categories,Description,Color,Adult&language=en"; var uri = _AzureUrl + "?" + requestParameters; var body = JsonConvert.SerializeObject(new { url = ImageUrl }); var content = new StringContent(body, Encoding.UTF8, "application/json"); var apiResponse = await client.PostAsync(uri, content); try { apiResponse.EnsureSuccessStatusCode(); } catch (Exception) { await chatService.SendMessageAsync($"Unable to inspect the image from {userName}"); return; } result = await apiResponse.Content.ReadAsStringAsync(); apiResponse.Dispose(); } var visionDescription = JsonConvert.DeserializeObject <VisionDescription>(result); if (visionDescription.adult.isAdultContent && visionDescription.adult.adultScore > 0.85F) { await chatService.SendMessageAsync($"Hey {userName} - we don't like adult content here!"); // TODO: Timeout / Ban user return; } if (visionDescription.adult.isRacyContent) { await chatService.SendMessageAsync($"Hey {userName} - that's too racy ({visionDescription.adult.racyScore,0:P2}) for our chat room!"); // TODO: Timeout user return; } if (visionDescription.description.captions.Length == 0 && visionDescription.categories.Length > 0) { await chatService.SendMessageAsync($"No caption for the image submitted by {userName}, but it is: '{string.Join(',', visionDescription.categories.Select(c => c.name))}'"); return; } var description = string.Empty; if (Provider == ImageProviders.Instagram) { description = $"{userName} Instagram({_InstagramInfo.owner}) ({visionDescription.description.captions[0].confidence,0:P2}): {visionDescription.description.captions[0].text}"; } else { description = $"{userName} Photo ({visionDescription.description.captions[0].confidence,0:P2}): {visionDescription.description.captions[0].text}"; } await chatService.SendMessageAsync(description); }
private void MultiplexerInstance_OnTextMessageReceived(IChatService arg1, IChatMessage arg2) => this.RecieveChatMessage.Enqueue(arg2);
public UserController(UserManager <User> _userManager, IUserService _userService, IChatService _chatService, IMapper _mapper, IFileManager _fileManager, IContactService _contactService, IBlackListService _blackListService) { userManager = _userManager; userService = _userService; chatService = _chatService; mapper = _mapper; fileManager = _fileManager; contactService = _contactService; blackListService = _blackListService; }
public ValuesController(IUserService userService, IChatService chatService, IUserTracker userTracker) { _userService = userService; _chatService = chatService; _userTracker = userTracker; }
private async void Connect() { try { btnJoin.IsEnabled = false; string[] connectionPool = cbConnection.Text.Split(';'); SetStatus("Connecting"); bool connected = await ConnectToFirstWorking(connectionPool.Select(connectionString => { string[] addrAndPort = connectionString.Split(':'); return new IPEndPoint(IPAddress.Parse(addrAndPort[0]), int.Parse(addrAndPort[1])); }).ToList()); if (connected) { _mainChannel.DisconnectedEvent .ObserveOn(new DispatcherScheduler(Dispatcher)) .Subscribe((_) => OnMainChannelDisconnect()); var loginService = await _mainChannel.GetProxy<IChatLogin>(); LoginResult result = await loginService.Login(txtUserName.Text); if (result != LoginResult.Ok) { MessageBox.Show("Cant Login " + result); SetStatus("Disconnected"); } else { _chatServiceProxy = await _mainChannel.GetProxy<IChatService>(); UpdateRooms(); SetStatus("Connected"); btnJoin.IsEnabled = true; } } else { MessageBox.Show("Can't connect to any server"); SetStatus("Disconnected"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public ChatController(UserManager <User> userManager, IChatService chatService) { this.userManager = userManager; this._chatService = chatService; }
public ChatHub(IChatService service) { _service = service; }
public Chat(IChatService service) { chatService = service; }