// ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** #pragma once #include #include #include #include #include namespace TestSuite { struct TestCaseDesc { const std::string name; std::string client; std::string server; const std::vector args; }; struct TestSuiteDesc { const std::string id; std::vector testCases; }; template T^ findChild(Windows::UI::Xaml::DependencyObject^ parent, Platform::String^ name) { int count = VisualTreeHelper::GetChildrenCount(parent); for (int i = 0; i < count; ++i) { DependencyObject^ object = VisualTreeHelper::GetChild(parent, i); T^ child = dynamic_cast(object); FrameworkElement^ element = dynamic_cast(object); if(child && element && element->Name == name) { return child; } else if(object) { child = findChild(object, name); if(child) { return child; } } } return nullptr; } class DllCache { public: ~DllCache(); HINSTANCE loadDll(const std::string&); private: std::map _dlls; }; [Windows::Foundation::Metadata::WebHostHidden] public ref class MainPage sealed { public: MainPage(); void completed(); void failed(Platform::String^ reason); void printToConsoleOutput(Platform::String^ message, bool newline); protected: virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override; private: void btnRun_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void btnStop_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void runSelectedTest(); void Output_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void Configuration_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void Tests_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void Language_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e); std::string selectedLanguage(); std::string selectedProtocol(); void initializeSupportedProtocols(); void initializeSupportedTests(); Ice::CommunicatorPtr communicator(); Platform::Collections::Vector^ _names; Platform::Collections::Vector^ _protocols; Platform::Collections::Vector^ _messages; std::vector _allTests; DllCache _dlls; Windows::UI::Xaml::Controls::ListBox^ _testSuites; Windows::UI::Xaml::Controls::ComboBox^ _language; Windows::UI::Xaml::Controls::TextBox^ _host; Windows::UI::Xaml::Controls::ComboBox^ _protocol; Windows::UI::Xaml::Controls::CheckBox^ _loop; Windows::UI::Xaml::Controls::CheckBox^ _serialize; Windows::UI::Xaml::Controls::CheckBox^ _ipv6; Windows::UI::Xaml::Controls::Button^ _run; Windows::UI::Xaml::Controls::Button^ _stop; Windows::UI::Xaml::Controls::ListBox^ _output; Ice::CommunicatorPtr _communicator; }; }