private async Task RetrieveListServerAsync() { ListServer = await ResourcesCreator.GetListServerAsync(Inventory.CurrentUser.UserId); Inventory.SetListServer(ListServer); AttachListButton(); }
public static void Initialize() { ResourcesCreator.Establish(); Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0); socket.Connect("8.8.8.8", 65530); IPEndPoint endPoint = socket.LocalEndPoint as IPEndPoint; localIP = endPoint.Address.ToString(); socket.Close(); // httpClient = new HttpClient(); httpClient.BaseAddress = new Uri(Route.BaseUrl); httpClient.DefaultRequestHeaders.Accept.Clear(); httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); // NotificationInvalidEmailOrPassword = Application.Current.FindResource("NotificationInvalidEmailOrPassword").ToString(); ExceptionNullFilePath = Application.Current.FindResource("ExceptionNullFilePath").ToString(); ExceptionFileNotFound = Application.Current.FindResource("ExceptionFileNotFound").ToString(); // loginPage = new LoginPage("a"); mainPage = new MainPage(); userSettingPage = new UserSettingPage(); }
private async void CreateServerDialog_RequestCreateServer(object sender, RequestCreateServerArgs e) { Server server = await ResourcesCreator.CreateServerAsync(e.ServerName); ListServer.Add(server); CreateServerButton(server); }
private async void ButtonJoin_Click(object sender, RoutedEventArgs e) { if (TextBoxInstantInvite.Text != "") { Server server = await ResourcesCreator.GetServerByInstantInviteAsync(TextBoxInstantInvite.Text); if (server == null) { MessageBox.Show("The instant invite you have typed doesn't exist."); } else { RequestJoinServer?.Invoke(this, new RequestJoinServerArgs() { Server = server }); } } }
private static async void ServerManager_ServerChanged(object sender, ServerManager.ServerChangedArgs e) { Role userRoleInCurrentServer = await ResourcesCreator.GetUserRoleInCurrentServerAsync(Inventory.CurrentUser.UserId, e.Now.ServerId); Inventory.SetUserRoleInCurrentServer(userRoleInCurrentServer); if (Inventory.CurrentChannel != null) { await HubManager.SendExitChannelSignalAsync(Inventory.CurrentChannel.ChannelId); Inventory.ClearCurrentChannel();// ???? } if (e.Previous != null) { await HubManager.SendExitServerSignalAsync(e.Previous.ServerId); } await HubManager.SendEnterServerSignalAsync(e.Now.ServerId); MessageManager.ClearContent(); RoleManager.ChangeServer(e.Previous, e.Now); ChannelManager.ChangeServer(e.Previous, e.Now); }