private void menuItemProcessAdd_Click(object sender, EventArgs e) { if (this.calculateThread != null) { return; } ProcessPropertyForm processPropertyForm = new ProcessPropertyForm(this.processTemplateCollection); if (processPropertyForm.ShowDialog(this) == DialogResult.OK) { ControlRequestMessage controlRequestMessage = new ControlRequestMessage(SerializeWriter.ToBinary <AddProcessMessage>(new AddProcessMessage(processPropertyForm.RCProcess)).Bytes); bool flag = false; foreach (object obj in this.listViewRCClient.SelectedItems) { RCClientControl.ClientItem clientItem = (RCClientControl.ClientItem)obj; try { clientItem.AddProcess(processPropertyForm.RCProcess); controlRequestMessage.AddClientID(clientItem.ID); } catch (ArgumentException) { flag = true; } } this.messageList.Add(controlRequestMessage); if (flag) { Utility.ShowErrorMessage(LocalizeText.Get(343)); } this.RecalculateCommonProcess(); } }
private void CalculateCommonProcess() { this.listViewProcess.Items.Clear(); if (this.listViewRCClient.SelectedItems.Count > 0) { SortedList <RCProcess, int> sortedList = new SortedList <RCProcess, int>(); foreach (object obj in this.listViewRCClient.SelectedItems) { RCClientControl.ClientItem clientItem = (RCClientControl.ClientItem)obj; foreach (RCProcess key in clientItem.ProcessList) { int num = 0; if (!sortedList.ContainsKey(key)) { sortedList.Add(key, 0); } else { num = sortedList[key]; } sortedList[key] = num + 1; } } int count = this.listViewRCClient.SelectedItems.Count; foreach (KeyValuePair <RCProcess, int> keyValuePair in sortedList) { this.listViewProcess.Items.Add(new RCClientControl.ProcessItem(keyValuePair.Key, keyValuePair.Value != count)); } } }
private void menuItemProcessRemove_Click(object sender, EventArgs e) { if (this.listViewProcess.SelectedItems.Count > 0 && this.calculateThread == null) { string text = ((RCClientControl.ProcessItem) this.listViewProcess.SelectedItems[0]).Text; ControlRequestMessage controlRequestMessage = new ControlRequestMessage(SerializeWriter.ToBinary <RemoveProcessMessage>(new RemoveProcessMessage(text)).Bytes); foreach (object obj in this.listViewRCClient.SelectedItems) { RCClientControl.ClientItem clientItem = (RCClientControl.ClientItem)obj; clientItem.RemoveProcess(text); controlRequestMessage.AddClientID(clientItem.ID); } this.messageList.Add(controlRequestMessage); this.RecalculateCommonProcess(); } }
private void menuItemSelfUpdate_Click(object sender, EventArgs e) { if (Utility.InputYesNoFromWarning(LocalizeText.Get(344))) { SelfUpdateForm selfUpdateForm = new SelfUpdateForm(); if (selfUpdateForm.ShowDialog() == DialogResult.OK) { ControlRequestMessage controlRequestMessage = new ControlRequestMessage(SerializeWriter.ToBinary <ClientSelfUpdateMessage>(new ClientSelfUpdateMessage(selfUpdateForm.Argument)).Bytes); foreach (object obj in this.listViewRCClient.SelectedItems) { RCClientControl.ClientItem clientItem = (RCClientControl.ClientItem)obj; controlRequestMessage.AddClientID(clientItem.ID); this.RemoveClient(clientItem.Name, clientItem.IP, clientItem.ID); } this.messageList.Add(controlRequestMessage); } } }
private void menuItemProcessProperty_Click(object sender, EventArgs e) { if (this.listViewProcess.SelectedItems.Count == 1 && this.calculateThread == null) { bool multEdit = this.listViewRCClient.SelectedItems.Count > 1; int num = 8; foreach (object obj in this.listViewRCClient.SelectedItems) { RCClientControl.ClientItem clientItem = (RCClientControl.ClientItem)obj; if (clientItem.Version < num) { num = clientItem.Version; } } ProcessPropertyForm processPropertyForm = new ProcessPropertyForm(((RCClientControl.ProcessItem) this.listViewProcess.SelectedItems[0]).Process, num, true, multEdit); if (processPropertyForm.ShowDialog() == DialogResult.OK) { bool flag = this.listViewRCClient.SelectedItems.Count == 1; foreach (object obj2 in this.listViewRCClient.SelectedItems) { RCClientControl.ClientItem clientItem2 = (RCClientControl.ClientItem)obj2; ModifyProcessMessage value; if (flag) { value = new ModifyProcessMessage(processPropertyForm.RCProcess); clientItem2.ModifyProcess(processPropertyForm.RCProcess); } else { RCProcess process = clientItem2.ModifyProcessWithoutPrimaryInfo(processPropertyForm.RCProcess); value = new ModifyProcessMessage(process); } ControlRequestMessage controlRequestMessage = new ControlRequestMessage(SerializeWriter.ToBinary <ModifyProcessMessage>(value).Bytes); controlRequestMessage.AddClientID(clientItem2.ID); this.messageList.Add(controlRequestMessage); } } this.RecalculateCommonProcess(); } }