newntui/discovermdi/src/dockablebrowser.cpp
//-----------------------------------------------------------------------------------------------
// Callback runs every time the user connect to the different service.
// It will clear old history and will remove all server history variables.
//-----------------------------------------------------------------------------------------------
Callback runs every time the user connect to the different service.
It will clear old history and will remove all server history variables.
Callback runs every time the user connect to the different service . It will clear old history and will remove all server history variables .
void CDockableBrowser::OnServiceChanged() {
CMainFrame* main=(CMainFrame*) AfxGetMainWnd();
    HCURSOR save = ::SetCursor(::LoadCursor(NULL, IDC_WAIT));
    ClearHistory();
    CDiscoverMDIApp* app = (CDiscoverMDIApp *) AfxGetApp();
	CDataSource* DataSource;
	DataSource = (CDataSource *)GetDlgItem(IDC_DATASOURCE);
	DataSource->SetSource(app->m_ServiceName,FALSE);
	LPDISPATCH lpDispatch;
	DataSource->GetControlUnknown()->QueryInterface(IID_IDispatch,(void **)&lpDispatch);
	main->m_Lic[LIC_ACCESS]         = atoi(ExecuteCommand(CString("license r feature")));
	main->m_Lic[LIC_AUTODOC]        = atoi(ExecuteCommand(CString("license d feature")));
	main->m_Lic[LIC_DORMANT]        = atoi(ExecuteCommand(CString("license v feature")));
	main->m_Lic[LIC_QA]             = atoi(ExecuteCommand(CString("license VI1 feature")));
	main->m_Lic[LIC_QABROWSE]       = atoi(ExecuteCommand(CString("license VI4 feature")));
	main->m_Lic[LIC_QAREPORT]       = atoi(ExecuteCommand(CString("license VI7 feature")));
	main->m_Lic[LIC_SIMPLIFY]       = atoi(ExecuteCommand(CString("license n feature")));
	main->m_Lic[LIC_TASKFLOW]       = atoi(ExecuteCommand(CString("license wa feature")));
	main->m_Lic[LIC_TPM]            = atoi(ExecuteCommand(CString("license wb feature")));
	main->m_Lic[LIC_PACKAGE]        = atoi(ExecuteCommand(CString("license l feature")));
	CQueryResults* Results  = (CQueryResults *) GetDlgItem(IDC_RESULTS);
	Results->SetFullListName("DiscoverAll");
	Results->SetFilterListName("DiscoverElements");
	Results->SetSelectionName("DiscoverSelection");
	Results->SetDataSource(lpDispatch);
    ExecuteCommand(CString("set_ui_type 1"));
    CString szRes = ExecuteCommand(CString("source_dis \"source.dis\""));
	bool bLicenseError = szRes.IsEmpty() || !szRes.Compare("No licenses available.");
    ExecuteCommand(CString("dis_DL_init"));
    ExecuteCommand(CString("set DiscoverGroups [nil_set]"));
    ExecuteCommand(CString("set DiscoverElements [nil_set]"));
    ExecuteCommand(CString("set DiscoverAll [nil_set]"));
    ExecuteCommand(CString("set DiscoverScope /"));
	CCategoriesCombo* Category = (CCategoriesCombo *) GetDlgItem(IDC_CATEGORIES);
	Category->SetDataSource(lpDispatch);
	CQueriesCombo*    Query = (CQueriesCombo *) GetDlgItem(IDC_QUERIES);
	Query->SetDataSource(lpDispatch);
	CGroupsCombo*    Group = (CGroupsCombo *) GetDlgItem(IDC_GROUPS);
	Group->SetDataSource(lpDispatch);
	Group->SetSelectionVariable("DiscoverSelection");
	Group->SetOutputVariable("DiscoverAll");
	main->m_SelectionSize=0;
	CProjectTree* Tree       = (CProjectTree *)    GetDlgItem(IDC_TREE);
	Tree->SetDataSource(lpDispatch);
    DisplayInfoString();
    ::SetCursor(save);
	if(bLicenseError) {
		MessageBox("DIScover was unable to verify your \"Developer License\".\nPlease check your license server, license file\nand the value of LM_LICENSE_FILE, or call customer support","License Error",MB_OK|MB_ICONERROR);
		main->PostMessage(WM_SERVICE_DISCONNECT);
	}
}
void CDockableBrowser :: OnServiceChanged ( ) { CMainFrame * main = ( CMainFrame * ) AfxGetMainWnd ( ) ; HCURSOR save = :: SetCursor ( :: LoadCursor ( NULL , IDC_WAIT ) ) ; ClearHistory ( ) ; CDiscoverMDIApp * app = ( CDiscoverMDIApp * ) AfxGetApp ( ) ; CDataSource * DataSource ; DataSource = ( CDataSource * ) GetDlgItem ( IDC_DATASOURCE ) ; DataSource -> SetSource ( app -> m_ServiceName , FALSE ) ; LPDISPATCH lpDispatch ; DataSource -> GetControlUnknown ( ) -> QueryInterface ( IID_IDispatch , ( void * * ) & lpDispatch ) ; main -> m_Lic [ LIC_ACCESS ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; main -> m_Lic [ LIC_AUTODOC ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; main -> m_Lic [ LIC_DORMANT ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; main -> m_Lic [ LIC_QA ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; main -> m_Lic [ LIC_QABROWSE ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; main -> m_Lic [ LIC_QAREPORT ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; main -> m_Lic [ LIC_SIMPLIFY ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; main -> m_Lic [ LIC_TASKFLOW ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; main -> m_Lic [ LIC_TPM ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; main -> m_Lic [ LIC_PACKAGE ] = atoi ( ExecuteCommand ( CString ( " " ) ) ) ; CQueryResults * Results = ( CQueryResults * ) GetDlgItem ( IDC_RESULTS ) ; Results -> SetFullListName ( " " ) ; Results -> SetFilterListName ( " " ) ; Results -> SetSelectionName ( " " ) ; Results -> SetDataSource ( lpDispatch ) ; ExecuteCommand ( CString ( " " ) ) ; CString szRes = ExecuteCommand ( CString ( " \" \" " ) ) ; bool bLicenseError = szRes . IsEmpty ( ) || ! szRes . Compare ( " " ) ; ExecuteCommand ( CString ( " " ) ) ; ExecuteCommand ( CString ( " " ) ) ; ExecuteCommand ( CString ( " " ) ) ; ExecuteCommand ( CString ( " " ) ) ; ExecuteCommand ( CString ( " " ) ) ; CCategoriesCombo * Category = ( CCategoriesCombo * ) GetDlgItem ( IDC_CATEGORIES ) ; Category -> SetDataSource ( lpDispatch ) ; CQueriesCombo * Query = ( CQueriesCombo * ) GetDlgItem ( IDC_QUERIES ) ; Query -> SetDataSource ( lpDispatch ) ; CGroupsCombo * Group = ( CGroupsCombo * ) GetDlgItem ( IDC_GROUPS ) ; Group -> SetDataSource ( lpDispatch ) ; Group -> SetSelectionVariable ( " " ) ; Group -> SetOutputVariable ( " " ) ; main -> m_SelectionSize = 0 ; CProjectTree * Tree = ( CProjectTree * ) GetDlgItem ( IDC_TREE ) ; Tree -> SetDataSource ( lpDispatch ) ; DisplayInfoString ( ) ; :: SetCursor ( save ) ; if ( bLicenseError ) { MessageBox ( " \" \" \n \n " , " " , MB_OK | MB_ICONERROR ) ; main -> PostMessage ( WM_SERVICE_DISCONNECT ) ; } }
Callback runs every time the user connect to the different service.
Callback runs every time the user connect to the different service .