本文整理汇总了C++中ObjectFactory::createMockChannel方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectFactory::createMockChannel方法的具体用法?C++ ObjectFactory::createMockChannel怎么用?C++ ObjectFactory::createMockChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectFactory
的用法示例。
在下文中一共展示了ObjectFactory::createMockChannel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CancelEventHandler
WPFCppCliDemo::WPFCppCliDemo()
{
// set up channel
ObjectFactory* pObjFact = new ObjectFactory;
pSendr_ = pObjFact->createSendr();
pRecvr_ = pObjFact->createRecvr();
pChann_ = pObjFact->createMockChannel(pSendr_, pRecvr_);
pChann_->start();
delete pObjFact;
// client's receive thread
recvThread = gcnew Thread(gcnew ThreadStart(this, &WPFCppCliDemo::getMessage));
recvThread->Start();
// set event handlers
this->Loaded +=
gcnew System::Windows::RoutedEventHandler(this, &WPFCppCliDemo::OnLoaded);
this->Closing +=
gcnew CancelEventHandler(this, &WPFCppCliDemo::Unloading);
hSendButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::sendMessage);
hClearButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::clear);
hFolderBrowseButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::browseForFolder);
hConnectButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::connect);
hUploadBrowseButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::uploadBrowseFolder);
hUploadFileButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::uploadFile);
hDownloadBrowseButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::downloadBrowseFolder);
hDownloadFileButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::downloadFile);
hTextSearchButton->Click += gcnew RoutedEventHandler(this, &WPFCppCliDemo::textSearch);
// set Window properties
this->Title = "WPF C++/CLI Demo";
this->Width = 800;
this->Height = 600;
// attach dock panel to Window
this->Content = hDockPanel;
hDockPanel->Children->Add(hStatusBar);
hDockPanel->SetDock(hStatusBar, Dock::Bottom);
hDockPanel->Children->Add(hGrid);
// setup Window controls and views
setUpTabControl();
setUpStatusBar();
setUpSendMessageView();
setUpConnectionView();
setUpFileUploadView();
setUpFileDownloadView();
setUpTextSearchView();
setUpFileSearchView();
}
示例2: main
int main()
{
ObjectFactory objFact;
ISendr* pSendr = objFact.createSendr();
IRecvr* pRecvr = objFact.createRecvr();
IMockChannel* pMockChannel = objFact.createMockChannel(pSendr, pRecvr);
pMockChannel->start();
pSendr->postMessage("Hello World");
pSendr->postMessage("CSE687 - Object Oriented Design");
Message msg = pRecvr->getMessage();
std::cout << "\n received message = \"" << msg << "\"";
msg = pRecvr->getMessage();
std::cout << "\n received message = \"" << msg << "\"";
pSendr->postMessage("stopping");
msg = pRecvr->getMessage();
std::cout << "\n received message = \"" << msg << "\"";
pMockChannel->stop();
pSendr->postMessage("quit");
std::cin.get();
}