M vorg-windows/App.xaml.cpp => vorg-windows/App.xaml.cpp +24 -31
@@ 1,12 1,9 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#include "pch.h"
#include "App.xaml.h"
-#include "MainWindow.xaml.h"
#include "BrowseVideoData.h"
+#include "MainWindow.xaml.h"
using namespace winrt;
using namespace Windows::Foundation;
@@ 16,9 13,6 @@ using namespace Microsoft::UI::Xaml::Navigation;
using namespace vorg_windows;
using namespace vorg_windows::implementation;
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-
namespace winrt::vorg_windows::implementation
{
/// <summary>
@@ 50,43 44,43 @@ void App::OnLaunched(LaunchActivatedEventArgs const &)
mWindow.Activate();
}
-bool App::OpenRepo(const winrt::hstring &path)
+bool App::OpenRepo(const hstring &path)
{
- std::string pathUTF8 = winrt::to_string(path);
+ std::string pathUTF8 = to_string(path);
mRepo = std::make_unique<Vorg::VorgRepo>(pathUTF8);
return mRepo->initRepo();
}
-bool App::SetImportFile(const winrt::hstring &path)
+bool App::SetImportFile(const hstring &path)
{
- std::string pathUTF8 = winrt::to_string(path);
+ std::string pathUTF8 = to_string(path);
return mRepo->prepareFileImport(pathUTF8) == Vorg::VorgRepo::Success;
}
-bool App::SetImportFolder(const winrt::hstring &path)
+bool App::SetImportFolder(const hstring &path)
{
- std::string pathUTF8 = winrt::to_string(path);
+ std::string pathUTF8 = to_string(path);
return mRepo->prepareFolderImport(pathUTF8) == Vorg::VorgRepo::Success;
}
-winrt::hstring App::GetNextFile() const
+hstring App::GetNextFile() const
{
std::string fileUTF8 = mRepo->getNextFilePath().string();
- return winrt::to_hstring(fileUTF8);
+ return to_hstring(fileUTF8);
}
-winrt::hstring App::GetNextFileName() const
+hstring App::GetNextFileName() const
{
std::string nameUTF8 = mRepo->getNextFilePath().filename().string();
- return winrt::to_hstring(nameUTF8);
+ return to_hstring(nameUTF8);
}
-bool App::ImportNext(const winrt::hstring &title, const winrt::hstring &studio,
- const winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &actors,
- const winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &tags)
+bool App::ImportNext(const hstring &title, const hstring &studio,
+ const Windows::Foundation::Collections::IObservableVector<hstring> &actors,
+ const Windows::Foundation::Collections::IObservableVector<hstring> &tags)
{
- std::string titleUTF8 = winrt::to_string(title);
- std::string studioUTF8 = winrt::to_string(studio);
+ std::string titleUTF8 = to_string(title);
+ std::string studioUTF8 = to_string(studio);
std::vector<std::string> actorsStd = WinrtToStdVector(actors);
std::vector<std::string> tagsStd = WinrtToStdVector(tags);
@@ 94,21 88,20 @@ bool App::ImportNext(const winrt::hstring &title, const winrt::hstring &studio,
}
void App::PopulateVideoData(
- winrt::Windows::Foundation::Collections::IObservableVector<winrt::Windows::Foundation::IInspectable> &resultData)
- const
+ Windows::Foundation::Collections::IObservableVector<Windows::Foundation::IInspectable> &resultData) const
{
resultData.Clear();
std::vector<Vorg::VorgFileData> rawData = mRepo->getFiles(mFilter);
for (const Vorg::VorgFileData &fileData : rawData)
{
- winrt::vorg_windows::BrowseVideoData winrtData = winrt::make<winrt::vorg_windows::implementation::BrowseVideoData>();
+ vorg_windows::BrowseVideoData winrtData = make<vorg_windows::implementation::BrowseVideoData>();
std::filesystem::path videoPathUTF8 = mRepo->getVideoPath(fileData);
std::vector<std::filesystem::path> thumbnailPathsUTF8 = mRepo->getThumbnailPaths(fileData);
- winrt::hstring videoPath = winrt::to_hstring(videoPathUTF8.string());
+ hstring videoPath = to_hstring(videoPathUTF8.string());
// NOTE: currently only the first thumbnail at 25% is used
- winrt::hstring thumbnailPath = winrt::to_hstring(thumbnailPathsUTF8[0].string());
+ hstring thumbnailPath = to_hstring(thumbnailPathsUTF8[0].string());
winrtData.VideoPath(videoPath);
winrtData.ThumbnailPath(thumbnailPath);
@@ 116,24 109,24 @@ void App::PopulateVideoData(
}
}
-winrt::hstring App::GetVorgError() const
+hstring App::GetVorgError() const
{
if (mRepo == nullptr)
{
return L"Repo is not initialized";
}
std::string errorUTF8 = mRepo->getErrorMsg();
- return winrt::to_hstring(errorUTF8);
+ return to_hstring(errorUTF8);
}
std::vector<std::string> App::WinrtToStdVector(
- const winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &input)
+ const Windows::Foundation::Collections::IObservableVector<hstring> &input)
{
int n = input.Size();
std::vector<std::string> result;
for (int i = 0; i < n; ++i)
{
- std::string elemUTF8 = winrt::to_string(input.GetAt(i));
+ std::string elemUTF8 = to_string(input.GetAt(i));
result.emplace_back(std::move(elemUTF8));
}
return result;
M vorg-windows/App.xaml.h => vorg-windows/App.xaml.h +12 -16
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#pragma once
#include "App.xaml.g.h"
@@ 16,29 13,28 @@ struct App : AppT<App>
void OnLaunched(Microsoft::UI::Xaml::LaunchActivatedEventArgs const &);
// App logics
- bool OpenRepo(const winrt::hstring &path);
- bool SetImportFile(const winrt::hstring &path);
- bool SetImportFolder(const winrt::hstring &path);
- winrt::hstring GetNextFile() const;
- winrt::hstring GetNextFileName() const;
- bool ImportNext(const winrt::hstring &title, const winrt::hstring &studio,
- const winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &actors,
- const winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &tags);
+ bool OpenRepo(const hstring &path);
+ bool SetImportFile(const hstring &path);
+ bool SetImportFolder(const hstring &path);
+ hstring GetNextFile() const;
+ hstring GetNextFileName() const;
+ bool ImportNext(const hstring &title, const hstring &studio,
+ const Windows::Foundation::Collections::IObservableVector<hstring> &actors,
+ const Windows::Foundation::Collections::IObservableVector<hstring> &tags);
void PopulateVideoData(
- winrt::Windows::Foundation::Collections::IObservableVector<winrt::Windows::Foundation::IInspectable>
- &resultData) const;
+ Windows::Foundation::Collections::IObservableVector<Windows::Foundation::IInspectable> &resultData) const;
// Error handling
- winrt::hstring GetVorgError() const;
+ hstring GetVorgError() const;
// Members
- winrt::Microsoft::UI::Xaml::Window mWindow{nullptr};
+ Microsoft::UI::Xaml::Window mWindow{nullptr};
private:
std::unique_ptr<Vorg::VorgRepo> mRepo;
Vorg::VorgFilter mFilter;
static std::vector<std::string> WinrtToStdVector(
- const winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &input);
+ const Windows::Foundation::Collections::IObservableVector<hstring> &input);
};
} // namespace winrt::vorg_windows::implementation
M vorg-windows/BrowsePage.xaml.cpp => vorg-windows/BrowsePage.xaml.cpp +11 -17
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#include "pch.h"
#include "BrowsePage.xaml.h"
@@ 13,31 10,28 @@ using namespace Microsoft::UI::Xaml;
namespace winrt::vorg_windows::implementation
{
-BrowsePage::BrowsePage()
- : mVideoData(winrt::single_threaded_observable_vector<winrt::Windows::Foundation::IInspectable>())
+BrowsePage::BrowsePage() : mVideoData(single_threaded_observable_vector<Windows::Foundation::IInspectable>())
{
InitializeComponent();
// Initialize app ptr
- mApp.copy_from(winrt::get_self<vorg_windows::implementation::App>(
- Application::Current().as<winrt::default_interface<vorg_windows::implementation::App>>()));
+ mApp.copy_from(get_self<vorg_windows::implementation::App>(
+ Application::Current().as<default_interface<vorg_windows::implementation::App>>()));
// Populate video data
mApp->PopulateVideoData(mVideoData);
}
-winrt::Windows::Foundation::Collections::IIterable<winrt::Windows::Foundation::IInspectable> BrowsePage::VideoData()
- const
+Windows::Foundation::Collections::IIterable<Windows::Foundation::IInspectable> BrowsePage::VideoData() const
{
return mVideoData;
}
-fire_and_forget BrowsePage::Thumbnail_DoubleTapped(
- winrt::Windows::Foundation::IInspectable const &sender,
- winrt::Microsoft::UI::Xaml::Input::DoubleTappedRoutedEventArgs const &)
+fire_and_forget BrowsePage::Thumbnail_DoubleTapped(Windows::Foundation::IInspectable const &sender,
+ Microsoft::UI::Xaml::Input::DoubleTappedRoutedEventArgs const &)
{
- winrt::Microsoft::UI::Xaml::Controls::Image image = sender.as<winrt::Microsoft::UI::Xaml::Controls::Image>();
- winrt::Windows::Foundation::IInspectable dataContext = image.DataContext();
+ Microsoft::UI::Xaml::Controls::Image image = sender.as<Microsoft::UI::Xaml::Controls::Image>();
+ Windows::Foundation::IInspectable dataContext = image.DataContext();
vorg_windows::BrowseVideoData videoData = dataContext.as<vorg_windows::BrowseVideoData>();
Windows::Storage::StorageFile videoFile =
co_await Windows::Storage::StorageFile::GetFileFromPathAsync(videoData.VideoPath());
@@ 47,9 41,9 @@ fire_and_forget BrowsePage::Thumbnail_DoubleTapped(
}
else
{
- winrt::vorg_windows::ErrorContentDialog dialog;
- dialog.Title(winrt::box_value(L"Error opening file"));
- dialog.Content(winrt::box_value(L"This should not happen. Please file a bug report."));
+ vorg_windows::ErrorContentDialog dialog;
+ dialog.Title(box_value(L"Error opening file"));
+ dialog.Content(box_value(L"This should not happen. Please file a bug report."));
dialog.XamlRoot(XamlRoot());
co_await dialog.ShowAsync();
}
M vorg-windows/BrowsePage.xaml.h => vorg-windows/BrowsePage.xaml.h +5 -8
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#pragma once
#include "BrowsePage.g.h"
@@ 13,15 10,15 @@ struct BrowsePage : BrowsePageT<BrowsePage>
{
BrowsePage();
- winrt::Windows::Foundation::Collections::IIterable<winrt::Windows::Foundation::IInspectable> VideoData() const;
+ Windows::Foundation::Collections::IIterable<Windows::Foundation::IInspectable> VideoData() const;
private:
- winrt::Windows::Foundation::Collections::IObservableVector<winrt::Windows::Foundation::IInspectable> mVideoData;
- winrt::com_ptr<vorg_windows::implementation::App> mApp{nullptr};
+ Windows::Foundation::Collections::IObservableVector<Windows::Foundation::IInspectable> mVideoData;
+ com_ptr<vorg_windows::implementation::App> mApp{nullptr};
public:
- fire_and_forget Thumbnail_DoubleTapped(winrt::Windows::Foundation::IInspectable const &sender,
- winrt::Microsoft::UI::Xaml::Input::DoubleTappedRoutedEventArgs const &);
+ fire_and_forget Thumbnail_DoubleTapped(Windows::Foundation::IInspectable const &sender,
+ Microsoft::UI::Xaml::Input::DoubleTappedRoutedEventArgs const &);
};
} // namespace winrt::vorg_windows::implementation
M vorg-windows/BrowseVideoData.cpp => vorg-windows/BrowseVideoData.cpp +4 -4
@@ 7,22 7,22 @@
namespace winrt::vorg_windows::implementation
{
-winrt::hstring BrowseVideoData::ThumbnailPath() const
+hstring BrowseVideoData::ThumbnailPath() const
{
return mThumbnailPath;
}
-void BrowseVideoData::ThumbnailPath(const winrt::hstring &thumbnailPath)
+void BrowseVideoData::ThumbnailPath(const hstring &thumbnailPath)
{
mThumbnailPath = thumbnailPath;
}
-winrt::hstring BrowseVideoData::VideoPath() const
+hstring BrowseVideoData::VideoPath() const
{
return mVideoPath;
}
-void BrowseVideoData::VideoPath(const winrt::hstring &videoPath)
+void BrowseVideoData::VideoPath(const hstring &videoPath)
{
mVideoPath = videoPath;
}
M vorg-windows/BrowseVideoData.h => vorg-windows/BrowseVideoData.h +6 -6
@@ 6,15 6,15 @@ namespace winrt::vorg_windows::implementation
{
struct BrowseVideoData : BrowseVideoDataT<BrowseVideoData>
{
- winrt::hstring ThumbnailPath() const;
- void ThumbnailPath(const winrt::hstring &thumbnailPath);
+ hstring ThumbnailPath() const;
+ void ThumbnailPath(const hstring &thumbnailPath);
- winrt::hstring VideoPath() const;
- void VideoPath(const winrt::hstring &videoPath);
+ hstring VideoPath() const;
+ void VideoPath(const hstring &videoPath);
private:
- winrt::hstring mThumbnailPath;
- winrt::hstring mVideoPath;
+ hstring mThumbnailPath;
+ hstring mVideoPath;
};
} // namespace winrt::vorg_windows::implementation
M vorg-windows/ErrorContentDialog.xaml.cpp => vorg-windows/ErrorContentDialog.xaml.cpp +0 -6
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#include "pch.h"
#include "ErrorContentDialog.xaml.h"
@@ 11,9 8,6 @@
using namespace winrt;
using namespace Microsoft::UI::Xaml;
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-
namespace winrt::vorg_windows::implementation
{
ErrorContentDialog::ErrorContentDialog()
M vorg-windows/ErrorContentDialog.xaml.h => vorg-windows/ErrorContentDialog.xaml.h +0 -3
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#pragma once
#include "ErrorContentDialog.g.h"
M vorg-windows/ImportEditPage.xaml.cpp => vorg-windows/ImportEditPage.xaml.cpp +49 -55
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#include "pch.h"
#include "ImportEditPage.xaml.h"
@@ 14,131 11,128 @@ using namespace Microsoft::UI::Xaml;
namespace winrt::vorg_windows::implementation
{
ImportEditPage::ImportEditPage()
- : mActors(winrt::single_threaded_observable_vector<winrt::hstring>()),
- mTags(winrt::single_threaded_observable_vector<winrt::hstring>())
+ : mActors(single_threaded_observable_vector<hstring>()), mTags(single_threaded_observable_vector<hstring>())
{
InitializeComponent();
// Initialize app ptr
- mApp.copy_from(winrt::get_self<vorg_windows::implementation::App>(
- Application::Current().as<winrt::default_interface<vorg_windows::implementation::App>>()));
+ mApp.copy_from(get_self<vorg_windows::implementation::App>(
+ Application::Current().as<default_interface<vorg_windows::implementation::App>>()));
}
-winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> ImportEditPage::Actors() const
+Windows::Foundation::Collections::IObservableVector<hstring> ImportEditPage::Actors() const
{
return mActors;
}
-winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> ImportEditPage::Tags() const
+Windows::Foundation::Collections::IObservableVector<hstring> ImportEditPage::Tags() const
{
return mTags;
}
-winrt::Windows::Media::Core::MediaSource ImportEditPage::MediaSource() const
+Windows::Media::Core::MediaSource ImportEditPage::MediaSource() const
{
return mMediaSource;
}
-void ImportEditPage::MediaSource(const winrt::Windows::Media::Core::MediaSource &mediaSource)
+void ImportEditPage::MediaSource(const Windows::Media::Core::MediaSource &mediaSource)
{
mMediaSource = mediaSource;
}
-winrt::hstring ImportEditPage::FileName() const
+hstring ImportEditPage::FileName() const
{
return mFileName;
}
-void ImportEditPage::FileName(const winrt::hstring &fileName)
+void ImportEditPage::FileName(const hstring &fileName)
{
mFileName = fileName;
}
-void ImportEditPage::UserControl_PointerEntered(const winrt::Windows::Foundation::IInspectable &sender,
- const winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &)
+void ImportEditPage::UserControl_PointerEntered(const Windows::Foundation::IInspectable &sender,
+ const Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &)
{
- winrt::Microsoft::UI::Xaml::Controls::UserControl userControl =
- sender.as<winrt::Microsoft::UI::Xaml::Controls::UserControl>();
+ Microsoft::UI::Xaml::Controls::UserControl userControl = sender.as<Microsoft::UI::Xaml::Controls::UserControl>();
VisualStateManager::GoToState(userControl, L"HoverButtonsShown", false);
}
-void ImportEditPage::UserControl_PointerExited(const winrt::Windows::Foundation::IInspectable &sender,
- const winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &)
+void ImportEditPage::UserControl_PointerExited(const Windows::Foundation::IInspectable &sender,
+ const Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &)
{
- winrt::Microsoft::UI::Xaml::Controls::UserControl userControl =
- sender.as<winrt::Microsoft::UI::Xaml::Controls::UserControl>();
+ Microsoft::UI::Xaml::Controls::UserControl userControl = sender.as<Microsoft::UI::Xaml::Controls::UserControl>();
VisualStateManager::GoToState(userControl, L"HoverButtonsHidden", false);
}
-void ImportEditPage::ActorsDeleteButton_Click(const winrt::Windows::Foundation::IInspectable &sender,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &)
+void ImportEditPage::ActorsDeleteButton_Click(const Windows::Foundation::IInspectable &sender,
+ const Microsoft::UI::Xaml::RoutedEventArgs &)
{
- winrt::Microsoft::UI::Xaml::Controls::Button button = sender.as<winrt::Microsoft::UI::Xaml::Controls::Button>();
- winrt::Windows::Foundation::IInspectable dataContext = button.DataContext();
- winrt::hstring itemName = dataContext.as<winrt::hstring>();
+ Microsoft::UI::Xaml::Controls::Button button = sender.as<Microsoft::UI::Xaml::Controls::Button>();
+ Windows::Foundation::IInspectable dataContext = button.DataContext();
+ hstring itemName = dataContext.as<hstring>();
DeleteFromVector(mActors, itemName);
}
-void ImportEditPage::TagsDeleteButton_Click(const winrt::Windows::Foundation::IInspectable &sender,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &)
+void ImportEditPage::TagsDeleteButton_Click(const Windows::Foundation::IInspectable &sender,
+ const Microsoft::UI::Xaml::RoutedEventArgs &)
{
- winrt::Microsoft::UI::Xaml::Controls::Button button = sender.as<winrt::Microsoft::UI::Xaml::Controls::Button>();
- winrt::Windows::Foundation::IInspectable dataContext = button.DataContext();
- winrt::hstring itemName = dataContext.as<winrt::hstring>();
+ Microsoft::UI::Xaml::Controls::Button button = sender.as<Microsoft::UI::Xaml::Controls::Button>();
+ Windows::Foundation::IInspectable dataContext = button.DataContext();
+ hstring itemName = dataContext.as<hstring>();
DeleteFromVector(mTags, itemName);
}
-void ImportEditPage::ActorsSubmitButton_Click(const winrt::Windows::Foundation::IInspectable &,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &)
+void ImportEditPage::ActorsSubmitButton_Click(const Windows::Foundation::IInspectable &,
+ const Microsoft::UI::Xaml::RoutedEventArgs &)
{
AddToActors(ActorNameInput().Text());
}
-void ImportEditPage::TagsSubmitButton_Click(const winrt::Windows::Foundation::IInspectable &,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &)
+void ImportEditPage::TagsSubmitButton_Click(const Windows::Foundation::IInspectable &,
+ const Microsoft::UI::Xaml::RoutedEventArgs &)
{
AddToTags(TagNameInput().Text());
}
-void ImportEditPage::ActorNameInput_KeyUp(winrt::Windows::Foundation::IInspectable const &,
- winrt::Microsoft::UI::Xaml::Input::KeyRoutedEventArgs const &e)
+void ImportEditPage::ActorNameInput_KeyUp(Windows::Foundation::IInspectable const &,
+ Microsoft::UI::Xaml::Input::KeyRoutedEventArgs const &e)
{
- if (e.Key() == winrt::Windows::System::VirtualKey::Enter)
+ if (e.Key() == Windows::System::VirtualKey::Enter)
{
AddToActors(ActorNameInput().Text());
}
}
-void ImportEditPage::TagNameInput_KeyUp(winrt::Windows::Foundation::IInspectable const &,
- winrt::Microsoft::UI::Xaml::Input::KeyRoutedEventArgs const &e)
+void ImportEditPage::TagNameInput_KeyUp(Windows::Foundation::IInspectable const &,
+ Microsoft::UI::Xaml::Input::KeyRoutedEventArgs const &e)
{
- if (e.Key() == winrt::Windows::System::VirtualKey::Enter)
+ if (e.Key() == Windows::System::VirtualKey::Enter)
{
AddToTags(TagNameInput().Text());
}
}
-void ImportEditPage::SubmitButton_Click(const winrt::Windows::Foundation::IInspectable &,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &)
+void ImportEditPage::SubmitButton_Click(const Windows::Foundation::IInspectable &,
+ const Microsoft::UI::Xaml::RoutedEventArgs &)
{
mApp->ImportNext(TitleInput().Text(), StudioInput().Text(), mActors, mTags);
mEditFinishedEvent(*this, nullptr);
}
-winrt::event_token ImportEditPage::EditFinished(
- const winrt::Windows::Foundation::TypedEventHandler<vorg_windows::ImportEditPage,
- winrt::Windows::Foundation::IInspectable> &handler)
+event_token ImportEditPage::EditFinished(
+ const Windows::Foundation::TypedEventHandler<vorg_windows::ImportEditPage, Windows::Foundation::IInspectable>
+ &handler)
{
return mEditFinishedEvent.add(handler);
}
-void ImportEditPage::EditFinished(const winrt::event_token &token)
+void ImportEditPage::EditFinished(const event_token &token)
{
mEditFinishedEvent.remove(token);
}
-void ImportEditPage::DeleteFromVector(winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &vector,
- const winrt::hstring &item)
+void ImportEditPage::DeleteFromVector(Windows::Foundation::Collections::IObservableVector<hstring> &vector,
+ const hstring &item)
{
for (uint32_t i = 0; i < vector.Size(); ++i)
{
@@ 150,8 144,8 @@ void ImportEditPage::DeleteFromVector(winrt::Windows::Foundation::Collections::I
}
}
-bool ImportEditPage::FindInVector(winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &vector,
- const winrt::hstring &item)
+bool ImportEditPage::FindInVector(Windows::Foundation::Collections::IObservableVector<hstring> &vector,
+ const hstring &item)
{
for (uint32_t i = 0; i < vector.Size(); ++i)
{
@@ 175,11 169,11 @@ void ImportEditPage::TrimStringView(std::wstring_view &view)
}
}
-void ImportEditPage::AddToActors(const winrt::hstring &actor)
+void ImportEditPage::AddToActors(const hstring &actor)
{
std::wstring_view nameView = actor;
TrimStringView(nameView);
- winrt::hstring trimmedName{nameView};
+ hstring trimmedName{nameView};
if (!trimmedName.empty() && !FindInVector(mActors, trimmedName))
{
mActors.Append(trimmedName);
@@ 187,11 181,11 @@ void ImportEditPage::AddToActors(const winrt::hstring &actor)
ActorNameInput().Text(L"");
}
-void ImportEditPage::AddToTags(const winrt::hstring &tag)
+void ImportEditPage::AddToTags(const hstring &tag)
{
std::wstring_view nameView = tag;
TrimStringView(nameView);
- winrt::hstring trimmedName{nameView};
+ hstring trimmedName{nameView};
if (!nameView.empty() && !FindInVector(mTags, trimmedName))
{
mTags.Append(trimmedName);
M vorg-windows/ImportEditPage.xaml.h => vorg-windows/ImportEditPage.xaml.h +37 -43
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#pragma once
#include "ImportEditPage.g.h"
@@ 13,58 10,55 @@ struct ImportEditPage : ImportEditPageT<ImportEditPage>
{
ImportEditPage();
- winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> Actors() const;
- winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> Tags() const;
+ Windows::Foundation::Collections::IObservableVector<hstring> Actors() const;
+ Windows::Foundation::Collections::IObservableVector<hstring> Tags() const;
- winrt::Windows::Media::Core::MediaSource MediaSource() const;
- void MediaSource(const winrt::Windows::Media::Core::MediaSource &mediaSource);
+ Windows::Media::Core::MediaSource MediaSource() const;
+ void MediaSource(const Windows::Media::Core::MediaSource &mediaSource);
- winrt::hstring FileName() const;
- void FileName(const winrt::hstring &fileName);
+ hstring FileName() const;
+ void FileName(const hstring &fileName);
- void UserControl_PointerEntered(const winrt::Windows::Foundation::IInspectable &sender,
- const winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &);
- void UserControl_PointerExited(const winrt::Windows::Foundation::IInspectable &sender,
- const winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &);
- void ActorsDeleteButton_Click(const winrt::Windows::Foundation::IInspectable &sender,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &e);
- void TagsDeleteButton_Click(const winrt::Windows::Foundation::IInspectable &sender,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &e);
+ void UserControl_PointerEntered(const Windows::Foundation::IInspectable &sender,
+ const Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &);
+ void UserControl_PointerExited(const Windows::Foundation::IInspectable &sender,
+ const Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &);
+ void ActorsDeleteButton_Click(const Windows::Foundation::IInspectable &sender,
+ const Microsoft::UI::Xaml::RoutedEventArgs &e);
+ void TagsDeleteButton_Click(const Windows::Foundation::IInspectable &sender,
+ const Microsoft::UI::Xaml::RoutedEventArgs &e);
- void ActorsSubmitButton_Click(const winrt::Windows::Foundation::IInspectable &,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &e);
- void TagsSubmitButton_Click(const winrt::Windows::Foundation::IInspectable &,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &e);
+ void ActorsSubmitButton_Click(const Windows::Foundation::IInspectable &,
+ const Microsoft::UI::Xaml::RoutedEventArgs &e);
+ void TagsSubmitButton_Click(const Windows::Foundation::IInspectable &,
+ const Microsoft::UI::Xaml::RoutedEventArgs &e);
- void ActorNameInput_KeyUp(winrt::Windows::Foundation::IInspectable const &,
- winrt::Microsoft::UI::Xaml::Input::KeyRoutedEventArgs const &e);
- void TagNameInput_KeyUp(winrt::Windows::Foundation::IInspectable const &,
- winrt::Microsoft::UI::Xaml::Input::KeyRoutedEventArgs const &e);
+ void ActorNameInput_KeyUp(Windows::Foundation::IInspectable const &,
+ Microsoft::UI::Xaml::Input::KeyRoutedEventArgs const &e);
+ void TagNameInput_KeyUp(Windows::Foundation::IInspectable const &,
+ Microsoft::UI::Xaml::Input::KeyRoutedEventArgs const &e);
- void SubmitButton_Click(const winrt::Windows::Foundation::IInspectable &,
- const winrt::Microsoft::UI::Xaml::RoutedEventArgs &);
+ void SubmitButton_Click(const Windows::Foundation::IInspectable &, const Microsoft::UI::Xaml::RoutedEventArgs &);
- winrt::event_token EditFinished(const winrt::Windows::Foundation::TypedEventHandler<
- vorg_windows::ImportEditPage, winrt::Windows::Foundation::IInspectable> &handler);
- void EditFinished(const winrt::event_token &token);
+ event_token EditFinished(const Windows::Foundation::TypedEventHandler<vorg_windows::ImportEditPage,
+ Windows::Foundation::IInspectable> &handler);
+ void EditFinished(const event_token &token);
private:
- winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> mActors;
- winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> mTags;
- winrt::Windows::Media::Core::MediaSource mMediaSource{nullptr};
- winrt::hstring mFileName;
- winrt::com_ptr<winrt::vorg_windows::implementation::App> mApp;
- winrt::event<winrt::Windows::Foundation::TypedEventHandler<vorg_windows::ImportEditPage,
- winrt::Windows::Foundation::IInspectable>>
+ Windows::Foundation::Collections::IObservableVector<hstring> mActors;
+ Windows::Foundation::Collections::IObservableVector<hstring> mTags;
+ Windows::Media::Core::MediaSource mMediaSource{nullptr};
+ hstring mFileName;
+ com_ptr<vorg_windows::implementation::App> mApp;
+ event<Windows::Foundation::TypedEventHandler<vorg_windows::ImportEditPage, Windows::Foundation::IInspectable>>
mEditFinishedEvent;
- static void DeleteFromVector(winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &vector,
- const winrt::hstring &item);
- static bool FindInVector(winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &vector,
- const winrt::hstring &item);
+ static void DeleteFromVector(Windows::Foundation::Collections::IObservableVector<hstring> &vector,
+ const hstring &item);
+ static bool FindInVector(Windows::Foundation::Collections::IObservableVector<hstring> &vector, const hstring &item);
static void TrimStringView(std::wstring_view &view);
- void AddToActors(const winrt::hstring &actor);
- void AddToTags(const winrt::hstring &tag);
+ void AddToActors(const hstring &actor);
+ void AddToTags(const hstring &tag);
};
} // namespace winrt::vorg_windows::implementation
M vorg-windows/ImportPage.xaml.cpp => vorg-windows/ImportPage.xaml.cpp +15 -18
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#include "pch.h"
#include "ImportPage.xaml.h"
@@ 20,11 17,11 @@ ImportPage::ImportPage()
InitializeComponent();
// Initialize app ptr
- mApp.copy_from(winrt::get_self<vorg_windows::implementation::App>(
- Application::Current().as<winrt::default_interface<vorg_windows::implementation::App>>()));
+ mApp.copy_from(get_self<vorg_windows::implementation::App>(
+ Application::Current().as<default_interface<vorg_windows::implementation::App>>()));
// Starts in ImportSelectionPage
- ContentFrame().Navigate(winrt::xaml_typename<winrt::vorg_windows::ImportSelectionPage>());
+ ContentFrame().Navigate(xaml_typename<vorg_windows::ImportSelectionPage>());
// Register SelectionFinished handler
vorg_windows::ImportSelectionPage selectionPage = ContentFrame().Content().as<vorg_windows::ImportSelectionPage>();
@@ 33,32 30,32 @@ ImportPage::ImportPage()
}
void ImportPage::ImportSelectionPage_SelectionFinished(const vorg_windows::ImportSelectionPage &,
- const winrt::Windows::Foundation::IInspectable &)
+ const Windows::Foundation::IInspectable &)
{
// Remove SelectionFinished handler
vorg_windows::ImportSelectionPage selectionPage = ContentFrame().Content().as<vorg_windows::ImportSelectionPage>();
selectionPage.SelectionFinished(mSelectionFinishedToken);
// Navigate to ImportEditPage
- ContentFrame().Navigate(winrt::xaml_typename<winrt::vorg_windows::ImportEditPage>());
+ ContentFrame().Navigate(xaml_typename<vorg_windows::ImportEditPage>());
// Set ImportEditPage MediaSource
vorg_windows::ImportEditPage editPage = ContentFrame().Content().as<vorg_windows::ImportEditPage>();
- winrt::hstring filePath = mApp->GetNextFile();
- winrt::hstring fileName = mApp->GetNextFileName();
+ hstring filePath = mApp->GetNextFile();
+ hstring fileName = mApp->GetNextFileName();
editPage.FileName(fileName);
- winrt::Windows::Media::Core::MediaSource mediaSouce =
- winrt::Windows::Media::Core::MediaSource::CreateFromUri(winrt::Windows::Foundation::Uri{filePath});
+ Windows::Media::Core::MediaSource mediaSouce =
+ Windows::Media::Core::MediaSource::CreateFromUri(Windows::Foundation::Uri{filePath});
editPage.MediaSource(mediaSouce);
mEditFinishedToken =
editPage.EditFinished([this](auto &sender, auto &args) { this->ImportEditPage_EditFinished(sender, args); });
}
void ImportPage::ImportEditPage_EditFinished(const vorg_windows::ImportEditPage &,
- const winrt::Windows::Foundation::IInspectable &)
+ const Windows::Foundation::IInspectable &)
{
// Check for next file
- winrt::hstring filePath = mApp->GetNextFile();
+ hstring filePath = mApp->GetNextFile();
if (filePath.empty())
{
// No more file
@@ 67,7 64,7 @@ void ImportPage::ImportEditPage_EditFinished(const vorg_windows::ImportEditPage
editPage.EditFinished(mEditFinishedToken);
// Navigate to ImportSelectionPage
- ContentFrame().Navigate(winrt::xaml_typename<winrt::vorg_windows::ImportSelectionPage>());
+ ContentFrame().Navigate(xaml_typename<vorg_windows::ImportSelectionPage>());
vorg_windows::ImportSelectionPage selectionPage =
ContentFrame().Content().as<vorg_windows::ImportSelectionPage>();
mSelectionFinishedToken = selectionPage.SelectionFinished(
@@ 76,11 73,11 @@ void ImportPage::ImportEditPage_EditFinished(const vorg_windows::ImportEditPage
else
{
// Continue editing next file
- winrt::hstring fileName = mApp->GetNextFileName();
+ hstring fileName = mApp->GetNextFileName();
vorg_windows::ImportEditPage editPage = ContentFrame().Content().as<vorg_windows::ImportEditPage>();
editPage.FileName(fileName);
- winrt::Windows::Media::Core::MediaSource mediaSouce =
- winrt::Windows::Media::Core::MediaSource::CreateFromUri(winrt::Windows::Foundation::Uri{filePath});
+ Windows::Media::Core::MediaSource mediaSouce =
+ Windows::Media::Core::MediaSource::CreateFromUri(Windows::Foundation::Uri{filePath});
editPage.MediaSource(mediaSouce);
}
}
M vorg-windows/ImportPage.xaml.h => vorg-windows/ImportPage.xaml.h +5 -9
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#pragma once
#include "ImportPage.g.h"
@@ 14,15 11,14 @@ struct ImportPage : ImportPageT<ImportPage>
ImportPage();
void ImportSelectionPage_SelectionFinished(const vorg_windows::ImportSelectionPage &,
- const winrt::Windows::Foundation::IInspectable &);
+ const Windows::Foundation::IInspectable &);
- void ImportEditPage_EditFinished(const vorg_windows::ImportEditPage &,
- const winrt::Windows::Foundation::IInspectable &);
+ void ImportEditPage_EditFinished(const vorg_windows::ImportEditPage &, const Windows::Foundation::IInspectable &);
private:
- winrt::event_token mSelectionFinishedToken;
- winrt::event_token mEditFinishedToken;
- winrt::com_ptr<winrt::vorg_windows::implementation::App> mApp{nullptr};
+ event_token mSelectionFinishedToken;
+ event_token mEditFinishedToken;
+ com_ptr<vorg_windows::implementation::App> mApp{nullptr};
};
} // namespace winrt::vorg_windows::implementation
M vorg-windows/ImportSelectionPage.xaml.cpp => vorg-windows/ImportSelectionPage.xaml.cpp +23 -29
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#include "pch.h"
#include "ImportSelectionPage.xaml.h"
@@ 11,20 8,17 @@
using namespace winrt;
using namespace Microsoft::UI::Xaml;
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-
namespace winrt::vorg_windows::implementation
{
ImportSelectionPage::ImportSelectionPage()
{
InitializeComponent();
- mApp.copy_from(winrt::get_self<vorg_windows::implementation::App>(
- Application::Current().as<winrt::default_interface<vorg_windows::implementation::App>>()));
+ mApp.copy_from(get_self<vorg_windows::implementation::App>(
+ Application::Current().as<default_interface<vorg_windows::implementation::App>>()));
}
-winrt::fire_and_forget ImportSelectionPage::ImportFileButton_Click(
- winrt::Windows::Foundation::IInspectable const &sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const &e)
+fire_and_forget ImportSelectionPage::ImportFileButton_Click(Windows::Foundation::IInspectable const &sender,
+ Microsoft::UI::Xaml::RoutedEventArgs const &e)
{
// If mHwnd is unitialized, initialize it
if (mHwnd == nullptr)
@@ 33,11 27,11 @@ winrt::fire_and_forget ImportSelectionPage::ImportFileButton_Click(
}
// Launch file chooser
- winrt::Windows::Storage::Pickers::FileOpenPicker filePicker;
- filePicker.SuggestedStartLocation(winrt::Windows::Storage::Pickers::PickerLocationId::VideosLibrary);
+ Windows::Storage::Pickers::FileOpenPicker filePicker;
+ filePicker.SuggestedStartLocation(Windows::Storage::Pickers::PickerLocationId::VideosLibrary);
filePicker.as<IInitializeWithWindow>()->Initialize(mHwnd);
filePicker.FileTypeFilter().ReplaceAll({L".mp4"});
- winrt::Windows::Storage::StorageFile file = co_await filePicker.PickSingleFileAsync();
+ Windows::Storage::StorageFile file = co_await filePicker.PickSingleFileAsync();
if (file != nullptr)
{
@@ 45,9 39,9 @@ winrt::fire_and_forget ImportSelectionPage::ImportFileButton_Click(
if (!mApp->SetImportFile(file.Path()))
{
// Show dialog with error
- winrt::vorg_windows::ErrorContentDialog dialog;
- dialog.Title(winrt::box_value(L"Error importing file"));
- dialog.Content(winrt::box_value(mApp->GetVorgError()));
+ vorg_windows::ErrorContentDialog dialog;
+ dialog.Title(box_value(L"Error importing file"));
+ dialog.Content(box_value(mApp->GetVorgError()));
dialog.XamlRoot(XamlRoot());
co_await dialog.ShowAsync();
}
@@ 59,8 53,8 @@ winrt::fire_and_forget ImportSelectionPage::ImportFileButton_Click(
}
}
-winrt::fire_and_forget ImportSelectionPage::ImportFolderButton_Click(
- winrt::Windows::Foundation::IInspectable const &sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const &e)
+fire_and_forget ImportSelectionPage::ImportFolderButton_Click(Windows::Foundation::IInspectable const &sender,
+ Microsoft::UI::Xaml::RoutedEventArgs const &e)
{
// If mHwnd is unitialized, initialize it
if (mHwnd == nullptr)
@@ 69,10 63,10 @@ winrt::fire_and_forget ImportSelectionPage::ImportFolderButton_Click(
}
// Launch file chooser
- winrt::Windows::Storage::Pickers::FolderPicker folderPicker;
- folderPicker.SuggestedStartLocation(winrt::Windows::Storage::Pickers::PickerLocationId::VideosLibrary);
+ Windows::Storage::Pickers::FolderPicker folderPicker;
+ folderPicker.SuggestedStartLocation(Windows::Storage::Pickers::PickerLocationId::VideosLibrary);
folderPicker.as<IInitializeWithWindow>()->Initialize(mHwnd);
- winrt::Windows::Storage::StorageFolder folder = co_await folderPicker.PickSingleFolderAsync();
+ Windows::Storage::StorageFolder folder = co_await folderPicker.PickSingleFolderAsync();
if (folder != nullptr)
{
@@ 80,9 74,9 @@ winrt::fire_and_forget ImportSelectionPage::ImportFolderButton_Click(
if (!mApp->SetImportFolder(folder.Path()))
{
// Show dialog with error
- winrt::vorg_windows::ErrorContentDialog dialog;
- dialog.Title(winrt::box_value(L"Error importing folder"));
- dialog.Content(winrt::box_value(mApp->GetVorgError()));
+ vorg_windows::ErrorContentDialog dialog;
+ dialog.Title(box_value(L"Error importing folder"));
+ dialog.Content(box_value(mApp->GetVorgError()));
dialog.XamlRoot(XamlRoot());
co_await dialog.ShowAsync();
}
@@ 94,14 88,14 @@ winrt::fire_and_forget ImportSelectionPage::ImportFolderButton_Click(
}
}
-winrt::event_token ImportSelectionPage::SelectionFinished(
- const winrt::Windows::Foundation::TypedEventHandler<vorg_windows::ImportSelectionPage,
- winrt::Windows::Foundation::IInspectable> &handler)
+event_token ImportSelectionPage::SelectionFinished(
+ const Windows::Foundation::TypedEventHandler<vorg_windows::ImportSelectionPage, Windows::Foundation::IInspectable>
+ &handler)
{
return mSelectionFinishedEvent.add(handler);
}
-void ImportSelectionPage::SelectionFinished(const winrt::event_token &token)
+void ImportSelectionPage::SelectionFinished(const event_token &token)
{
mSelectionFinishedEvent.remove(token);
}
@@ 109,7 103,7 @@ void ImportSelectionPage::SelectionFinished(const winrt::event_token &token)
void ImportSelectionPage::initWndHandle()
{
auto nativeWindow = mApp->mWindow.try_as<IWindowNative>();
- winrt::check_bool(nativeWindow);
+ check_bool(nativeWindow);
nativeWindow->get_WindowHandle(&mHwnd);
}
} // namespace winrt::vorg_windows::implementation
M vorg-windows/ImportSelectionPage.xaml.h => vorg-windows/ImportSelectionPage.xaml.h +9 -14
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#pragma once
#include "ImportSelectionPage.g.h"
@@ 13,22 10,20 @@ struct ImportSelectionPage : ImportSelectionPageT<ImportSelectionPage>
{
ImportSelectionPage();
- winrt::fire_and_forget ImportFileButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
- winrt::Microsoft::UI::Xaml::RoutedEventArgs const &e);
- winrt::fire_and_forget ImportFolderButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
- winrt::Microsoft::UI::Xaml::RoutedEventArgs const &e);
+ fire_and_forget ImportFileButton_Click(Windows::Foundation::IInspectable const &sender,
+ Microsoft::UI::Xaml::RoutedEventArgs const &e);
+ fire_and_forget ImportFolderButton_Click(Windows::Foundation::IInspectable const &sender,
+ Microsoft::UI::Xaml::RoutedEventArgs const &e);
- winrt::event_token SelectionFinished(
- const winrt::Windows::Foundation::TypedEventHandler<vorg_windows::ImportSelectionPage,
- winrt::Windows::Foundation::IInspectable> &handler);
- void SelectionFinished(const winrt::event_token &token);
+ event_token SelectionFinished(const Windows::Foundation::TypedEventHandler<
+ vorg_windows::ImportSelectionPage, Windows::Foundation::IInspectable> &handler);
+ void SelectionFinished(const event_token &token);
private:
- winrt::com_ptr<vorg_windows::implementation::App> mApp{nullptr};
+ com_ptr<vorg_windows::implementation::App> mApp{nullptr};
HWND mHwnd{nullptr};
- winrt::event<winrt::Windows::Foundation::TypedEventHandler<vorg_windows::ImportSelectionPage,
- winrt::Windows::Foundation::IInspectable>>
+ event<Windows::Foundation::TypedEventHandler<vorg_windows::ImportSelectionPage, Windows::Foundation::IInspectable>>
mSelectionFinishedEvent;
void initWndHandle();
M vorg-windows/LandingPage.xaml.cpp => vorg-windows/LandingPage.xaml.cpp +13 -17
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#include "pch.h"
#include "LandingPage.xaml.h"
@@ 18,8 15,8 @@ namespace winrt::vorg_windows::implementation
LandingPage::LandingPage()
{
InitializeComponent();
- mApp.copy_from(winrt::get_self<vorg_windows::implementation::App>(
- Application::Current().as<winrt::default_interface<vorg_windows::implementation::App>>()));
+ mApp.copy_from(get_self<vorg_windows::implementation::App>(
+ Application::Current().as<default_interface<vorg_windows::implementation::App>>()));
}
void LandingPage::openButton_Click(const IInspectable &, const RoutedEventArgs &)
@@ 32,19 29,18 @@ void LandingPage::createButton_Click(const IInspectable &, const RoutedEventArgs
launchFileChooser();
}
-winrt::event_token LandingPage::OpenRepo(
- const Windows::Foundation::TypedEventHandler<winrt::vorg_windows::LandingPage,
- winrt::Windows::Foundation::IInspectable> &handler)
+event_token LandingPage::OpenRepo(
+ const Windows::Foundation::TypedEventHandler<vorg_windows::LandingPage, Windows::Foundation::IInspectable> &handler)
{
return mOpenRepoEvent.add(handler);
}
-void LandingPage::OpenRepo(const winrt::event_token &token)
+void LandingPage::OpenRepo(const event_token &token)
{
mOpenRepoEvent.remove(token);
}
-winrt::fire_and_forget LandingPage::launchFileChooser()
+fire_and_forget LandingPage::launchFileChooser()
{
// If mHwnd is unitialized, initialize it
if (mHwnd == nullptr)
@@ 53,10 49,10 @@ winrt::fire_and_forget LandingPage::launchFileChooser()
}
// Launch file chooser
- winrt::Windows::Storage::Pickers::FolderPicker folderPicker;
- folderPicker.SuggestedStartLocation(winrt::Windows::Storage::Pickers::PickerLocationId::DocumentsLibrary);
+ Windows::Storage::Pickers::FolderPicker folderPicker;
+ folderPicker.SuggestedStartLocation(Windows::Storage::Pickers::PickerLocationId::DocumentsLibrary);
folderPicker.as<IInitializeWithWindow>()->Initialize(mHwnd);
- winrt::Windows::Storage::StorageFolder folder = co_await folderPicker.PickSingleFolderAsync();
+ Windows::Storage::StorageFolder folder = co_await folderPicker.PickSingleFolderAsync();
if (folder != nullptr)
{
@@ 64,9 60,9 @@ winrt::fire_and_forget LandingPage::launchFileChooser()
if (!mApp->OpenRepo(folder.Path()))
{
// Show dialog with error
- winrt::vorg_windows::ErrorContentDialog dialog;
- dialog.Title(winrt::box_value(L"Error opening Vorg repository"));
- dialog.Content(winrt::box_value(mApp->GetVorgError()));
+ vorg_windows::ErrorContentDialog dialog;
+ dialog.Title(box_value(L"Error opening Vorg repository"));
+ dialog.Content(box_value(mApp->GetVorgError()));
dialog.XamlRoot(XamlRoot());
co_await dialog.ShowAsync();
}
@@ 81,7 77,7 @@ winrt::fire_and_forget LandingPage::launchFileChooser()
void LandingPage::initWndHandle()
{
auto nativeWindow = mApp->mWindow.try_as<IWindowNative>();
- winrt::check_bool(nativeWindow);
+ check_bool(nativeWindow);
nativeWindow->get_WindowHandle(&mHwnd);
}
} // namespace winrt::vorg_windows::implementation
M vorg-windows/LandingPage.xaml.h => vorg-windows/LandingPage.xaml.h +6 -10
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#pragma once
#include "LandingPage.g.h"
@@ 19,22 16,21 @@ struct LandingPage : LandingPageT<LandingPage>
void createButton_Click(Windows::Foundation::IInspectable const &sender,
Microsoft::UI::Xaml::RoutedEventArgs const &args);
- winrt::event_token OpenRepo(const Windows::Foundation::TypedEventHandler<
- winrt::vorg_windows::LandingPage, winrt::Windows::Foundation::IInspectable> &handler);
- void OpenRepo(const winrt::event_token &token);
+ event_token OpenRepo(const Windows::Foundation::TypedEventHandler<vorg_windows::LandingPage,
+ Windows::Foundation::IInspectable> &handler);
+ void OpenRepo(const event_token &token);
private:
// Open Repo event
- winrt::event<
- Windows::Foundation::TypedEventHandler<winrt::vorg_windows::LandingPage, winrt::Windows::Foundation::IInspectable>>
+ event<Windows::Foundation::TypedEventHandler<vorg_windows::LandingPage, Windows::Foundation::IInspectable>>
mOpenRepoEvent;
// Members
- winrt::com_ptr<vorg_windows::implementation::App> mApp{nullptr};
+ com_ptr<vorg_windows::implementation::App> mApp{nullptr};
HWND mHwnd{nullptr};
// Helper functions
- winrt::fire_and_forget launchFileChooser();
+ fire_and_forget launchFileChooser();
void initWndHandle();
};
} // namespace winrt::vorg_windows::implementation
M vorg-windows/MainWindow.xaml.cpp => vorg-windows/MainWindow.xaml.cpp +11 -18
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#include "pch.h"
#include "MainWindow.xaml.h"
@@ 16,9 13,6 @@
using namespace winrt;
using namespace Microsoft::UI::Xaml;
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-
namespace winrt::vorg_windows::implementation
{
@@ 31,16 25,16 @@ MainWindow::MainWindow()
SetTitleBar(AppTitleBar());
// Initialize NavigationView map
- mNavigationTypeMap.emplace(L"Import", winrt::xaml_typename<vorg_windows::ImportPage>());
- mNavigationTypeMap.emplace(L"Browse", winrt::xaml_typename<vorg_windows::BrowsePage>());
- mNavigationTypeMap.emplace(L"Manage", winrt::xaml_typename<vorg_windows::ManagePage>());
+ mNavigationTypeMap.emplace(L"Import", xaml_typename<vorg_windows::ImportPage>());
+ mNavigationTypeMap.emplace(L"Browse", xaml_typename<vorg_windows::BrowsePage>());
+ mNavigationTypeMap.emplace(L"Manage", xaml_typename<vorg_windows::ManagePage>());
- mNavigationHeaderMap.emplace(L"Import", winrt::box_value(L"Import Video"));
- mNavigationHeaderMap.emplace(L"Browse", winrt::box_value(L"Browse Repository"));
- mNavigationHeaderMap.emplace(L"Manage", winrt::box_value(L"Manage Repository"));
+ mNavigationHeaderMap.emplace(L"Import", box_value(L"Import Video"));
+ mNavigationHeaderMap.emplace(L"Browse", box_value(L"Browse Repository"));
+ mNavigationHeaderMap.emplace(L"Manage", box_value(L"Manage Repository"));
// Navigate to LandingPage
- ContentFrame().Navigate(winrt::xaml_typename<vorg_windows::LandingPage>());
+ ContentFrame().Navigate(xaml_typename<vorg_windows::LandingPage>());
// Register OpenRepo handler
vorg_windows::LandingPage landingPage = ContentFrame().Content().as<vorg_windows::LandingPage>();
@@ 51,12 45,11 @@ MainWindow::MainWindow()
void MainWindow::NavigationView_ItemInvoked(const Controls::NavigationView &,
const Controls::NavigationViewItemInvokedEventArgs &args)
{
- const winrt::hstring &tag = args.InvokedItemContainer().Tag().as<winrt::hstring>();
+ const hstring &tag = args.InvokedItemContainer().Tag().as<hstring>();
ContentFrame().Navigate(mNavigationTypeMap.at(tag));
}
-void MainWindow::LandingPage_OpenRepo(const winrt::vorg_windows::LandingPage &,
- const winrt::Windows::Foundation::IInspectable &)
+void MainWindow::LandingPage_OpenRepo(const vorg_windows::LandingPage &, const Windows::Foundation::IInspectable &)
{
// Remove OpenRepo handler
vorg_windows::LandingPage landingPage = ContentFrame().Content().as<vorg_windows::LandingPage>();
@@ 66,9 59,9 @@ void MainWindow::LandingPage_OpenRepo(const winrt::vorg_windows::LandingPage &,
ContentFrame().Navigate(mNavigationTypeMap.at(L"Import"));
// Re-enable all navigation items
- for (const winrt::Windows::Foundation::IInspectable &child : NavigationView().MenuItems())
+ for (const Windows::Foundation::IInspectable &child : NavigationView().MenuItems())
{
- child.as<winrt::Microsoft::UI::Xaml::Controls::NavigationViewItem>().IsEnabled(true);
+ child.as<Microsoft::UI::Xaml::Controls::NavigationViewItem>().IsEnabled(true);
}
// Select ImportPage
M vorg-windows/MainWindow.xaml.h => vorg-windows/MainWindow.xaml.h +4 -8
@@ 1,6 1,3 @@
-// Copyright (c) Microsoft Corporation and Contributors.
-// Licensed under the MIT License.
-
#pragma once
#include "MainWindow.g.h"
@@ 18,13 15,12 @@ struct MainWindow : MainWindowT<MainWindow>
void NavigationView_ItemInvoked(const Microsoft::UI::Xaml::Controls::NavigationView &sender,
const Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs &args);
- void LandingPage_OpenRepo(const winrt::vorg_windows::LandingPage &,
- const winrt::Windows::Foundation::IInspectable &);
+ void LandingPage_OpenRepo(const vorg_windows::LandingPage &, const Windows::Foundation::IInspectable &);
private:
- winrt::event_token mOpenRepoEventToken;
- std::map<winrt::hstring, winrt::Windows::UI::Xaml::Interop::TypeName> mNavigationTypeMap;
- std::map<winrt::hstring, winrt::Windows::Foundation::IInspectable> mNavigationHeaderMap;
+ event_token mOpenRepoEventToken;
+ std::map<hstring, Windows::UI::Xaml::Interop::TypeName> mNavigationTypeMap;
+ std::map<hstring, Windows::Foundation::IInspectable> mNavigationHeaderMap;
};
} // namespace winrt::vorg_windows::implementation