/// <summary> /// Prompts a user to create a new subscription with a modal dialog. /// </summary> public TsCAeSubscription ShowDialog(TsCAeServer server, TsCAeSubscription subscription) { if (server == null) { throw new ArgumentNullException("server"); } mServer_ = server; mSubscription_ = subscription; // go to the initial stage. mStage_ = 0; ChangeStage(0); // initialize controls. stateCtrl_.SetDefaults(); filtersCtrl_.SetDefaults(); categoriesCtrl_.ShowCategories(mServer_); attributesCtrl_.ShowAttributes(mServer_); browseCtrl_.ShowAreas(mServer_); if (mSubscription_ != null) { mState_ = mSubscription_.GetState(); mFilters_ = mSubscription_.GetFilters(); mAttributes_ = mSubscription_.GetAttributes(); mAreas_ = mSubscription_.Areas.ToArray(); mSources_ = mSubscription_.Sources.ToArray(); } else { mState_.Name = String.Format("Subscription{0,3:000}", ++mCount_); } // set current values. stateCtrl_.Set(mState_); filtersCtrl_.Set(mFilters_); categoriesCtrl_.SetSelectedCategories(mFilters_.Categories.ToArray()); attributesCtrl_.SetSelectedAttributes(mAttributes_); areaSourcesListCtrl_.AddAreas(mAreas_); areaSourcesListCtrl_.AddSources(mSources_); // show dialog. if (ShowDialog() != DialogResult.OK) { return(null); } // return updated/created subscription. return(mSubscription_); }
/// <summary> /// Displays the event conditions supported by the server. /// </summary> public void ShowDialog(TsCAeServer server, bool modal) { if (server == null) { throw new ArgumentNullException("server"); } browseCtrl_.ShowAreas(server); if (modal) { ShowDialog(); } else { Show(); } }