private void toolStripMenuItemServerInfo_Click(object sender, EventArgs e) { try { for (int i = 0; i < this.myOPCServers.Count; i++) { OPCServer osg = this.myOPCServers[i]; CommonController.Instance.PrintLog(osg.Name); for (int j = 0; j < osg.ReadSubscriptions.Count; j++) { OPCSubscription os = osg.ReadSubscriptions[j]; CommonController.Instance.PrintLog(os.Name); if (os.ItemTypes == null) { CommonController.Instance.PrintLog("itemtype null"); } else { for (int k = 0; k < os.ItemTypes.Length; k++) { CommonController.Instance.PrintLog(string.Format(" {0} {1} {2}", os.ItemTypes[k].Name, os.ItemValues[k], os.Subscription.Items[k].ItemName)); } } } for (int j = 0; j < osg.WriteSubscriptions.Count; j++) { OPCSubscription os = osg.WriteSubscriptions[j]; CommonController.Instance.PrintLog(os.Name); if (os.ItemTypes == null) { CommonController.Instance.PrintLog("itemtype null"); } else { for (int k = 0; k < os.ItemTypes.Length; k++) { CommonController.Instance.PrintLog(string.Format(" {0} {1} {2}", os.ItemTypes[k].Name, os.ItemValues[k], os.Subscription.Items[k].ItemName)); } } } CommonController.Instance.PrintLog("==============="); } } catch (Exception ex) { CommonController.Instance.PrintLog(ex.StackTrace); } }
private void PrintServerList(Graphics g) { try { /* string txtttt = string.Format("{0} {1} {2}", this.myOPCServers.Count, this.myReadDTs.Count, this.myWriteDTs.Count); * g.DrawString(txtttt, this.tooltipFont, Brushes.Black, 500, 10); */ int gy = 0; for (int i = 0; i < this.myReadDTs.Count; i++) { OTSDataTable odt = this.myReadDTs[i]; g.DrawString(i + ", " + odt.ToString(), this.tooltipFont, Brushes.Blue, 600, gy); gy += 13; for (int j = 0; j < odt.TagNames.Length; j++) { string txt = string.Format("{0,15:0.000} {1}", odt.TagValues[j], odt.TagNames[j]); //string txt = string.Format("{0} ", odt.TagNames[j]); g.DrawString(txt, this.tooltipFont, Brushes.Black, 615, gy); gy += 13; } } for (int i = 0; i < this.myWriteDTs.Count; i++) { OTSDataTable odt = this.myWriteDTs[i]; g.DrawString(i + ", " + odt.ToString(), this.tooltipFont, Brushes.Blue, 600, gy); gy += 13; for (int j = 0; j < odt.TagNames.Length; j++) { string txt = string.Format("{0,15:0.000} {1}", odt.TagValues[j], odt.TagNames[j]); //string txt = string.Format("{0}", odt.TagNames[j]); g.DrawString(txt, this.tooltipFont, Brushes.Black, 615, gy); gy += 13; } } gy = 0; for (int i = 0; i < this.myOPCServers.Count; i++) { OPCServer osg = this.myOPCServers[i]; g.DrawString(osg.ToString(), this.tooltipFont, Brushes.Blue, 0, gy); gy += 13; if (osg.CommandSubscription != null) { OPCSubscription os = osg.CommandSubscription; string txt = string.Format("{0} {1} {2} {3} {4} {5}", os.Type, os.Name, os.ConnectedDataTableIndex, os.ConnectedDataTableName, os.ConnectedServerName, os.ConnectedSubscriptionName); g.DrawString(txt, this.tooltipFont, Brushes.Black, 15, gy); gy += 13; for (int k = 0; k < os.Subscription.Items.Length; k++) { txt = string.Format("{0}", os.Subscription.Items[k].ItemName); g.DrawString(txt, this.tooltipFont, Brushes.Black, 30, gy); gy += 13; } } for (int j = 0; j < osg.ReadSubscriptions.Count; j++) { OPCSubscription os = osg.ReadSubscriptions[j]; string txt = string.Format("{0} {1} {2} {3} {4} {5} {6}", j, os.Type, os.Name, os.ConnectedDataTableIndex, os.ConnectedDataTableName, os.ConnectedServerName, os.ConnectedSubscriptionName); g.DrawString(txt, this.tooltipFont, Brushes.Black, 15, gy); gy += 13; for (int k = 0; k < os.Subscription.Items.Length; k++) { //txt = string.Format("{0}", os.Subscription.Items[k].ItemName); txt = string.Format("[{0,10}] {1,15:0.000} {2}", os.ItemTypes[k].Name, os.ItemValues[k].Value, os.Subscription.Items[k].ItemName); g.DrawString(txt, this.tooltipFont, Brushes.Black, 30, gy); gy += 13; } } for (int j = 0; j < osg.WriteSubscriptions.Count; j++) { OPCSubscription os = osg.WriteSubscriptions[j]; string txt = string.Format("{0} {1} {2} {3} {4} {5} {6}", j, os.Type, os.Name, os.ConnectedDataTableIndex, os.ConnectedDataTableName, os.ConnectedServerName, os.ConnectedSubscriptionName); g.DrawString(txt, this.tooltipFont, Brushes.Black, 15, gy); gy += 13; for (int k = 0; k < os.Subscription.Items.Length; k++) { //txt = string.Format("{0}", os.Subscription.Items[k].ItemName); txt = string.Format("[{0,10}] {1,15:0.000} {2}", os.ItemTypes[k].Name, os.ItemValues[k].Value, os.Subscription.Items[k].ItemName); g.DrawString(txt, this.tooltipFont, Brushes.Black, 30, gy); gy += 13; } } } } catch (Exception ex) { CommonController.Instance.PrintLog(ex.StackTrace); } }