diff options
Diffstat (limited to '')
-rw-r--r-- | vsixtest/MainPage.xaml | 13 | ||||
-rw-r--r-- | vsixtest/MainPage.xaml.cpp | 53 | ||||
-rw-r--r-- | vsixtest/MainPage.xaml.h | 22 |
3 files changed, 88 insertions, 0 deletions
diff --git a/vsixtest/MainPage.xaml b/vsixtest/MainPage.xaml new file mode 100644 index 0000000..7472ad8 --- /dev/null +++ b/vsixtest/MainPage.xaml @@ -0,0 +1,13 @@ +<Page + x:Class="vsixtest.MainPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:vsixtest" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> + + <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> + + </Grid> +</Page> diff --git a/vsixtest/MainPage.xaml.cpp b/vsixtest/MainPage.xaml.cpp new file mode 100644 index 0000000..e67dcb8 --- /dev/null +++ b/vsixtest/MainPage.xaml.cpp @@ -0,0 +1,53 @@ +// +// MainPage.xaml.cpp +// Implementation of the MainPage class. +// + +#include "pch.h" +#include "MainPage.xaml.h" +#include "sqlite3.h" + +using namespace vsixtest; + +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 + +MainPage::MainPage() +{ + InitializeComponent(); + UseSQLite(); +} + +void MainPage::UseSQLite(void) +{ + int rc = SQLITE_OK; + sqlite3 *pDb = nullptr; + + rc = sqlite3_open_v2("test.db", &pDb, + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr); + + if (rc != SQLITE_OK) + throw ref new FailureException("Failed to open database."); + + rc = sqlite3_exec(pDb, "VACUUM;", nullptr, nullptr, nullptr); + + if (rc != SQLITE_OK) + throw ref new FailureException("Failed to vacuum database."); + + rc = sqlite3_close(pDb); + + if (rc != SQLITE_OK) + throw ref new FailureException("Failed to close database."); + + pDb = nullptr; +} diff --git a/vsixtest/MainPage.xaml.h b/vsixtest/MainPage.xaml.h new file mode 100644 index 0000000..ea327a3 --- /dev/null +++ b/vsixtest/MainPage.xaml.h @@ -0,0 +1,22 @@ +// +// MainPage.xaml.h +// Declaration of the MainPage class. +// + +#pragma once + +#include "MainPage.g.h" + +namespace vsixtest +{ + /// <summary> + /// An empty page that can be used on its own or navigated to within a Frame. + /// </summary> + public ref class MainPage sealed + { + public: + MainPage(); + void UseSQLite(void); + + }; +} |