private void ServerDataGrid_OnCellDoubleTapped(object sender, GridCellDoubleTappedEventArgs e) { if (e.ChangedButton != MouseButton.Left) { return; } if (ServerDataGrid.CurrentColumn != null && ServerDataGrid.SelectedItem is Server server) { var index = server.Index - 1; var mappingName = ServerDataGrid.CurrentColumn.MappingName; if (mappingName == Resources[@"IndexMappingName"].ToString()) { _controller.ShowConfigForm(index); } else if (mappingName == Resources[@"ConnectingMappingName"].ToString()) { server.Connections.CloseAll(); } else if (mappingName == Resources[@"MaxDownSpeedMappingName"].ToString() || mappingName == Resources[@"MaxUpSpeedMappingName"].ToString()) { server.SpeedLog.ClearMaxSpeed(); } else if (mappingName == Resources[@"TotalDownloadBytesMappingName"].ToString() || mappingName == Resources[@"TotalUploadBytesMappingName"].ToString()) { server.SpeedLog.ClearTrans(); } else if (mappingName == Resources[@"TotalDownloadRawBytesMappingName"].ToString()) { server.SpeedLog.Clear(); server.Enable = true; } else if (mappingName == Resources[@"ConnectErrorMappingName"].ToString() || mappingName == Resources[@"ErrorTimeoutTimesMappingName"].ToString() || mappingName == Resources[@"ErrorEmptyTimesMappingName"].ToString() || mappingName == Resources[@"ErrorContinuousTimesMappingName"].ToString() || mappingName == Resources[@"ErrorPercentMappingName"].ToString()) { server.SpeedLog.ClearError(); server.Enable = true; } else { ServerDataGrid.ClearSelections(false); ServerDataGrid.SelectCell(server, ServerDataGrid.Columns[0]); } } }
private void ServerDataGrid_OnCellTapped(object sender, GridCellTappedEventArgs e) { if (e.ChangedButton != MouseButton.Left) { return; } if (ServerDataGrid.CurrentColumn != null && ServerDataGrid.SelectedItem is Server server) { var index = server.Index - 1; var mappingName = ServerDataGrid.CurrentColumn.MappingName; if (mappingName == Resources[@"ServerMappingName"].ToString()) { _controller.DisconnectAllConnections(true); _controller.SelectServerIndex(index); } else if (mappingName == Resources[@"GroupMappingName"].ToString()) { var group = server.Group; if (!string.IsNullOrEmpty(group)) { var enable = !server.Enable; foreach (var sameGroupServer in ServerLogViewModel.ServersCollection) { if (sameGroupServer.Group == group) { sameGroupServer.Enable = enable; } } Global.SaveConfig(); } } else { return; } ServerDataGrid.ClearSelections(false); ServerDataGrid.SelectCell(server, ServerDataGrid.Columns[0]); } }