/// <summary> /// Prompts the user to select an item and specify trend properties. /// </summary> public TsCHdaAnnotationValueCollection ShowDialog(TsCHdaServer server, bool synchronous) { if (server == null) { throw new ArgumentNullException("server"); } m_server = server; m_singleItem = true; m_synchronous = synchronous; m_results = null; // create new trend. m_trend = new TsCHdaTrend(m_server); // set reasonable defaults. m_trend.StartTime = new TsCHdaTime("YEAR"); m_trend.EndTime = new TsCHdaTime("YEAR+1H"); BrowseCTRL.Browse(m_server, null); TrendItemsCTRL.Initialize(m_trend, false, null); TrendCTRL.Initialize(m_trend, RequestType.ReadAnnotations); ItemsCTRL.Initialize(null); ResultsCTRL.Initialize(m_server, null); AsyncResultsCTRL.Initialize(m_server, null); // update dialog state. SetState(); // show dialog. bool result = (ShowDialog() == DialogResult.OK); // release item handles. m_trend.ClearItems(); // return item values. return((result)?m_results[0]:null); }
/// <summary> /// Prompts the user to specify values to insert for an item. /// </summary> public bool ShowDialog(TsCHdaServer server, OpcItem item, bool synchronous) { if (server == null) { throw new ArgumentNullException("server"); } m_server = server; m_synchronous = synchronous; m_item = item; m_values = null; m_results = null; // create new trend. m_trend = new TsCHdaTrend(m_server); // set reasonable defaults. m_trend.StartTime = new TsCHdaTime("YEAR"); m_trend.EndTime = new TsCHdaTime("YEAR+1H"); BrowseCTRL.Browse(m_server, null); ValuesCTRL.Initialize(m_server, null); ResultsCTRL.Initialize(m_server, m_values, m_results); AsyncResultsCTRL.Initialize(m_server, null); // update dialog state. SetState(); // show dialog. bool result = (ShowDialog() == DialogResult.OK); // release item handles. m_trend.ClearItems(); // return dialog result. return(result); }