Tero Paananen 4 лет назад
Родитель
Сommit
f2f6fafd5e

+ 13
- 16
windows/WebViewBridgeComponent/WebBridge.cpp Просмотреть файл

1
-#include "pch.h"
1
+#include "pch.h"
2
 #include "WebBridge.h"
2
 #include "WebBridge.h"
3
 #include "WebBridge.g.cpp"
3
 #include "WebBridge.g.cpp"
4
 
4
 
5
 namespace winrt::WebViewBridgeComponent::implementation
5
 namespace winrt::WebViewBridgeComponent::implementation
6
 {
6
 {
7
-  winrt::event_token WebBridge::MessagePostEvent(Windows::Foundation::EventHandler<winrt::hstring> const& handler)
8
-  {
9
-    return m_messageEvent.add(handler);
10
-  }
11
-
12
-  void WebBridge::MessagePostEvent(winrt::event_token const& token) noexcept
13
-  {
14
-    m_messageEvent.remove(token);
15
-  }
16
-
17
-  void WebBridge::PostMessage(winrt::hstring message)
18
-  {
19
-    m_messageEvent(*this, message);
20
-  }
21
-
7
+    void WebBridge::PostMessage(hstring const& message)
8
+    {
9
+        m_messageEvent(*this, message);
10
+    }
11
+    winrt::event_token WebBridge::MessagePostEvent(Windows::Foundation::EventHandler<hstring> const& handler)
12
+    {
13
+        return m_messageEvent.add(handler);
14
+    }
15
+    void WebBridge::MessagePostEvent(winrt::event_token const& token) noexcept
16
+    {
17
+        m_messageEvent.remove(token);
18
+    }
22
 }
19
 }

+ 8
- 10
windows/WebViewBridgeComponent/WebBridge.h Просмотреть файл

1
-#pragma once
2
-
1
+#pragma once
3
 #include "WebBridge.g.h"
2
 #include "WebBridge.g.h"
4
 
3
 
4
+
5
 namespace winrt::WebViewBridgeComponent::implementation
5
 namespace winrt::WebViewBridgeComponent::implementation
6
 {
6
 {
7
     struct WebBridge : WebBridgeT<WebBridge>
7
     struct WebBridge : WebBridgeT<WebBridge>
8
     {
8
     {
9
-    public:  
10
-      WebBridge() = default;
11
-      void PostMessage(winrt::hstring message);
12
-      winrt::event_token MessagePostEvent(Windows::Foundation::EventHandler<winrt::hstring> const& handler);
13
-      void MessagePostEvent(winrt::event_token const& token) noexcept;
9
+        WebBridge() = default;
10
+
11
+        void PostMessage(hstring const& message);
12
+        winrt::event_token MessagePostEvent(Windows::Foundation::EventHandler<hstring> const& handler);
13
+        void MessagePostEvent(winrt::event_token const& token) noexcept;
14
+
14
     private:
15
     private:
15
       winrt::event<Windows::Foundation::EventHandler<winrt::hstring>> m_messageEvent;
16
       winrt::event<Windows::Foundation::EventHandler<winrt::hstring>> m_messageEvent;
16
     };
17
     };
17
-
18
-    
19
 }
18
 }
20
-
21
 namespace winrt::WebViewBridgeComponent::factory_implementation
19
 namespace winrt::WebViewBridgeComponent::factory_implementation
22
 {
20
 {
23
     struct WebBridge : WebBridgeT<WebBridge, implementation::WebBridge>
21
     struct WebBridge : WebBridgeT<WebBridge, implementation::WebBridge>

+ 1
- 1
windows/WebViewBridgeComponent/WebBridge.idl Просмотреть файл

8
         void PostMessage(String message);
8
         void PostMessage(String message);
9
         event Windows.Foundation.EventHandler<String> MessagePostEvent;
9
         event Windows.Foundation.EventHandler<String> MessagePostEvent;
10
     }
10
     }
11
-}
11
+}

+ 2
- 2
windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj Просмотреть файл

6
     <CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
6
     <CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
7
     <CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
7
     <CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
8
     <MinimalCoreWin>true</MinimalCoreWin>
8
     <MinimalCoreWin>true</MinimalCoreWin>
9
-    <ProjectGuid>{fcb612ad-facc-410c-828c-24b5940b2762}</ProjectGuid>
9
+    <ProjectGuid>{176323cd-97ce-4b0f-9d11-a2b77bda829b}</ProjectGuid>
10
     <ProjectName>WebViewBridgeComponent</ProjectName>
10
     <ProjectName>WebViewBridgeComponent</ProjectName>
11
     <RootNamespace>WebViewBridgeComponent</RootNamespace>
11
     <RootNamespace>WebViewBridgeComponent</RootNamespace>
12
     <DefaultLanguage>en-US</DefaultLanguage>
12
     <DefaultLanguage>en-US</DefaultLanguage>
15
     <ApplicationType>Windows Store</ApplicationType>
15
     <ApplicationType>Windows Store</ApplicationType>
16
     <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
16
     <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
17
     <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
17
     <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
18
-    <WindowsTargetPlatformMinVersion>10.0.15063.0</WindowsTargetPlatformMinVersion>
18
+    <WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
19
   </PropertyGroup>
19
   </PropertyGroup>
20
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
20
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
21
   <ItemGroup Label="ProjectConfigurations">
21
   <ItemGroup Label="ProjectConfigurations">

+ 1
- 0
windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj.filters Просмотреть файл

11
   </ItemGroup>
11
   </ItemGroup>
12
   <ItemGroup>
12
   <ItemGroup>
13
     <ClCompile Include="pch.cpp" />
13
     <ClCompile Include="pch.cpp" />
14
+    <ClCompile Include="WebBridge.cpp" />
14
     <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
15
     <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
15
   </ItemGroup>
16
   </ItemGroup>
16
   <ItemGroup>
17
   <ItemGroup>