private void CopyLinkPictureBox_Click(object sender, EventArgs e) { // 当前ServerComboBox中至少有一项 if (ServerComboBox.SelectedIndex == -1) { MessageBoxX.Show(i18N.Translate("Please select a server first")); return; } try { //听说巨硬BUG经常会炸,所以Catch一下 :D var server = (Server)ServerComboBox.SelectedItem; string text; if (ModifierKeys == Keys.Control) { text = ShareLink.GetNetchLink(server); } else { text = ShareLink.GetShareLink(server); } Clipboard.SetText(text); } catch (Exception) { // ignored } }
private void CopyLinkPictureBox_Click(object sender, EventArgs e) { // 当前ServerComboBox中至少有一项 if (ServerComboBox.SelectedIndex != -1) { var selectedMode = (Models.Server)ServerComboBox.SelectedItem; try { //听说巨硬BUG经常会炸,所以Catch一下 :D Clipboard.SetText(ShareLink.GetShareLink(selectedMode)); } catch (Exception) { } } else { MessageBoxX.Show(i18N.Translate("Please select a server first")); } }