public GoComment getCommon() { GoComment node = null; foreach (GoObject obj in goView1.Document) { node = obj as GoComment; if (node != null) { break; } } return(node); }
public void addCommon(string str) { if (this.InvokeRequired) { SimpleDel s = addCommon; this.Invoke(s, new object[] { str }); } else { GoComment comment = getCommon(); comment.Text = string.Format("{0}\n{1}", comment.Text, str); LogHelper.Info(str); } }
public ScanGroup LoadNodesFromXml(string xmlFilePath = "") { ScanGroup retObj = null; if (string.IsNullOrEmpty(xmlFilePath)) { return(retObj); } XmlFilePath = xmlFilePath; try { var xmlObj = WvsXmlParser.LoadFromFile(XmlFilePath); retObj = xmlObj; Cursor oldcursor = myView.Cursor; myView.Cursor = Cursors.WaitCursor; myView.Document.Clear(); myMap.Clear(); // call AddTextNode for all the classes in the Northwoods.Go assembly InitNodesFromScanGroup(xmlObj); LayoutNodes(); GoComment comment = new GoComment(); comment.Text = "双击查看详情"; comment.Editable = false; comment.Label.Editable = false; comment.Position = new PointF(10, 70); myView.Document.Add(comment); myView.Cursor = oldcursor; } catch (Exception ex) { } return(retObj); }
//SoundPlayer warnSoundPlayer = new SoundPlayer(); public SRControl() { InitializeComponent(); ToolStripMenuItem btnSave = new ToolStripMenuItem(); btnSave.Text = "保存布局"; btnSave.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; btnSave.Click += new EventHandler(btnSave_Click); ToolStripMenuItem btnDelete = new ToolStripMenuItem(); btnDelete.Text = "删除布局"; btnDelete.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; btnDelete.Click += new EventHandler(btnDelete_Click); ToolStripMenuItem btnClear = new ToolStripMenuItem(); btnClear.Text = "清除警告信息"; btnClear.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; btnClear.Click += new EventHandler(btnClear_Click); contextMenuStrip.Items.Add(btnSave); contextMenuStrip.Items.Add(btnDelete); contextMenuStrip.Items.Add(new ToolStripSeparator()); contextMenuStrip.Items.Add(btnClear); this.Disposed += new EventHandler(SRControl_Disposed); goView1.NewLinkPrototype = new AnimatedLink(); this.goView1.NewLinkClass = typeof(AnimatedLink); StateChartDocument filedoc = StateChartDocument.LoadXml(loc); if (filedoc == null) { filedoc = new StateChartDocument(); GoComment com = StateChartDocument.NewComment(); com.Width = this.Width; com.Visible = false; filedoc.Add(com); } else { isLoad = true; } GoDocument doc = filedoc; this.goView1.Document = doc; goView1.ObjectDoubleClicked += new GoObjectEventHandler(goView1_ObjectDoubleClicked); goView1.Document.UndoManager = new GoUndoManager(); logHelper = new TextLogHelper(label1, this, ip, port); logHelper.SRControl = this; _cedaSubscribe = new CedaManager(logHelper); timer1 = new Timer(); this.timer1.Interval = 50; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); //setTimeEnable(true); //_cedaSubscribe.SRControl = this; //warnSoundPlayer.SoundLocation = Consts.SoundLocation; device = new DeviceImpl(); device.init(this, Microsoft.DirectX.DirectSound.CooperativeLevel.Priority); }