Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed C# and C++ SampleApp projects identifiers #3802

Merged
merged 1 commit into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions packages/microsoft-reactnative-sampleapps/index.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import { NativeModules, NativeEventEmitter } from 'react-native';

// Creating event emitters
const SampleModuleCSEmitter = new NativeEventEmitter(NativeModules.SampleModuleCS);
const SampleModuleCPPEmitter = new NativeEventEmitter(NativeModules.SampleModuleCPP);
const SampleModuleCppEmitter = new NativeEventEmitter(NativeModules.SampleModuleCpp);

const CustomUserControlCS = requireNativeComponent('CustomUserControlCS');
const CustomUserControlCPP = requireNativeComponent('CustomUserControlCPP');
const CustomUserControlCpp = requireNativeComponent('CustomUserControlCpp');

const CircleCS = requireNativeComponent('CircleCS');
const CircleCPP = requireNativeComponent('CircleCPP');
const CircleCpp = requireNativeComponent('CircleCpp');

var log = function(result) {
console.log(result);
Expand All @@ -47,12 +47,12 @@ var getErrorCallback = function(prefix) {
class SampleApp extends Component {
componentDidMount() {
this._TimedEventCSSub = SampleModuleCSEmitter.addListener('TimedEventCS', getCallback('SampleModuleCS.TimedEventCS() => '));
this._TimedEventCPPSub = SampleModuleCPPEmitter.addListener('TimedEventCPP', getCallback('SampleModuleCPP.TimedEventCPP() => '));
this._TimedEventCppSub = SampleModuleCppEmitter.addListener('TimedEventCpp', getCallback('SampleModuleCpp.TimedEventCpp() => '));
}

componentWillUnmount() {
this._TimedEventCSSub.remove();
this._TimedEventCPPSub.remove();
this._TimedEventCppSub.remove();
}

onPressSampleModuleCS() {
Expand Down Expand Up @@ -93,42 +93,42 @@ class SampleApp extends Component {
log('SampleModuleCS.SyncReturnMethodWithArgs => ' + NativeModules.SampleModuleCS.SyncReturnMethodWithArgs(numberArg));
}

onPressSampleModuleCPP() {
log('SampleApp.onPressSampleModuleCPP()');
onPressSampleModuleCpp() {
log('SampleApp.onPressSampleModuleCpp()');

var numberArg = 42;

// SampleModuleCPP constants
// SampleModuleCpp constants

log(`SampleModuleCPP.NumberConstant: ${NativeModules.SampleModuleCPP.NumberConstant}`);
log(`SampleModuleCPP.StringConstant: ${NativeModules.SampleModuleCPP.StringConstant}`);
log(`SampleModuleCpp.NumberConstant: ${NativeModules.SampleModuleCpp.NumberConstant}`);
log(`SampleModuleCpp.StringConstant: ${NativeModules.SampleModuleCpp.StringConstant}`);

log(`SampleModuleCPP.NumberConstantViaProvider: ${NativeModules.SampleModuleCPP.NumberConstantViaProvider}`);
log(`SampleModuleCPP.StringConstantViaProvider: ${NativeModules.SampleModuleCPP.StringConstantViaProvider}`);
log(`SampleModuleCpp.NumberConstantViaProvider: ${NativeModules.SampleModuleCpp.NumberConstantViaProvider}`);
log(`SampleModuleCpp.StringConstantViaProvider: ${NativeModules.SampleModuleCpp.StringConstantViaProvider}`);

// SampleModuleCPP method calls
// SampleModuleCpp method calls

NativeModules.SampleModuleCPP.VoidMethod();
NativeModules.SampleModuleCpp.VoidMethod();

NativeModules.SampleModuleCPP.VoidMethodWithArgs(numberArg);
NativeModules.SampleModuleCpp.VoidMethodWithArgs(numberArg);

NativeModules.SampleModuleCPP.ReturnMethod(getCallback('SampleModuleCPP.ReturnMethod => '));
NativeModules.SampleModuleCpp.ReturnMethod(getCallback('SampleModuleCpp.ReturnMethod => '));

NativeModules.SampleModuleCPP.ReturnMethodWithArgs(numberArg, getCallback('SampleModuleCPP.ReturnMethodWithArgs => '));
NativeModules.SampleModuleCpp.ReturnMethodWithArgs(numberArg, getCallback('SampleModuleCpp.ReturnMethodWithArgs => '));

NativeModules.SampleModuleCPP.ExplicitCallbackMethod(getCallback('SampleModuleCPP.ExplicitCallbackMethod => '));
NativeModules.SampleModuleCpp.ExplicitCallbackMethod(getCallback('SampleModuleCpp.ExplicitCallbackMethod => '));

NativeModules.SampleModuleCPP.ExplicitCallbackMethodWithArgs(numberArg, getCallback('SampleModuleCPP.ExplicitCallbackMethodWithArgs => '));
NativeModules.SampleModuleCpp.ExplicitCallbackMethodWithArgs(numberArg, getCallback('SampleModuleCpp.ExplicitCallbackMethodWithArgs => '));

var promise1 = NativeModules.SampleModuleCPP.ExplicitPromiseMethod();
promise1.then(getCallback('SampleModuleCPP.ExplicitPromiseMethod then => ')).catch(getErrorCallback('SampleModuleCPP.ExplicitPromiseMethod catch => '));
var promise1 = NativeModules.SampleModuleCpp.ExplicitPromiseMethod();
promise1.then(getCallback('SampleModuleCpp.ExplicitPromiseMethod then => ')).catch(getErrorCallback('SampleModuleCpp.ExplicitPromiseMethod catch => '));

var promise2 = NativeModules.SampleModuleCPP.ExplicitPromiseMethodWithArgs(numberArg);
promise2.then(getCallback('SampleModuleCPP.ExplicitPromiseMethodWithArgs then => ')).catch(getErrorCallback('SampleModuleCPP.ExplicitPromiseMethodWithArgs catch => '));
var promise2 = NativeModules.SampleModuleCpp.ExplicitPromiseMethodWithArgs(numberArg);
promise2.then(getCallback('SampleModuleCpp.ExplicitPromiseMethodWithArgs then => ')).catch(getErrorCallback('SampleModuleCpp.ExplicitPromiseMethodWithArgs catch => '));

log('SampleModuleCPP.SyncReturnMethod => ' + NativeModules.SampleModuleCPP.SyncReturnMethod());
log('SampleModuleCpp.SyncReturnMethod => ' + NativeModules.SampleModuleCpp.SyncReturnMethod());

log('SampleModuleCPP.SyncReturnMethodWithArgs => ' + NativeModules.SampleModuleCPP.SyncReturnMethodWithArgs(numberArg));
log('SampleModuleCpp.SyncReturnMethodWithArgs => ' + NativeModules.SampleModuleCpp.SyncReturnMethodWithArgs(numberArg));
}

onPressCustomUserControlCS() {
Expand All @@ -144,16 +144,16 @@ class SampleApp extends Component {
}
}

onPressCustomUserControlCPP() {
log('SampleApp.onPressCustomUserControlCPP()');
onPressCustomUserControlCpp() {
log('SampleApp.onPressCustomUserControlCpp()');

var strArg = 'Hello World!';

if (this._CustomUserControlCPPRef)
if (this._CustomUserControlCppRef)
{
const tag = findNodeHandle(this._CustomUserControlCPPRef);
log(`UIManager.dispatchViewManagerCommand(${tag}, CustomUserControlCPP.CustomCommand, "${strArg}")`);
UIManager.dispatchViewManagerCommand(tag, UIManager.getViewManagerConfig('CustomUserControlCPP').Commands.CustomCommand, strArg);
const tag = findNodeHandle(this._CustomUserControlCppRef);
log(`UIManager.dispatchViewManagerCommand(${tag}, CustomUserControlCpp.CustomCommand, "${strArg}")`);
UIManager.dispatchViewManagerCommand(tag, UIManager.getViewManagerConfig('CustomUserControlCpp').Commands.CustomCommand, strArg);
}
}

Expand All @@ -162,9 +162,9 @@ class SampleApp extends Component {
log(`SampleApp.onLabelChangedCustomUserControlCS("${label}")`);
}

onLabelChangedCustomUserControlCPP(evt) {
onLabelChangedCustomUserControlCpp(evt) {
var label = evt.nativeEvent;
log(`SampleApp.onLabelChangedCustomUserControlCPP("${label}")`);
log(`SampleApp.onLabelChangedCustomUserControlCpp("${label}")`);
}

render() {
Expand All @@ -178,25 +178,25 @@ class SampleApp extends Component {
</Text>

<Button onPress={() => { this.onPressSampleModuleCS(); }} title="Call SampleModuleCS!" disabled={NativeModules.SampleModuleCS == null} />
<Button onPress={() => { this.onPressSampleModuleCPP(); }} title="Call SampleModuleCPP!" disabled={NativeModules.SampleModuleCPP == null} />
<Button onPress={() => { this.onPressSampleModuleCpp(); }} title="Call SampleModuleCpp!" disabled={NativeModules.SampleModuleCpp == null} />

<CustomUserControlCS style={styles.customcontrol} label="CustomUserControlCS!" ref={(ref) => { this._CustomUserControlCSRef = ref; }} onLabelChanged={(evt) => { this.onLabelChangedCustomUserControlCS(evt); }} />
<Button onPress={() => { this.onPressCustomUserControlCS(); }} title="Call CustomUserControlCS Commands!" />

<CustomUserControlCPP style={styles.customcontrol} label="CustomUserControlCPP!" ref={(ref) => { this._CustomUserControlCPPRef = ref; }} onLabelChanged={(evt) => { this.onLabelChangedCustomUserControlCPP(evt); }} />
<Button onPress={() => { this.onPressCustomUserControlCPP(); }} title="Call CustomUserControlCPP Commands!" />
<CustomUserControlCpp style={styles.customcontrol} label="CustomUserControlCpp!" ref={(ref) => { this._CustomUserControlCppRef = ref; }} onLabelChanged={(evt) => { this.onLabelChangedCustomUserControlCpp(evt); }} />
<Button onPress={() => { this.onPressCustomUserControlCpp(); }} title="Call CustomUserControlCpp Commands!" />

<CircleCS style={styles.circle}>
<View style={styles.box}>
<Text style={styles.boxText}>CircleCS!</Text>
</View>
</CircleCS>

<CircleCPP style={styles.circle}>
<CircleCpp style={styles.circle}>
<View style={styles.box}>
<Text style={styles.boxText}>CircleCPP!</Text>
<Text style={styles.boxText}>CircleCpp!</Text>
</View>
</CircleCPP>
</CircleCpp>
<Text style={styles.instructions}>
Hello from Microsoft!
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

#include "App.h"
#include "ReactPackageProvider.h"
#include "winrt/SampleLibraryCPP.h"
#include "winrt/SampleLibraryCS.h"
#include "winrt/SampleLibraryCpp.h"

namespace winrt::SampleApp::implementation {
namespace winrt::SampleAppCpp::implementation {

/// <summary>
/// Initializes the singleton application object. This is the first line of
Expand Down Expand Up @@ -36,7 +36,7 @@ App::App() noexcept {
#endif

PackageProviders().Append(make<ReactPackageProvider>()); // Includes all modules in this project
PackageProviders().Append(winrt::SampleLibraryCPP::ReactPackageProvider());
PackageProviders().Append(winrt::SampleLibraryCpp::ReactPackageProvider());
PackageProviders().Append(winrt::SampleLibraryCS::ReactPackageProvider());

InitializeComponent();
Expand All @@ -47,4 +47,4 @@ App::App() noexcept {
m_inner.as<::IUnknown>()->Release();
}

} // namespace winrt::SampleApp::implementation
} // namespace winrt::SampleAppCpp::implementation
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

#include "App.xaml.g.h"

namespace winrt::SampleApp::implementation {
namespace winrt::SampleAppCpp::implementation {

struct App : AppT<App> {
App() noexcept;
};

} // namespace winrt::SampleApp::implementation
} // namespace winrt::SampleAppCpp::implementation
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace SampleApp
{
namespace SampleAppCpp {
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. -->
<react:ReactApplication
x:Class="SampleApp.App"
x:Class="SampleAppCpp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SampleApp"
xmlns:local="using:SampleAppCpp"
Copy link

@NikoAri NikoAri Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SampleAppCpp [](start = 23, length = 12)

(nit) shouldn't this be called CppWinRt or something like that? It requires WinRt stack, right? #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need WinRT stack, but the CppWinRt is quite different and we just want to say that this is a C++ code vs C# code.


In reply to: 359625669 [](ancestors = 359625669)

xmlns:react="using:Microsoft.ReactNative">

</react:ReactApplication>
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

#pragma once

#include <functional>
#include "NativeModules.h"

namespace SampleApp {
namespace SampleAppCpp {

REACT_MODULE(DebugConsole);
struct DebugConsole {
Expand All @@ -17,4 +16,4 @@ struct DebugConsole {
}
};

} // namespace SampleApp
} // namespace SampleAppCpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="f7f3bd52-47fc-4b10-820c-d21716a92eff" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>SampleAppCPP</DisplayName>
<DisplayName>SampleAppCpp</DisplayName>
<PublisherDisplayName>Microsoft</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
Expand All @@ -17,8 +17,8 @@
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="SampleApp.App">
<uap:VisualElements DisplayName="SampleAppCPP" Description="Project for a basic C++ React Native app based on the C++ implementation."
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="SampleAppCpp.App">
<uap:VisualElements DisplayName="SampleAppCpp" Description="Project for a basic C++ React Native app based on the C++ implementation."
Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

using namespace winrt::Microsoft::ReactNative::Bridge;

namespace winrt::SampleApp::implementation {
namespace winrt::SampleAppCpp::implementation {

//===========================================================================
// ReactPackageProvider implementation
Expand All @@ -18,4 +18,4 @@ void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuil
AddAttributedModules(packageBuilder);
}

} // namespace winrt::SampleApp::implementation
} // namespace winrt::SampleAppCpp::implementation
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

using namespace winrt::Microsoft::ReactNative::Bridge;

namespace winrt::SampleApp::implementation {
namespace winrt::SampleAppCpp::implementation {

struct ReactPackageProvider : winrt::implements<ReactPackageProvider, IReactPackageProvider> {
public: // IReactPackageProvider
void CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept;
};

} // namespace winrt::SampleApp::implementation
} // namespace winrt::SampleAppCpp::implementation
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <winrt/Microsoft.ReactNative.Bridge.h>
#include <winrt/Microsoft.ReactNative.h>

#include <winrt/SampleLibraryCPP.h>
#include <winrt/SampleLibraryCpp.h>

#include <winrt/SampleLibraryCS.SampleLibraryCS_XamlTypeInfo.h>
#include <winrt/SampleLibraryCS.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. -->
<react:ReactApplication
x:Class="SampleApp.App"
x:Class="SampleAppCS.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SampleApp"
xmlns:local="using:SampleAppCS"
xmlns:react="using:Microsoft.ReactNative">

</react:ReactApplication>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Microsoft.ReactNative;

namespace SampleApp
namespace SampleAppCS
{
/// <summary>
/// Provides application-specific behavior to supplement the default
Expand Down Expand Up @@ -38,7 +38,7 @@ public App()

PackageProviders.Add(new Microsoft.ReactNative.Managed.ReactPackageProvider()); // Includes any modules in this project
PackageProviders.Add(new SampleLibraryCS.ReactPackageProvider());
PackageProviders.Add(new SampleLibraryCPP.ReactPackageProvider());
PackageProviders.Add(new SampleLibraryCpp.ReactPackageProvider());

InitializeComponent();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.ReactNative.Managed;
using System.Diagnostics;

namespace SampleApp
namespace SampleAppCS
{
[ReactModule]
class DebugConsole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="SampleApp.App">
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="SampleAppCS.App">
<uap:VisualElements DisplayName="SampleAppCS" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Project for a basic C# React Native app based on the C++ implementation." BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SampleApp")]
[assembly: AssemblyTitle("SampleAppCS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SampleApp")]
[assembly: AssemblyProduct("SampleAppCS")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{09F4E6C1-2D12-4059-AA96-0B190861FD6A}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SampleApp</RootNamespace>
<AssemblyName>SampleApp</AssemblyName>
<RootNamespace>SampleAppCS</RootNamespace>
<AssemblyName>SampleAppCS</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
Expand Down Expand Up @@ -157,9 +157,9 @@
<Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project>
<Name>Microsoft.ReactNative</Name>
</ProjectReference>
<ProjectReference Include="..\SampleLibraryCPP\SampleLibraryCPP.vcxproj">
<ProjectReference Include="..\SampleLibraryCpp\SampleLibraryCpp.vcxproj">
<Project>{47eec7f3-40d3-49ba-82c1-eaf103b54215}</Project>
<Name>SampleLibraryCPP</Name>
<Name>SampleLibraryCpp</Name>
</ProjectReference>
<ProjectReference Include="..\SampleLibraryCS\SampleLibraryCS.csproj">
<Project>{c0a6bd9c-3ee5-4b12-8ce4-cee95178539c}</Project>
Expand Down
Loading