private void selectServer(object serverNew) { ServerProfileView serverInfo = (ServerProfileView)serverNew; // Set ServerProfile App.UpdateTransmitServer(serverInfo.vServerProfile); }
private void editServer(object serverSelected) { ServerProfileView serverInfo = (ServerProfileView)serverSelected; ServerProfile serverProfile = serverInfo.vServerProfile.Copy(); if (new DialogServerConfig(serverProfile).ShowDialog() is bool update && update == true) { int index = ObServerInfoList.IndexOf(serverInfo); if (index >= 0) { ObServerInfoList[index] = new ServerProfileView(serverProfile); } } }
private async void fetchServerInfo(object parameter) { DialogButton dialog = new DialogButton(sr_ask_keep_info_title, sr_ask_keep_info_message); dialog.ShowDialog(); if (!(dialog.CancelableResult is bool keep)) { return; } isFetchInProcess = true; App.UpdateProgress(40); await Task.Run(() => { foreach (ServerProfileView serverInfo in ObServerInfoList) { // isFetchInProcess is also use to cancel task if (isFetchInProcess == false) { return; } serverInfo.UpdateIPInfo(!keep); } }); try { // it will update the server info only if the server is not changed ServerProfileView serverInfo = ObServerInfoList.First(x => x.HostIP == config.RemoteServer.vHostIP && x.Port == config.RemoteServer.vPort); App.UpdateTransmitServer(serverInfo.vServerProfile); } catch (Exception) { } isFetchInProcess = false; App.UpdateProgress(-40); CommandManager.InvalidateRequerySuggested(); }