private void UpdateHosts(object sender, HostEventArgs eventArgs) { if (InvokeRequired) { Invoke(new HostManager.HostAddedDelegate(UpdateHosts), sender, eventArgs); return; } comboBoxFrom.Items.Add(eventArgs.Host); }
private void AddHostToComboBox(object sender, HostEventArgs eventArgs) { if (InvokeRequired) { Invoke(new HostManager.HostAddedDelegate(AddHostToComboBox), sender, eventArgs); return; } Host host = eventArgs.Host; comboBoxSayTo.Items.Add(host); comboBoxThat.Items.Add(host); comboBoxIs.Items.Add(host); }
/// <summary> /// 触发主机下线事件 /// </summary> /// <param name="e">参数</param> protected virtual void OnHostOffline(HostEventArgs e) { if (HostOffline == null) { return; } if (IPMClient.NeedPostMessage) { IPMClient.SendSynchronizeMessage(sopHostRemove, e); } else { HostOffline(this, e); } }
private void AddHostToListView(object sender, HostEventArgs eventArgs) { if (InvokeRequired) { Invoke(new HostManager.HostAddedDelegate(AddHostToListView), sender, eventArgs); return; } Host host = eventArgs.Host; ListViewItem item = new ListViewItem(host.IpAddress.ToString()); item.SubItems.Add(host.MacAddress.ToString()); item.SubItems.Add(host.Name); listView_hotes.Items.Add(item); }
public void AddHost(object sender, HostEventArgs eventArgs) { Host host = eventArgs.Host; for (int i = 0; i < Hosts.Count(); i++) { if (host.IpAddress.Equals(Hosts[i].IpAddress) || host.MacAddress.Equals(Hosts[i].MacAddress)) { Hosts[i] = host; return; } } Hosts.Add(host); HostAdded?.Invoke(this, new HostEventArgs() { Host = host }); }
void Service_HostEvent(object sender, HostEventArgs e) { Trace.WriteLine(e.ToString()); }
public override void Main(object sender, HostEventArgs e) { Field curfield = this.DetailForm.MarcEditor.FocusedField; ScriptActionCollection actions = new ScriptActionCollection(); bool bActive = false; // 加拼音 actions.NewItem("加拼音", "给.....加拼音", "AddPinyin", false); // 7*1$a <-- 200$f if (curfield != null && (curfield.Name == "701" || curfield.Name == "711")) { bActive = true; } else { bActive = false; } actions.NewItem("7*1$a <-- 200$f", "将200$f内容加入701/711字段$a", "Copy200fTo7x1a", bActive); // 7*2$a <-- 200$g if (curfield != null && (curfield.Name == "702" || curfield.Name == "712")) { bActive = true; } else { bActive = false; } actions.NewItem("7*2$a <-- 200$g", "将200$g内容加入702/712字段$a", "Copy200gTo7x2a", bActive); // 410 <-- 225 if (curfield != null && (curfield.Name == "225" || curfield.Name == "410")) { bActive = true; } else { bActive = false; } actions.NewItem("410 <-- 225", "将225$a内容加入410 $1200 $a", "Copy225To410", bActive); // 加入著者号 if (curfield != null && curfield.Name == "905") { bActive = true; } else { bActive = false; } actions.NewItem("加入著者号", "根据701/711/702/712$a内容, 创建905$e", "AddAuthorNumber", bActive); // 加入种次号 if (curfield != null && curfield.Name == "905" && this.DetailForm.MarcEditor.FocusedSubfieldName == 'd') { bActive = true; } else { bActive = false; } actions.NewItem("加入种次号", "根据905$d内容, 创建905$e", "AddZhongcihao", bActive); // 维护种次号 actions.NewItem("维护种次号", "根据905$d内容中的类号, 出现维护种次号的界面", "ManageZhongcihao", false); // 出版地 if (curfield != null && curfield.Name == "210") { bActive = true; } else { bActive = false; } actions.NewItem("210$a$c <-- 010$a", "根据010$a中ISBN出版社代码, 自动创建出版社子字段210$a$c", "AddPublisher", bActive); // 规整ISBN为13 if (curfield != null && curfield.Name == "010") { bActive = true; } else { bActive = false; } actions.NewItem("规整ISBN-13", "对010$a中ISBN进行规整", "HyphenISBN_13", bActive); // 规整ISBN为10 if (curfield != null && curfield.Name == "010") { bActive = true; } else { bActive = false; } actions.NewItem("规整ISBN-10", "对010$a中ISBN进行规整", "HyphenISBN_10", bActive); // 102国家代码 地区代码 if (curfield != null && curfield.Name == "102") { bActive = true; } else { bActive = false; } actions.NewItem("102$a$b <-- 010$a", "根据010$a中ISBN出版社代码, 自动创建102字段$a国家代码$b地区代码", "Add102", bActive); ScriptActionMenuDlg dlg = new ScriptActionMenuDlg(); dlg.Actions = actions; if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt) { dlg.AutoRun = false; } else { dlg.AutoRun = this.DetailForm.MainForm.AppInfo.GetBoolean("detailform", "gen_auto_run", false); } // dlg.StartPosition = FormStartPosition.CenterScreen; this.DetailForm.MainForm.AppInfo.LinkFormState(dlg, "gen_data_dlg_state"); dlg.ShowDialog(); this.DetailForm.MainForm.AppInfo.UnlinkFormState(dlg); this.DetailForm.MainForm.AppInfo.SetBoolean("detailform", "gen_auto_run", dlg.AutoRun); if (dlg.DialogResult == DialogResult.OK) { this.Invoke(dlg.SelectedAction.ScriptEntry); } }