/// <summary> /// Prompts the user to select items and specify trend properties. /// </summary> public TsCHdaTrend ShowDialog(TsCHdaServer server) { if (server == null) { throw new ArgumentNullException("server"); } mServer_ = server; mResults_ = null; // create new trend. TsCHdaTrend trend = new TsCHdaTrend(mServer_); // set reasonable defaults. trend.StartTime = new TsCHdaTime("YEAR"); trend.EndTime = new TsCHdaTime("YEAR+1H"); browseCtrl_.Browse(mServer_, null); trendCtrl_.Initialize(trend, RequestType.None); itemsCtrl_.Initialize(mServer_, (OpcItem[])null); resultsCtrl_.Initialize(mServer_, mResults_); // update dialog state. SetState(false); // show dialog. if (ShowDialog() != DialogResult.OK) { return(null); } // create or update the trend. trendCtrl_.Update(trend); // add new items. if (mResults_ != null) { foreach (OpcItemResult item in mResults_) { if (item.Result.Succeeded()) { trend.Items.Add(new TsCHdaItem(item)); } } } // return new trend. return(trend); }
/// <summary> /// Prompts the user to edit the properties of a trend. /// </summary> public bool ShowDialog(TsCHdaTrend trend) { if (trend == null) { throw new ArgumentNullException("trend"); } // initialize the controls. trendCtrl_.Initialize(trend, RequestType.None); // show the dialog. if (ShowDialog() != DialogResult.OK) { return(false); } // update the trend. trendCtrl_.Update(trend); return(true); }
/// <summary> /// Prompts the user to edit the properties of a trend. /// </summary> public bool ShowDialog(TsCHdaTrend trend, RequestType type) { if (trend == null) { throw new ArgumentNullException("trend"); } // initialize the controls. trendCtrl_.Initialize(trend, type); // adjust dialog height. Height -= (buttonsPn_.Top - mainPn_.Height); // show the dialog. if (ShowDialog() != DialogResult.OK) { return(false); } // update the trend. trendCtrl_.Update(trend); return(true); }