From ec3a702401d327987a22e33aa1d3f0430350ab7d Mon Sep 17 00:00:00 2001 From: Jaiganesh Date: Sun, 11 Apr 2021 17:58:49 +0530 Subject: [PATCH 1/6] Improved project and item templates --- vsix/ItemTemplates/BlankPage/BlankPage.cpp | 15 -------------- vsix/ItemTemplates/BlankPage/BlankPage.h | 6 ------ vsix/ItemTemplates/BlankPage/BlankPage.idl | 1 - vsix/ItemTemplates/BlankPage/BlankPage.xaml | 6 +++--- .../BlankUserControl/BlankUserControl.cpp | 15 -------------- .../BlankUserControl/BlankUserControl.h | 6 ------ .../BlankUserControl/BlankUserControl.idl | 1 - .../BlankUserControl/BlankUserControl.xaml | 20 +++++++++---------- vsix/ItemTemplates/ViewModel/ViewModel.cpp | 19 ++++++++++-------- vsix/ItemTemplates/ViewModel/ViewModel.h | 9 +++++---- vsix/ItemTemplates/ViewModel/ViewModel.idl | 3 +-- .../Windows Desktop/WindowsApplication/pch.h | 1 - .../VC/Windows Universal/BlankApp/App.cpp | 1 - .../VC/Windows Universal/BlankApp/App.h | 1 - .../Windows Universal/BlankApp/MainPage.cpp | 15 -------------- .../VC/Windows Universal/BlankApp/MainPage.h | 6 ------ .../Windows Universal/BlankApp/MainPage.idl | 1 - .../Windows Universal/BlankApp/MainPage.xaml | 20 +++++++++---------- .../VC/Windows Universal/CoreApp/App.cpp | 1 - .../Windows Universal/StaticLibrary/Class.cpp | 9 --------- .../Windows Universal/StaticLibrary/Class.h | 4 ---- .../Windows Universal/StaticLibrary/Class.idl | 1 - .../WindowsRuntimeComponent/Class.cpp | 9 --------- .../WindowsRuntimeComponent/Class.h | 4 ---- .../WindowsRuntimeComponent/Class.idl | 1 - 25 files changed, 40 insertions(+), 135 deletions(-) diff --git a/vsix/ItemTemplates/BlankPage/BlankPage.cpp b/vsix/ItemTemplates/BlankPage/BlankPage.cpp index 9af284cec..7f8ecb177 100644 --- a/vsix/ItemTemplates/BlankPage/BlankPage.cpp +++ b/vsix/ItemTemplates/BlankPage/BlankPage.cpp @@ -13,19 +13,4 @@ namespace winrt::$rootnamespace$::implementation { InitializeComponent(); } - - int32_t $safeitemname$::MyProperty() - { - throw hresult_not_implemented(); - } - - void $safeitemname$::MyProperty(int32_t /* value */) - { - throw hresult_not_implemented(); - } - - void $safeitemname$::ClickHandler(IInspectable const&, RoutedEventArgs const&) - { - Button().Content(box_value(L"Clicked")); - } } diff --git a/vsix/ItemTemplates/BlankPage/BlankPage.h b/vsix/ItemTemplates/BlankPage/BlankPage.h index f1dc903e8..542539eab 100644 --- a/vsix/ItemTemplates/BlankPage/BlankPage.h +++ b/vsix/ItemTemplates/BlankPage/BlankPage.h @@ -1,5 +1,4 @@ #pragma once - #include "$safeitemname$.g.h" namespace winrt::$rootnamespace$::implementation @@ -7,11 +6,6 @@ namespace winrt::$rootnamespace$::implementation struct $safeitemname$ : $safeitemname$T<$safeitemname$> { $safeitemname$(); - - int32_t MyProperty(); - void MyProperty(int32_t value); - - void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); }; } diff --git a/vsix/ItemTemplates/BlankPage/BlankPage.idl b/vsix/ItemTemplates/BlankPage/BlankPage.idl index 7930cbf8c..e85bbf418 100644 --- a/vsix/ItemTemplates/BlankPage/BlankPage.idl +++ b/vsix/ItemTemplates/BlankPage/BlankPage.idl @@ -4,6 +4,5 @@ namespace $rootnamespace$ runtimeclass $safeitemname$ : Windows.UI.Xaml.Controls.Page { $safeitemname$(); - Int32 MyProperty; } } diff --git a/vsix/ItemTemplates/BlankPage/BlankPage.xaml b/vsix/ItemTemplates/BlankPage/BlankPage.xaml index c84ae2cb7..af2e38fdd 100644 --- a/vsix/ItemTemplates/BlankPage/BlankPage.xaml +++ b/vsix/ItemTemplates/BlankPage/BlankPage.xaml @@ -7,7 +7,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - - + + + diff --git a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.cpp b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.cpp index 9af284cec..7f8ecb177 100644 --- a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.cpp +++ b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.cpp @@ -13,19 +13,4 @@ namespace winrt::$rootnamespace$::implementation { InitializeComponent(); } - - int32_t $safeitemname$::MyProperty() - { - throw hresult_not_implemented(); - } - - void $safeitemname$::MyProperty(int32_t /* value */) - { - throw hresult_not_implemented(); - } - - void $safeitemname$::ClickHandler(IInspectable const&, RoutedEventArgs const&) - { - Button().Content(box_value(L"Clicked")); - } } diff --git a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.h b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.h index 7b994b1df..7b0b5b8d7 100644 --- a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.h +++ b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.h @@ -1,5 +1,4 @@ #pragma once - #include "winrt/Windows.UI.Xaml.h" #include "winrt/Windows.UI.Xaml.Markup.h" #include "winrt/Windows.UI.Xaml.Interop.h" @@ -11,11 +10,6 @@ namespace winrt::$rootnamespace$::implementation struct $safeitemname$ : $safeitemname$T<$safeitemname$> { $safeitemname$(); - - int32_t MyProperty(); - void MyProperty(int32_t value); - - void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); }; } diff --git a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.idl b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.idl index 8aed6d3f0..7c9ce4f16 100644 --- a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.idl +++ b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.idl @@ -4,6 +4,5 @@ namespace $rootnamespace$ runtimeclass $safeitemname$ : Windows.UI.Xaml.Controls.UserControl { $safeitemname$(); - Int32 MyProperty; } } diff --git a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml index ef60e5cd5..46f9d3adf 100644 --- a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml +++ b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml @@ -1,13 +1,13 @@  + x:Class="$rootnamespace$.$safeitemname$" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="using:$rootnamespace$" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> - - - + + + diff --git a/vsix/ItemTemplates/ViewModel/ViewModel.cpp b/vsix/ItemTemplates/ViewModel/ViewModel.cpp index af07f03db..f35bd78c1 100644 --- a/vsix/ItemTemplates/ViewModel/ViewModel.cpp +++ b/vsix/ItemTemplates/ViewModel/ViewModel.cpp @@ -4,15 +4,18 @@ #include "$safeitemname$.g.cpp" #endif +using namespace winrt; +using namespace Windows::UI::Xaml::Data; + namespace winrt::$rootnamespace$::implementation { - int32_t $safeitemname$::MyProperty() - { - throw hresult_not_implemented(); - } + event_token $safeitemname$::PropertyChanged(PropertyChangedEventHandler const& handler) + { + return m_PropertyChanged.add(handler); + } - void $safeitemname$::MyProperty(int32_t /*value*/) - { - throw hresult_not_implemented(); - } + void $safeitemname$::PropertyChanged(event_token token) noexcept + { + m_PropertyChanged.remove(token); + } } diff --git a/vsix/ItemTemplates/ViewModel/ViewModel.h b/vsix/ItemTemplates/ViewModel/ViewModel.h index a5b640773..57abc7529 100644 --- a/vsix/ItemTemplates/ViewModel/ViewModel.h +++ b/vsix/ItemTemplates/ViewModel/ViewModel.h @@ -1,5 +1,5 @@ #pragma once - +#include "winrt/Windows.UI.Xaml.Data.h" #include "$safeitemname$.g.h" namespace winrt::$rootnamespace$::implementation @@ -7,9 +7,10 @@ namespace winrt::$rootnamespace$::implementation struct $safeitemname$ : $safeitemname$T<$safeitemname$> { $safeitemname$() = default; - - int32_t MyProperty(); - void MyProperty(int32_t value); + event_token PropertyChanged(Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler); + void PropertyChanged(event_token token) noexcept; + private: + event m_PropertyChanged; }; } diff --git a/vsix/ItemTemplates/ViewModel/ViewModel.idl b/vsix/ItemTemplates/ViewModel/ViewModel.idl index 90819e2f1..3b97d52d0 100644 --- a/vsix/ItemTemplates/ViewModel/ViewModel.idl +++ b/vsix/ItemTemplates/ViewModel/ViewModel.idl @@ -2,9 +2,8 @@ namespace $rootnamespace$ { [bindable] [default_interface] - runtimeclass $safeitemname$ + runtimeclass $safeitemname$ : Windows.UI.Xaml.Data.INotifyPropertyChanged { $safeitemname$(); - Int32 MyProperty; } } diff --git a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/pch.h b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/pch.h index 710be80ea..ba0a38df9 100644 --- a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/pch.h +++ b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/pch.h @@ -1,5 +1,4 @@ #pragma once - #include #ifdef GetCurrentTime #undef GetCurrentTime diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.cpp b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.cpp index 8806e25cb..e090d9ede 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.cpp @@ -1,5 +1,4 @@ #include "pch.h" - #include "App.h" #include "MainPage.h" diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.h b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.h index 8208308c8..b7fe65ef7 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.h @@ -6,7 +6,6 @@ namespace winrt::$safeprojectname$::implementation struct App : AppT { App(); - void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&); void OnSuspending(IInspectable const&, Windows::ApplicationModel::SuspendingEventArgs const&); void OnNavigationFailed(IInspectable const&, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const&); diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp index 5caaa46e6..2b411fed9 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp @@ -11,19 +11,4 @@ namespace winrt::$safeprojectname$::implementation { InitializeComponent(); } - - int32_t MainPage::MyProperty() - { - throw hresult_not_implemented(); - } - - void MainPage::MyProperty(int32_t /* value */) - { - throw hresult_not_implemented(); - } - - void MainPage::ClickHandler(IInspectable const&, RoutedEventArgs const&) - { - myButton().Content(box_value(L"Clicked")); - } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h index 96c433917..da9b06744 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h @@ -1,5 +1,4 @@ #pragma once - #include "MainPage.g.h" namespace winrt::$safeprojectname$::implementation @@ -7,11 +6,6 @@ namespace winrt::$safeprojectname$::implementation struct MainPage : MainPageT { MainPage(); - - int32_t MyProperty(); - void MyProperty(int32_t value); - - void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); }; } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.idl b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.idl index c382ebfd6..e28c2582c 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.idl +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.idl @@ -4,6 +4,5 @@ namespace $safeprojectname$ runtimeclass MainPage : Windows.UI.Xaml.Controls.Page { MainPage(); - Int32 MyProperty; } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml index f58acc558..c6b100f27 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml @@ -1,13 +1,13 @@  + x:Class="$safeprojectname$.MainPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="using:$safeprojectname$" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> - - - + + + diff --git a/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/App.cpp b/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/App.cpp index 486e52df5..45cdf851c 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/App.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/App.cpp @@ -1,7 +1,6 @@ #include "pch.h" using namespace winrt; - using namespace Windows; using namespace Windows::ApplicationModel::Core; using namespace Windows::Foundation::Numerics; diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp index cc0146bad..9e4a2622a 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp @@ -4,13 +4,4 @@ namespace winrt::$safeprojectname$::implementation { - int32_t Class::MyProperty() - { - throw hresult_not_implemented(); - } - - void Class::MyProperty(int32_t /* value */) - { - throw hresult_not_implemented(); - } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h index f2ea96a0c..e9d0131a9 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h @@ -1,5 +1,4 @@ #pragma once - #include "Class.g.h" namespace winrt::$safeprojectname$::implementation @@ -7,9 +6,6 @@ namespace winrt::$safeprojectname$::implementation struct Class : ClassT { Class() = default; - - int32_t MyProperty(); - void MyProperty(int32_t value); }; } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl index 86166e978..96464ea0b 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl @@ -4,6 +4,5 @@ namespace $safeprojectname$ runtimeclass Class { Class(); - Int32 MyProperty; } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp index cc0146bad..9e4a2622a 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp @@ -4,13 +4,4 @@ namespace winrt::$safeprojectname$::implementation { - int32_t Class::MyProperty() - { - throw hresult_not_implemented(); - } - - void Class::MyProperty(int32_t /* value */) - { - throw hresult_not_implemented(); - } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h index f2ea96a0c..e9d0131a9 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h @@ -1,5 +1,4 @@ #pragma once - #include "Class.g.h" namespace winrt::$safeprojectname$::implementation @@ -7,9 +6,6 @@ namespace winrt::$safeprojectname$::implementation struct Class : ClassT { Class() = default; - - int32_t MyProperty(); - void MyProperty(int32_t value); }; } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl index 86166e978..96464ea0b 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl @@ -4,6 +4,5 @@ namespace $safeprojectname$ runtimeclass Class { Class(); - Int32 MyProperty; } } From afc1267578af0bb50801ce7a6ae81cb5e21e2282 Mon Sep 17 00:00:00 2001 From: Jaiganesh Date: Mon, 12 Apr 2021 13:08:33 +0530 Subject: [PATCH 2/6] Apply suggestions --- .../VC/Windows Universal/BlankApp/App.h | 1 + .../Windows Universal/BlankApp/MainPage.cpp | 16 ++++++++++++++ .../VC/Windows Universal/BlankApp/MainPage.h | 3 +++ .../Windows Universal/BlankApp/MainPage.idl | 1 + .../Windows Universal/BlankApp/MainPage.xaml | 22 +++++++++---------- .../Windows Universal/StaticLibrary/Class.cpp | 9 ++++++++ .../Windows Universal/StaticLibrary/Class.h | 2 ++ .../Windows Universal/StaticLibrary/Class.idl | 1 + .../WindowsRuntimeComponent/Class.cpp | 9 ++++++++ .../WindowsRuntimeComponent/Class.h | 2 ++ .../WindowsRuntimeComponent/Class.idl | 3 ++- 11 files changed, 57 insertions(+), 12 deletions(-) diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.h b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.h index b7fe65ef7..8208308c8 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.h @@ -6,6 +6,7 @@ namespace winrt::$safeprojectname$::implementation struct App : AppT { App(); + void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&); void OnSuspending(IInspectable const&, Windows::ApplicationModel::SuspendingEventArgs const&); void OnNavigationFailed(IInspectable const&, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const&); diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp index 2b411fed9..5a556b3c8 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp @@ -4,6 +4,7 @@ using namespace winrt; using namespace Windows::UI::Xaml; +using namespace Windows::Foundation; namespace winrt::$safeprojectname$::implementation { @@ -11,4 +12,19 @@ namespace winrt::$safeprojectname$::implementation { InitializeComponent(); } + + int MainPage::MyProperty() + { + throw hresult_not_implemented(); + } + + void MainPage::MyProperty(int value) + { + throw hresult_not_implemented(); + } + + void MainPage::ClickHandler(IInspectable const&, RoutedEventArgs const&) + { + myButton().Content(box_value(L"Clicked")); + } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h index da9b06744..0d27b621c 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h @@ -6,6 +6,9 @@ namespace winrt::$safeprojectname$::implementation struct MainPage : MainPageT { MainPage(); + int MyProperty(); + void MyProperty(int value); + void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); }; } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.idl b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.idl index e28c2582c..c382ebfd6 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.idl +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.idl @@ -4,5 +4,6 @@ namespace $safeprojectname$ runtimeclass MainPage : Windows.UI.Xaml.Controls.Page { MainPage(); + Int32 MyProperty; } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml index c6b100f27..2d2171804 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml @@ -1,13 +1,13 @@ - + - - - + + + diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp index 9e4a2622a..20f0b63bd 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp @@ -4,4 +4,13 @@ namespace winrt::$safeprojectname$::implementation { + int Class::MyProperty() + { + throw hresult_not_implemented(); + } + + void Class::MyProperty(int value) + { + throw hresult_not_implemented(); + } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h index e9d0131a9..40c142a26 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h @@ -6,6 +6,8 @@ namespace winrt::$safeprojectname$::implementation struct Class : ClassT { Class() = default; + int MyProperty(); + void MyProperty(int value); }; } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl index 96464ea0b..86166e978 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.idl @@ -4,5 +4,6 @@ namespace $safeprojectname$ runtimeclass Class { Class(); + Int32 MyProperty; } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp index 9e4a2622a..20f0b63bd 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp @@ -4,4 +4,13 @@ namespace winrt::$safeprojectname$::implementation { + int Class::MyProperty() + { + throw hresult_not_implemented(); + } + + void Class::MyProperty(int value) + { + throw hresult_not_implemented(); + } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h index e9d0131a9..40c142a26 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h @@ -6,6 +6,8 @@ namespace winrt::$safeprojectname$::implementation struct Class : ClassT { Class() = default; + int MyProperty(); + void MyProperty(int value); }; } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl index 96464ea0b..39361f530 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl @@ -4,5 +4,6 @@ namespace $safeprojectname$ runtimeclass Class { Class(); + Int32 MyProperty; } -} +} \ No newline at end of file From bbfc495c42e5ea533c1c150533074de072226553 Mon Sep 17 00:00:00 2001 From: Jaiganesh Date: Mon, 12 Apr 2021 13:16:54 +0530 Subject: [PATCH 3/6] Use spaces instead of tabs --- vsix/ItemTemplates/BlankPage/BlankPage.xaml | 6 ++---- .../BlankUserControl/BlankUserControl.xaml | 20 +++++++++---------- vsix/ItemTemplates/ViewModel/ViewModel.cpp | 16 +++++++-------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/vsix/ItemTemplates/BlankPage/BlankPage.xaml b/vsix/ItemTemplates/BlankPage/BlankPage.xaml index af2e38fdd..b8709a33c 100644 --- a/vsix/ItemTemplates/BlankPage/BlankPage.xaml +++ b/vsix/ItemTemplates/BlankPage/BlankPage.xaml @@ -2,12 +2,10 @@ x:Class="$rootnamespace$.$safeitemname$" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="using:$rootnamespace$" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="using:$rootnamespace$" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - - + diff --git a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml index 46f9d3adf..a5e469a15 100644 --- a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml +++ b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml @@ -1,13 +1,13 @@  + x:Class="$rootnamespace$.$safeitemname$" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="using:$rootnamespace$" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> - - - + + + diff --git a/vsix/ItemTemplates/ViewModel/ViewModel.cpp b/vsix/ItemTemplates/ViewModel/ViewModel.cpp index f35bd78c1..1a725de7b 100644 --- a/vsix/ItemTemplates/ViewModel/ViewModel.cpp +++ b/vsix/ItemTemplates/ViewModel/ViewModel.cpp @@ -9,13 +9,13 @@ using namespace Windows::UI::Xaml::Data; namespace winrt::$rootnamespace$::implementation { - event_token $safeitemname$::PropertyChanged(PropertyChangedEventHandler const& handler) - { - return m_PropertyChanged.add(handler); - } + event_token $safeitemname$::PropertyChanged(PropertyChangedEventHandler const& handler) + { + return m_PropertyChanged.add(handler); + } - void $safeitemname$::PropertyChanged(event_token token) noexcept - { - m_PropertyChanged.remove(token); - } + void $safeitemname$::PropertyChanged(event_token token) noexcept + { + m_PropertyChanged.remove(token); + } } From 4f0978efe39f56910a728b395bc7540f48bbbe42 Mon Sep 17 00:00:00 2001 From: Jaiganesh Date: Mon, 12 Apr 2021 13:21:01 +0530 Subject: [PATCH 4/6] Add maybe unused attribute --- .../VC/Windows Universal/BlankApp/MainPage.cpp | 4 ++-- .../VC/Windows Universal/BlankApp/MainPage.h | 4 ++-- .../VC/Windows Universal/StaticLibrary/Class.cpp | 16 ++++++++-------- .../VC/Windows Universal/StaticLibrary/Class.h | 4 ++-- .../WindowsRuntimeComponent/Class.cpp | 16 ++++++++-------- .../WindowsRuntimeComponent/Class.h | 4 ++-- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp index 5a556b3c8..2c7d66a7d 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp @@ -13,12 +13,12 @@ namespace winrt::$safeprojectname$::implementation InitializeComponent(); } - int MainPage::MyProperty() + int32_t MainPage::MyProperty() { throw hresult_not_implemented(); } - void MainPage::MyProperty(int value) + void MainPage::MyProperty([[maybe_unused]] int32_t value) { throw hresult_not_implemented(); } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h index 0d27b621c..055b37745 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h @@ -6,8 +6,8 @@ namespace winrt::$safeprojectname$::implementation struct MainPage : MainPageT { MainPage(); - int MyProperty(); - void MyProperty(int value); + int32_t MyProperty(); + void MyProperty(int32_t value); void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); }; } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp index 20f0b63bd..15ae1bbd7 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp @@ -4,13 +4,13 @@ namespace winrt::$safeprojectname$::implementation { - int Class::MyProperty() - { - throw hresult_not_implemented(); - } + int32_t Class::MyProperty() + { + throw hresult_not_implemented(); + } - void Class::MyProperty(int value) - { - throw hresult_not_implemented(); - } + void Class::MyProperty([[maybe_unused]] int32_t value) + { + throw hresult_not_implemented(); + } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h index 40c142a26..bb941381b 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h @@ -6,8 +6,8 @@ namespace winrt::$safeprojectname$::implementation struct Class : ClassT { Class() = default; - int MyProperty(); - void MyProperty(int value); + int32_t MyProperty(); + void MyProperty(int32_t value); }; } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp index 20f0b63bd..15ae1bbd7 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp @@ -4,13 +4,13 @@ namespace winrt::$safeprojectname$::implementation { - int Class::MyProperty() - { - throw hresult_not_implemented(); - } + int32_t Class::MyProperty() + { + throw hresult_not_implemented(); + } - void Class::MyProperty(int value) - { - throw hresult_not_implemented(); - } + void Class::MyProperty([[maybe_unused]] int32_t value) + { + throw hresult_not_implemented(); + } } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h index 40c142a26..bb941381b 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h @@ -6,8 +6,8 @@ namespace winrt::$safeprojectname$::implementation struct Class : ClassT { Class() = default; - int MyProperty(); - void MyProperty(int value); + int32_t MyProperty(); + void MyProperty(int32_t value); }; } From cb0dbd0a487ab54b93558c118171d9005e7f9c17 Mon Sep 17 00:00:00 2001 From: Jaiganesh Kumaran Date: Mon, 12 Apr 2021 19:01:45 +0530 Subject: [PATCH 5/6] Add line after MainPage's constructor --- vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h | 1 + 1 file changed, 1 insertion(+) diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h index 055b37745..aa0643566 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h @@ -6,6 +6,7 @@ namespace winrt::$safeprojectname$::implementation struct MainPage : MainPageT { MainPage(); + int32_t MyProperty(); void MyProperty(int32_t value); void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); From e8957a7d9df89d0913bca1520c93698a768c5261 Mon Sep 17 00:00:00 2001 From: Jaiganesh Date: Mon, 12 Apr 2021 19:25:33 +0530 Subject: [PATCH 6/6] Add new line after constructor --- vsix/ItemTemplates/ViewModel/ViewModel.h | 1 + vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h | 2 +- .../ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h | 1 + .../VC/Windows Universal/WindowsRuntimeComponent/Class.h | 1 + .../VC/Windows Universal/WindowsRuntimeComponent/Class.idl | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vsix/ItemTemplates/ViewModel/ViewModel.h b/vsix/ItemTemplates/ViewModel/ViewModel.h index 57abc7529..538712fe1 100644 --- a/vsix/ItemTemplates/ViewModel/ViewModel.h +++ b/vsix/ItemTemplates/ViewModel/ViewModel.h @@ -7,6 +7,7 @@ namespace winrt::$rootnamespace$::implementation struct $safeitemname$ : $safeitemname$T<$safeitemname$> { $safeitemname$() = default; + event_token PropertyChanged(Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler); void PropertyChanged(event_token token) noexcept; private: diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h index aa0643566..3e7bd2292 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h @@ -6,7 +6,7 @@ namespace winrt::$safeprojectname$::implementation struct MainPage : MainPageT { MainPage(); - + int32_t MyProperty(); void MyProperty(int32_t value); void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h index bb941381b..d07e3d3b7 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h @@ -6,6 +6,7 @@ namespace winrt::$safeprojectname$::implementation struct Class : ClassT { Class() = default; + int32_t MyProperty(); void MyProperty(int32_t value); }; diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h index bb941381b..d07e3d3b7 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h @@ -6,6 +6,7 @@ namespace winrt::$safeprojectname$::implementation struct Class : ClassT { Class() = default; + int32_t MyProperty(); void MyProperty(int32_t value); }; diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl index 39361f530..86166e978 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.idl @@ -6,4 +6,4 @@ namespace $safeprojectname$ Class(); Int32 MyProperty; } -} \ No newline at end of file +}