void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.msk = ((NetControl.MapMark)(target)); #line 8 "..\..\MapMark.xaml" this.msk.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.UserControl_MouseLeftButtonDown); #line default #line hidden #line 8 "..\..\MapMark.xaml" this.msk.MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.UserControl_MouseRightButtonUp); #line default #line hidden return; case 2: this.node = ((System.Windows.Controls.Grid)(target)); return; case 3: this.nodeimage = ((System.Windows.Controls.Image)(target)); return; case 4: this.alteration = ((System.Windows.Controls.Border)(target)); return; } this._contentLoaded = true; }
private void UserControl_MouseRightButtonUp(object sender, MouseButtonEventArgs e) { MapMark mark = (MapMark)sender; marks.Add(mark); ContextMenu contextMenu = new ContextMenu(); MenuItem menuItem = new MenuItem(); menuItem.Header = "删除设备"; menuItem.Click += MenuItem_Click; contextMenu.Items.Add(menuItem); mark.ContextMenu = contextMenu; MainWindow.mapMark = mark; }
private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MapMark m = (MapMark)sender; mark = m; if (MainWindow.optState == MainWindow.optState_Type.pointmode) { MainWindow.command = 0; dt = signcheck(mark.sign); GetRefreshpage(); } else if (MainWindow.optState == MainWindow.optState_Type.linemode) { if (MainWindow.tablename.Count >= 2)//保证下面列表中只有2个数据 { MainWindow.tablename = new List <string>(); MainWindow.markname = new List <string>(); MainWindow.marksign = new List <string>(); } table = Device.checktable(mark.sign); MainWindow.tablename.Add(table); MainWindow.markname.Add(mark.Name); MainWindow.marksign.Add(mark.sign); dt = signcheck(mark.sign); couva = System.Convert.ToInt16(dt.Rows[0]["端口数"]); if (couva <= 0) { MessageBox.Show("端口已被占用"); MainWindow.command = 0; MainWindow.optState = MainWindow.optState_Type.pointmode; MainWindow.pline = new List <Point>(); } click_proc(new Point(x + node.Width / 2, y + node.Height / 2)); } }