示例#1
0
        public async Task EnableArchiveRoom(ChatHubRoom room)
        {
            try
            {
                if (room.Status == ChatHubRoomStatus.Archived.ToString())
                {
                    room.Status = ChatHubRoomStatus.Enabled.ToString();
                }
                else if (room.Status == ChatHubRoomStatus.Enabled.ToString())
                {
                    room.Status = ChatHubRoomStatus.Archived.ToString();
                }

                await ChatHubService.UpdateChatHubRoomAsync(room);

                await logger.LogInformation("Room Archived {ChatHubRoom}", room);

                NavigationManager.NavigateTo(NavigateUrl());
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Archiving Room {ChatHubRoom} {Error}", room, ex.Message);

                ModuleInstance.AddModuleMessage("Error Archiving Room", MessageType.Error);
            }
        }
示例#2
0
        public static void Main(string[] args)
        {
            var server = new Server
            {
                Services = { ChatHubService.BindService(new ChatHub()), ClientRegistryService.BindService(new ClientRegistry()) },
                Ports    = { new ServerPort(Host, Port, ServerCredentials.Insecure) }
            };

            server.Start();

            Console.WriteLine("ChatServer listening on port " + Port);
            Console.WriteLine("Press any key to stop the server...");
            Console.ReadKey();

            server.ShutdownAsync().Wait();
        }
示例#3
0
        public async Task DeleteRoom(int id)
        {
            try
            {
                await ChatHubService.DeleteChatHubRoomAsync(id, ModuleState.ModuleId);

                await logger.LogInformation("Room Deleted {ChatHubRoomId}", id);

                NavigationManager.NavigateTo(NavigateUrl());
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Deleting Room {ChatHubRoomId} {Error}", id, ex.Message);

                ModuleInstance.AddModuleMessage("Error Deleting Room", MessageType.Error);
            }
        }
示例#4
0
 /// <summary>
 /// Erstellt eine neue Instanz
 /// </summary>
 public ChatViewModel()
 {
     SendCommand = new RelayCommand(SendExecute, SendCanExecute);
     SelectedItemChangedCommand = new RelayCommand(SelectedItemChangedExecute);
     chatHubService             = new ChatHubService(this);
 }