Example #1
0
        private void diffSubmoduleSummaryMenuItem_Click(object sender, EventArgs e)
        {
            var submodules = DiffFiles.SelectedItems.Where(it => it.IsSubmodule).Select(it => it.Name).Distinct().ToList();

            string summary = "";

            foreach (var name in submodules)
            {
                summary += Module.GetSubmoduleSummary(name);
            }

            using (var frm = new FormEdit(UICommands, summary))
            {
                frm.ShowDialog(this);
            }
        }
Example #2
0
        private void 打开文件ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog saveFile = new OpenFileDialog();

            saveFile.Title  = "请选择保存文件路径";
            saveFile.Filter = "NetworkView 文档(*.nwp)|*.nwp";

            if (saveFile.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string        path = saveFile.FileName;
            DeviceSetting ds   = new DeviceSetting();

            ds = (DeviceSetting)SerializeClassHelper.DeserializeObject(path, ds);
            this.flowLayoutPanel_1.Controls.Clear();
            foreach (DeviceItemModel model in ds.list)
            {
                DeviceItem di = new DeviceItem()
                {
                    IPAddress      = model.IPAddress,
                    DeviceStatus   = DeviceStatus.NotMonitor,
                    PCHostName     = model.PCHostName,
                    DeviceMac      = model.DeviceMac,
                    DeviceTypeName = model.DeviceTypeName
                };
                ContextMenuStrip controlContextMenuStrip = new ContextMenuStrip();
                controlContextMenuStrip.Items.Add("编辑", null, new EventHandler((object senders, EventArgs args) => {
                    FormEdit retform      = new FormEdit(di.DeviceMac, di.DeviceTypeName, di.PCHostName);
                    retform.saveCallBack += new FormEdit.SaveCallBack((string mac, string devicetypename, string pchostname) => {
                        di.DeviceMac      = mac;
                        di.DeviceTypeName = devicetypename;
                        di.PCHostName     = pchostname;
                    });
                    retform.ShowDialog();
                }));
                di.ContextMenuStrip = controlContextMenuStrip;
                this.flowLayoutPanel_1.Controls.Add(di);
            }
        }
Example #3
0
        }  //search

        private void button2_Click(object sender, EventArgs e)
        {
            FormEdit addform = new FormEdit(new Order());

            addform.ShowDialog();
            Order newOrder = addform.getOrder();

            if (newOrder != null)
            {
                var query = orders.Where(m => m.ID == newOrder.ID);
                if (query.Count() == 0)
                {
                    orders.Add(newOrder);
                    orderBindingSource.DataSource = orders;
                }
                else
                {
                    MessageBox.Show("失败!订单号已存在!");
                }
            }
        }  //add
Example #4
0
        private void diffSubmoduleSummaryMenuItem_Click(object sender, EventArgs e)
        {
            string summary = Module.GetSubmoduleSummary(DiffFiles.SelectedItem.Name);

            using (var frm = new FormEdit(summary)) frm.ShowDialog(this);
        }
Example #5
0
        }  //delete

        private void button4_Click(object sender, EventArgs e)
        {
            FormEdit reviseform = new FormEdit((Order)orderBindingSource.Current);

            reviseform.ShowDialog();
        }    // revise
Example #6
0
        private void btn_startscan_Click(object sender, EventArgs e)
        {
            this.flowLayoutPanel_1.Controls.Clear();
            this.cb_timerCheck.Checked = false;
            Task.Factory.StartNew(() => {
                List <string> list = GetLiveIP(txt_ipstart.Text, txt_ipend.Text);


                LogMSG("需要检查的IP地址数量为:" + list.Count);
                this.Invoke(new MethodInvoker(() =>
                {
                    this.progressBar_01.Style  = ProgressBarStyle.Marquee;
                    this.btn_startscan.Enabled = false;
                }));
                bool flag1 = cb_ping.Checked;
                bool flag2 = cb_checkmac.Checked;
                bool flag3 = cb_checkhostname.Checked;

                List <Task> tasks = StartScan(list, new bool[] { flag1, flag2, flag3 }, new ScanCompleteCallBack((PingReply result, string ipaddress, string hostname, string macaddress) => {
                    if (result.Status == IPStatus.Success)
                    {
                        LogMSG(ipaddress + " - Alive");
                        this.Invoke(new MethodInvoker(() =>
                        {
                            DeviceItem di = new DeviceItem()
                            {
                                IPAddress      = ipaddress,
                                DeviceStatus   = DeviceStatus.Alive,
                                PCHostName     = hostname,
                                DeviceMac      = macaddress,
                                DeviceTypeName = "PC"
                            };
                            ContextMenuStrip controlContextMenuStrip = new ContextMenuStrip();
                            controlContextMenuStrip.Items.Add("编辑", null, new EventHandler((object senders, EventArgs args) => {
                                FormEdit retform      = new FormEdit(di.DeviceMac, di.DeviceTypeName, di.PCHostName);
                                retform.saveCallBack += new FormEdit.SaveCallBack((string mac, string devicetypename, string pchostname) => {
                                    di.DeviceMac      = mac;
                                    di.DeviceTypeName = devicetypename;
                                    di.PCHostName     = pchostname;
                                });
                                retform.ShowDialog();
                            }));
                            di.ContextMenuStrip = controlContextMenuStrip;
                            this.flowLayoutPanel_1.Controls.Add(di);
                        }));
                    }
                    if (cb_showall.Checked)
                    {
                        if (result.Status != IPStatus.Success)
                        {
                            this.Invoke(new MethodInvoker(() =>
                            {
                                DeviceItem di = new DeviceItem()
                                {
                                    IPAddress      = ipaddress,
                                    DeviceStatus   = DeviceStatus.Colsed,
                                    PCHostName     = hostname,
                                    DeviceMac      = macaddress,
                                    DeviceTypeName = "PC"
                                };

                                ContextMenuStrip controlContextMenuStrip = new ContextMenuStrip();
                                controlContextMenuStrip.Items.Add("编辑", null, new EventHandler((object senders, EventArgs args) => {
                                    FormEdit retform      = new FormEdit(di.DeviceMac, di.DeviceTypeName, di.PCHostName);
                                    retform.saveCallBack += new FormEdit.SaveCallBack((string mac, string devicetypename, string pchostname) => {
                                        di.DeviceMac      = mac;
                                        di.DeviceTypeName = devicetypename;
                                        di.PCHostName     = pchostname;
                                    });
                                    retform.ShowDialog();
                                }));

                                di.ContextMenuStrip = controlContextMenuStrip;

                                this.flowLayoutPanel_1.Controls.Add(di);
                            }));
                        }
                    }
                }));

                Task.Run(async() =>
                {
                    await Task.WhenAll(tasks);
                    this.Invoke(new MethodInvoker(() =>
                    {
                        this.progressBar_01.Style  = ProgressBarStyle.Blocks;
                        this.progressBar_01.Value  = 100;
                        this.btn_startscan.Enabled = true;
                    }));
                    LogMSG("IP地址发现,已完成");
                    TongJi();
                });
            });
        }