private void CommandList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { string text = ""; ListBox commandlist = (ListBox)sender; if (commandlist.SelectedItem != null) { text = (string)commandlist.SelectedItem + "\r\n"; SP2.SendData(text); } }
private void treeView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { var tree = sender as TreeView; CMDNode item = tree.SelectedItem as CMDNode; if (item.ID == 2) { SP2.SendData(item.NodeName); } } catch { } }