Pārlūkot izejas kodu

Update bridge implementation

Tero Paananen 4 gadus atpakaļ
vecāks
revīzija
f2f6fafd5e

+ 13
- 16
windows/WebViewBridgeComponent/WebBridge.cpp Parādīt failu

@@ -1,22 +1,19 @@
1
-#include "pch.h"
1
+#include "pch.h"
2 2
 #include "WebBridge.h"
3 3
 #include "WebBridge.g.cpp"
4 4
 
5 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 Parādīt failu

@@ -1,23 +1,21 @@
1
-#pragma once
2
-
1
+#pragma once
3 2
 #include "WebBridge.g.h"
4 3
 
4
+
5 5
 namespace winrt::WebViewBridgeComponent::implementation
6 6
 {
7 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 15
     private:
15 16
       winrt::event<Windows::Foundation::EventHandler<winrt::hstring>> m_messageEvent;
16 17
     };
17
-
18
-    
19 18
 }
20
-
21 19
 namespace winrt::WebViewBridgeComponent::factory_implementation
22 20
 {
23 21
     struct WebBridge : WebBridgeT<WebBridge, implementation::WebBridge>

+ 1
- 1
windows/WebViewBridgeComponent/WebBridge.idl Parādīt failu

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

+ 2
- 2
windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj Parādīt failu

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

+ 1
- 0
windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj.filters Parādīt failu

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