~haowenl/vorg-windows

5ebce7eba8793ad72fca35835d823d01a15318fe — Haowen Liu 11 months ago 0893a2f
Basic import UI
A .clang-format => .clang-format +1 -0
@@ 0,0 1,1 @@
BasedOnStyle: Microsoft
\ No newline at end of file

M vorg-windows/App.idl => vorg-windows/App.idl +1 -1
@@ 3,4 3,4 @@

namespace vorg_windows
{
}
} // namespace vorg_windows

M vorg-windows/App.xaml.cpp => vorg-windows/App.xaml.cpp +16 -5
@@ 4,6 4,7 @@
#include "pch.h"

#include "App.xaml.h"

#include "MainWindow.xaml.h"

using namespace winrt;


@@ 17,6 18,8 @@ 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>
/// Initializes the singleton application object.  This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().


@@ 26,8 29,7 @@ App::App()
    InitializeComponent();

#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
    UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e)
    {
    UnhandledException([this](IInspectable const &, UnhandledExceptionEventArgs const &e) {
        if (IsDebuggerPresent())
        {
            auto errorMessage = e.Message();


@@ 41,8 43,17 @@ App::App()
/// Invoked when the application is launched.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
void App::OnLaunched(LaunchActivatedEventArgs const&)
void App::OnLaunched(LaunchActivatedEventArgs const &)
{
    mWindow = make<MainWindow>();
    mWindow.Activate();
}

void App::CreateRepo()
{
}

void App::OpenRepo()
{
    window = make<MainWindow>();
    window.Activate();
}
} // namespace winrt::vorg_windows::implementation

M vorg-windows/App.xaml.h => vorg-windows/App.xaml.h +12 -8
@@ 7,13 7,17 @@

namespace winrt::vorg_windows::implementation
{
    struct App : AppT<App>
    {
        App();
struct App : AppT<App>
{
    App();

    void OnLaunched(Microsoft::UI::Xaml::LaunchActivatedEventArgs const &);

        void OnLaunched(Microsoft::UI::Xaml::LaunchActivatedEventArgs const&);
    // App logics
    void CreateRepo();
    void OpenRepo();

    private:
        winrt::Microsoft::UI::Xaml::Window window{ nullptr };
    };
}
    // Members
    winrt::Microsoft::UI::Xaml::Window mWindow{nullptr};
};
} // namespace winrt::vorg_windows::implementation

A vorg-windows/BrowsePage.idl => vorg-windows/BrowsePage.idl +11 -0
@@ 0,0 1,11 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

namespace vorg_windows
{
[default_interface] runtimeclass BrowsePage : Microsoft.UI.Xaml.Controls.Page
{
    BrowsePage();
    Int32 MyProperty;
}
} // namespace vorg_windows

A vorg-windows/BrowsePage.xaml => vorg-windows/BrowsePage.xaml +16 -0
@@ 0,0 1,16 @@
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->

<Page
    x:Class="vorg_windows.BrowsePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:vorg_windows"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
    </StackPanel>
</Page>

A vorg-windows/BrowsePage.xaml.cpp => vorg-windows/BrowsePage.xaml.cpp +38 -0
@@ 0,0 1,38 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"

#include "BrowsePage.xaml.h"
#if __has_include("BrowsePage.g.cpp")
#include "BrowsePage.g.cpp"
#endif

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
{
BrowsePage::BrowsePage()
{
    InitializeComponent();
}

int32_t BrowsePage::MyProperty()
{
    throw hresult_not_implemented();
}

void BrowsePage::MyProperty(int32_t /* value */)
{
    throw hresult_not_implemented();
}

void BrowsePage::myButton_Click(IInspectable const &, RoutedEventArgs const &)
{
    myButton().Content(box_value(L"Clicked"));
}
} // namespace winrt::vorg_windows::implementation

A vorg-windows/BrowsePage.xaml.h => vorg-windows/BrowsePage.xaml.h +27 -0
@@ 0,0 1,27 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once

#include "BrowsePage.g.h"

namespace winrt::vorg_windows::implementation
{
struct BrowsePage : BrowsePageT<BrowsePage>
{
    BrowsePage();

    int32_t MyProperty();
    void MyProperty(int32_t value);

    void myButton_Click(Windows::Foundation::IInspectable const &sender,
                        Microsoft::UI::Xaml::RoutedEventArgs const &args);
};
} // namespace winrt::vorg_windows::implementation

namespace winrt::vorg_windows::factory_implementation
{
struct BrowsePage : BrowsePageT<BrowsePage, implementation::BrowsePage>
{
};
} // namespace winrt::vorg_windows::factory_implementation

A vorg-windows/ImportPage.idl => vorg-windows/ImportPage.idl +18 -0
@@ 0,0 1,18 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

namespace vorg_windows
{
[default_interface] runtimeclass ImportPage : Microsoft.UI.Xaml.Controls.Page
{
    ImportPage();
    Windows.Foundation.Collections.IObservableVector<String> Actors
    {
        get;
    };
    Windows.Foundation.Collections.IObservableVector<String> Tags
    {
        get;
    };
}
} // namespace vorg_windows

A vorg-windows/ImportPage.xaml => vorg-windows/ImportPage.xaml +193 -0
@@ 0,0 1,193 @@
<!--  Copyright (c) Microsoft Corporation and Contributors.  -->
<!--  Licensed under the MIT License.  -->

<Page
    x:Class="vorg_windows.ImportPage"
    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:vorg_windows"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <StackPanel
        Margin="0,44,0,44"
        HorizontalAlignment="Left"
        VerticalAlignment="Top"
        Orientation="Vertical">
        <Grid
            Height="40"
            Margin="0,0,0,22"
            VerticalAlignment="Top"
            Background="Transparent">
            <TextBlock
                VerticalAlignment="Center"
                FontSize="22"
                Style="{StaticResource TitleTextBlockStyle}"
                Text="Import Video" />
        </Grid>

        <MediaPlayerElement AreTransportControlsEnabled="True" Source="https://samplelib.com/lib/preview/mp4/sample-5s.mp4" />

        <Grid
            Margin="0,16,0,0"
            ColumnSpacing="16"
            RowSpacing="8">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <!--  Title  -->
            <TextBlock Grid.Row="0" Grid.Column="0">Title</TextBlock>
            <TextBox Grid.Row="1" Grid.Column="0" />

            <!--  Studio  -->
            <TextBlock Grid.Row="0" Grid.Column="1">Studio</TextBlock>
            <AutoSuggestBox Grid.Row="1" Grid.Column="1" />
        </Grid>

        <Grid
            Margin="0,16,0,0"
            ColumnSpacing="16"
            RowSpacing="8">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <!--  Actors  -->
            <TextBlock Grid.Row="0" Grid.Column="0">Actors</TextBlock>
            <Grid
                Grid.Row="1"
                Grid.Column="0"
                ColumnSpacing="8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <AutoSuggestBox
                    x:Name="ActorNameInput"
                    Grid.Column="0"
                    HorizontalAlignment="Stretch" />
                <Button
                    x:Name="ActorsSubmitButton"
                    Grid.Column="1"
                    VerticalAlignment="Stretch"
                    Click="ActorsSubmitButton_Click"
                    Content="&#xE710;"
                    FontFamily="Segoe MDL2 Assets" />
            </Grid>
            <ListView
                Grid.Row="2"
                Grid.Column="0"
                ItemsSource="{x:Bind Actors}"
                SelectionMode="Single">
                <ItemsControl.ItemTemplate>
                    <DataTemplate x:DataType="x:String">
                        <UserControl PointerEntered="UserControl_PointerEntered" PointerExited="UserControl_PointerExited">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <TextBlock
                                    Grid.Column="0"
                                    VerticalAlignment="Center"
                                    Text="{x:Bind}" />
                                <Button
                                    x:Name="ActorsDeleteButton"
                                    Grid.Column="1"
                                    Click="ActorsDeleteButton_Click"
                                    Content="&#xE711;"
                                    FontFamily="Segoe MDL2 Assets"
                                    Visibility="Collapsed" />
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="HoverButtonsHidden" />
                                        <VisualState x:Name="HoverButtonsShown">
                                            <VisualState.Setters>
                                                <Setter Target="ActorsDeleteButton.Visibility" Value="Visible" />
                                            </VisualState.Setters>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                            </Grid>
                        </UserControl>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ListView>

            <!--  Tags  -->
            <TextBlock Grid.Row="0" Grid.Column="1">Tags</TextBlock>
            <Grid
                Grid.Row="1"
                Grid.Column="1"
                ColumnSpacing="8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <AutoSuggestBox
                    x:Name="TagNameInput"
                    Grid.Column="0"
                    HorizontalAlignment="Stretch" />
                <Button
                    x:Name="TagsSubmitButton"
                    Grid.Column="1"
                    VerticalAlignment="Stretch"
                    Click="TagsSubmitButton_Click"
                    Content="&#xE710;"
                    FontFamily="Segoe MDL2 Assets" />
            </Grid>
            <ListView
                Grid.Row="2"
                Grid.Column="1"
                ItemsSource="{x:Bind Tags}"
                SelectionMode="Single">
                <ItemsControl.ItemTemplate>
                    <DataTemplate x:DataType="x:String">
                        <UserControl PointerEntered="UserControl_PointerEntered" PointerExited="UserControl_PointerExited">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <TextBlock
                                    Grid.Column="0"
                                    VerticalAlignment="Center"
                                    Text="{x:Bind}" />
                                <Button
                                    x:Name="TagsDeleteButton"
                                    Grid.Column="1"
                                    Click="TagsDeleteButton_Click"
                                    Content="&#xE711;"
                                    FontFamily="Segoe MDL2 Assets"
                                    Visibility="Collapsed" />
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="HoverButtonsHidden" />
                                        <VisualState x:Name="HoverButtonsShown">
                                            <VisualState.Setters>
                                                <Setter Target="TagsDeleteButton.Visibility" Value="Visible" />
                                            </VisualState.Setters>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                            </Grid>
                        </UserControl>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ListView>
        </Grid>
    </StackPanel>
</Page>

A vorg-windows/ImportPage.xaml.cpp => vorg-windows/ImportPage.xaml.cpp +116 -0
@@ 0,0 1,116 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"

#include "ImportPage.xaml.h"
#if __has_include("ImportPage.g.cpp")
#include "ImportPage.g.cpp"
#endif

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
{
ImportPage::ImportPage()
    : mActors(winrt::single_threaded_observable_vector<winrt::hstring>()),
      mTags(winrt::single_threaded_observable_vector<winrt::hstring>())
{
    InitializeComponent();
    mActors.Append(L"ABC");
    mActors.Append(L"DEF");
    mTags.Append(L"ABC");
}

winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> ImportPage::Actors()
{
    return mActors;
}

winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> ImportPage::Tags()
{
    return mTags;
}

void ImportPage::UserControl_PointerEntered(const winrt::Windows::Foundation::IInspectable &sender,
                                            const winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &)
{
    winrt::Microsoft::UI::Xaml::Controls::UserControl userControl =
        sender.as<winrt::Microsoft::UI::Xaml::Controls::UserControl>();
    VisualStateManager::GoToState(userControl, L"HoverButtonsShown", false);
}

void ImportPage::UserControl_PointerExited(const winrt::Windows::Foundation::IInspectable &sender,
                                           const winrt::Microsoft::UI::Xaml::Input::PointerRoutedEventArgs &)
{
    winrt::Microsoft::UI::Xaml::Controls::UserControl userControl =
        sender.as<winrt::Microsoft::UI::Xaml::Controls::UserControl>();
    VisualStateManager::GoToState(userControl, L"HoverButtonsHidden", false);
}

void ImportPage::ActorsDeleteButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
                                          winrt::Microsoft::UI::Xaml::RoutedEventArgs const &)
{
    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>();
    DelteFromVector(mActors, itemName);
}

void ImportPage::TagsDeleteButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
                                        winrt::Microsoft::UI::Xaml::RoutedEventArgs const &)
{
    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>();
    DelteFromVector(mTags, itemName);
}

void ImportPage::ActorsSubmitButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
                                          winrt::Microsoft::UI::Xaml::RoutedEventArgs const &)
{
    winrt::hstring actorName = ActorNameInput().Text();
    if (!FindInVector(mActors, actorName))
        mActors.Append(actorName);
    ActorNameInput().Text(L"");
}

void ImportPage::TagsSubmitButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
                                        winrt::Microsoft::UI::Xaml::RoutedEventArgs const &)
{
    winrt::hstring tagName = TagNameInput().Text();
    if (!FindInVector(mTags, tagName))
        mTags.Append(tagName);
    TagNameInput().Text(L"");
}

void ImportPage::DelteFromVector(winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &vector,
                                 const winrt::hstring &item)
{
    for (size_t i = 0; i < vector.Size(); ++i)
    {
        if (vector.GetAt(i) == item)
        {
            vector.RemoveAt(i);
            return;
        }
    }
}

bool ImportPage::FindInVector(winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &vector,
                              const winrt::hstring &item)
{
    for (size_t i = 0; i < vector.Size(); ++i)
    {
        if (vector.GetAt(i) == item)
        {
            return true;
        }
    }
    return false;
}
} // namespace winrt::vorg_windows::implementation

A vorg-windows/ImportPage.xaml.h => vorg-windows/ImportPage.xaml.h +47 -0
@@ 0,0 1,47 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once

#include "ImportPage.g.h"

namespace winrt::vorg_windows::implementation
{
struct ImportPage : ImportPageT<ImportPage>
{
    ImportPage();

    winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> Actors();
    winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> Tags();

    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(winrt::Windows::Foundation::IInspectable const &sender,
                                  winrt::Microsoft::UI::Xaml::RoutedEventArgs const &e);
    void TagsDeleteButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
                                winrt::Microsoft::UI::Xaml::RoutedEventArgs const &e);

    void ActorsSubmitButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
                                  winrt::Microsoft::UI::Xaml::RoutedEventArgs const &e);
    void TagsSubmitButton_Click(winrt::Windows::Foundation::IInspectable const &sender,
                                winrt::Microsoft::UI::Xaml::RoutedEventArgs const &e);

  private:
    winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> mActors;
    winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> mTags;

    void DelteFromVector(winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &vector,
                         const winrt::hstring &item);
    bool FindInVector(winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> &vector,
                         const winrt::hstring &item);
};
} // namespace winrt::vorg_windows::implementation

namespace winrt::vorg_windows::factory_implementation
{
struct ImportPage : ImportPageT<ImportPage, implementation::ImportPage>
{
};
} // namespace winrt::vorg_windows::factory_implementation

A vorg-windows/LandingPage.idl => vorg-windows/LandingPage.idl +12 -0
@@ 0,0 1,12 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

namespace vorg_windows
{
[default_interface] runtimeclass LandingPage : Microsoft.UI.Xaml.Controls.Page
{
    LandingPage();

    event Windows.Foundation.TypedEventHandler<LandingPage, Object> OpenRepo;
};
} // namespace vorg_windows

A vorg-windows/LandingPage.xaml => vorg-windows/LandingPage.xaml +50 -0
@@ 0,0 1,50 @@
<!--  Copyright (c) Microsoft Corporation and Contributors.  -->
<!--  Licensed under the MIT License.  -->

<Page
    x:Class="vorg_windows.LandingPage"
    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:vorg_windows"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <Grid
            Height="40"
            Margin="0,44,0,22"
            VerticalAlignment="Top"
            Background="Transparent">
            <TextBlock
                VerticalAlignment="Center"
                FontSize="22"
                Style="{StaticResource TitleTextBlockStyle}"
                Text="Open a Vorg Repository" />
        </Grid>
        <StackPanel
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Orientation="Horizontal"
            Spacing="32">
            <Button Width="128" Click="openButton_Click">
                <StackPanel Padding="0,8,0,2" Spacing="4">
                    <FontIcon
                        FontFamily="Segoe MDL2 Assets"
                        FontSize="32"
                        Glyph="&#xE838;" />
                    <TextBlock>Open Existing</TextBlock>
                </StackPanel>
            </Button>
            <Button Width="128" Click="createButton_Click">
                <StackPanel Padding="0,8,0,2" Spacing="4">
                    <FontIcon
                        FontFamily="Segoe MDL2 Assets"
                        FontSize="32"
                        Glyph="&#xE8F4;" />
                    <TextBlock>Create New</TextBlock>
                </StackPanel>
            </Button>
        </StackPanel>
    </Grid>
</Page>

A vorg-windows/LandingPage.xaml.cpp => vorg-windows/LandingPage.xaml.cpp +90 -0
@@ 0,0 1,90 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"

#include "LandingPage.xaml.h"
#if __has_include("LandingPage.g.cpp")
#include "LandingPage.g.cpp"
#endif

using namespace winrt;
using namespace Microsoft::UI::Xaml;

namespace winrt::vorg_windows::implementation
{
LandingPage::LandingPage()
{
    InitializeComponent();
}

void LandingPage::openButton_Click(const IInspectable &, const RoutedEventArgs &)
{
    launchFileChooser(false);
}

void LandingPage::createButton_Click(const IInspectable &, const RoutedEventArgs &)
{
    launchFileChooser(true);
}

winrt::event_token LandingPage::OpenRepo(
    const Windows::Foundation::TypedEventHandler<winrt::vorg_windows::LandingPage,
                                                 winrt::Windows::Foundation::IInspectable> &handler)
{
    return mOpenRepoEvent.add(handler);
}

void LandingPage::OpenRepo(const winrt::event_token &token)
{
    mOpenRepoEvent.remove(token);
}

winrt::fire_and_forget LandingPage::launchFileChooser(bool createNew)
{
    // If mHwnd is unitialized, initialize it
    if (mHwnd == nullptr)
    {
        initWndHandle();
    }

    // Launch file chooser
    winrt::Windows::Storage::Pickers::FolderPicker folderPicker;
    folderPicker.SuggestedStartLocation(winrt::Windows::Storage::Pickers::PickerLocationId::DocumentsLibrary);
    folderPicker.as<IInitializeWithWindow>()->Initialize(mHwnd);
    winrt::Windows::Storage::StorageFolder folder = co_await folderPicker.PickSingleFolderAsync();

    if (folder != nullptr)
    {
        // Perform requested action
        if (createNew)
        {
            mApp->CreateRepo();
        }
        else
        {
            mApp->OpenRepo();
        }

        // Fire open repo event
        mOpenRepoEvent(*this, nullptr);
    }
}

void LandingPage::initAppPtr()
{
    mApp.copy_from(winrt::get_self<vorg_windows::implementation::App>(
        Application::Current().as<winrt::default_interface<vorg_windows::implementation::App>>()));
}

void LandingPage::initWndHandle()
{
    if (mApp == nullptr)
    {
        initAppPtr();
    }
    auto nativeWindow = mApp->mWindow.try_as<IWindowNative>();
    winrt::check_bool(nativeWindow);
    nativeWindow->get_WindowHandle(&mHwnd);
}
} // namespace winrt::vorg_windows::implementation

A vorg-windows/LandingPage.xaml.h => vorg-windows/LandingPage.xaml.h +48 -0
@@ 0,0 1,48 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once

#include "LandingPage.g.h"

#include "App.xaml.h"

namespace winrt::vorg_windows::implementation
{
struct LandingPage : LandingPageT<LandingPage>
{
  public:
    LandingPage();

    void openButton_Click(Windows::Foundation::IInspectable const &sender,
                          Microsoft::UI::Xaml::RoutedEventArgs const &args);
    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);

  private:
    // Open Repo event
    winrt::event<
        Windows::Foundation::TypedEventHandler<winrt::vorg_windows::LandingPage, winrt::Windows::Foundation::IInspectable>>
        mOpenRepoEvent;

    // Members
    winrt::com_ptr<vorg_windows::implementation::App> mApp{nullptr};
    HWND mHwnd{nullptr};

    // Helper functions
    winrt::fire_and_forget launchFileChooser(bool createNew);
    void initAppPtr();
    void initWndHandle();
};
} // namespace winrt::vorg_windows::implementation

namespace winrt::vorg_windows::factory_implementation
{
struct LandingPage : LandingPageT<LandingPage, implementation::LandingPage>
{
};
} // namespace winrt::vorg_windows::factory_implementation

M vorg-windows/MainWindow.idl => vorg-windows/MainWindow.idl +4 -5
@@ 3,9 3,8 @@

namespace vorg_windows
{
    [default_interface]
    runtimeclass MainWindow : Microsoft.UI.Xaml.Window
    {
        MainWindow();
    }
[default_interface] runtimeclass MainWindow : Microsoft.UI.Xaml.Window
{
    MainWindow();
}
} // namespace vorg_windows

M vorg-windows/MainWindow.xaml => vorg-windows/MainWindow.xaml +24 -31
@@ 39,43 39,36 @@
        </Border>

        <NavigationView
            x:Name="NavigationViewControl"
            x:Name="NavigationView"
            AlwaysShowHeader="True"
            Background="{StaticResource NavigationViewDefaultPaneBackground}"
            Header="Default Header"
            IsBackButtonVisible="Collapsed"
            IsSettingsVisible="False"
            IsTabStop="False"
            IsTitleBarAutoPaddingEnabled="False">
            <NavigationView.HeaderTemplate>
                <DataTemplate>
                    <Grid Margin="0,-10,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid
                            x:Name="pageTitle"
                            Height="44"
                            VerticalAlignment="Top"
                            Background="Transparent">
                            <TextBlock
                                x:Name="title"
                                VerticalAlignment="Center"
                                FontSize="24"
                                Style="{StaticResource TitleTextBlockStyle}"
                                Text="{Binding}" />
                        </Grid>
                    </Grid>
                </DataTemplate>
            </NavigationView.HeaderTemplate>
            IsTitleBarAutoPaddingEnabled="False"
            ItemInvoked="NavigationView_ItemInvoked"
            OpenPaneLength="256">
            <NavigationView.MenuItems>
                <NavigationViewItem Content="Import" Icon="Import" />
                <NavigationViewItem Content="Browse" Icon="ViewAll" />
                <NavigationViewItem
                    x:Name="ImportItem"
                    Content="Import"
                    Icon="Import"
                    IsEnabled="False"
                    Tag="Import" />
                <NavigationViewItem
                    Content="Browse"
                    Icon="ViewAll"
                    IsEnabled="False"
                    Tag="Browse" />
                <NavigationViewItem
                    Content="Manage"
                    Icon="Setting"
                    IsEnabled="False"
                    Tag="Manage" />
            </NavigationView.MenuItems>
            <NavigationView.FooterMenuItems>
                <NavigationViewItem Content="Settings" Icon="Setting" />
            </NavigationView.FooterMenuItems>
            <Frame x:Name="ContentFrame" Padding="55,10,0,0" />
            <ScrollViewer>
                <Frame x:Name="ContentFrame" Padding="55,10,55,0" />
            </ScrollViewer>
        </NavigationView>
    </Grid>
</Window>

M vorg-windows/MainWindow.xaml.cpp => vorg-windows/MainWindow.xaml.cpp +58 -4
@@ 2,11 2,17 @@
// Licensed under the MIT License.

#include "pch.h"

#include "MainWindow.xaml.h"
#if __has_include("MainWindow.g.cpp")
#include "MainWindow.g.cpp"
#endif

#include "BrowsePage.xaml.h"
#include "ImportPage.xaml.h"
#include "LandingPage.xaml.h"
#include "ManagePage.xaml.h"

using namespace winrt;
using namespace Microsoft::UI::Xaml;



@@ 15,10 21,58 @@ using namespace Microsoft::UI::Xaml;

namespace winrt::vorg_windows::implementation
{
    MainWindow::MainWindow()

MainWindow::MainWindow()
{
    InitializeComponent();

    // Titlebar
    ExtendsContentIntoTitleBar(true);
    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>());

    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"));

    // Navigate to LandingPage
    ContentFrame().Navigate(winrt::xaml_typename<vorg_windows::LandingPage>());

    // Register OpenRepo handler
    vorg_windows::LandingPage landingPage = ContentFrame().Content().as<vorg_windows::LandingPage>();
    mLandingPageOpenRepoToken =
        landingPage.OpenRepo([this](auto &sender, auto &args) { this->LandingPage_OpenRepo(sender, args); });
}

void MainWindow::NavigationView_ItemInvoked(const Controls::NavigationView &,
                                            const Controls::NavigationViewItemInvokedEventArgs &args)
{
    const winrt::hstring &tag = args.InvokedItemContainer().Tag().as<winrt::hstring>();
    ContentFrame().Navigate(mNavigationTypeMap.at(tag));
    // NavigationView().Header(mNavigationHeaderMap.at(tag));
}

void MainWindow::LandingPage_OpenRepo(const winrt::vorg_windows::LandingPage &,
                                      const winrt::Windows::Foundation::IInspectable &)
{
    // Remove OpenRepo handler
    vorg_windows::LandingPage landingPage = ContentFrame().Content().as<vorg_windows::LandingPage>();
    landingPage.OpenRepo(mLandingPageOpenRepoToken);

    // Navigate to ImportPage
    ContentFrame().Navigate(mNavigationTypeMap.at(L"Import"));

    // Re-enable all navigation items
    for (const winrt::Windows::Foundation::IInspectable &child : NavigationView().MenuItems())
    {
        InitializeComponent();
        ExtendsContentIntoTitleBar(true);
        SetTitleBar(AppTitleBar());
        child.as<winrt::Microsoft::UI::Xaml::Controls::NavigationViewItem>().IsEnabled(true);
    }

    // Select ImportPage
    ImportItem().IsSelected(true);
}
} // namespace winrt::vorg_windows::implementation

M vorg-windows/MainWindow.xaml.h => vorg-windows/MainWindow.xaml.h +24 -9
@@ 5,17 5,32 @@

#include "MainWindow.g.h"

#include "LandingPage.xaml.h"

#include <map>

namespace winrt::vorg_windows::implementation
{
    struct MainWindow : MainWindowT<MainWindow>
    {
        MainWindow();
    };
}
struct MainWindow : MainWindowT<MainWindow>
{
    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 &sender,
                              const winrt::Windows::Foundation::IInspectable &args);

  private:
    winrt::event_token mLandingPageOpenRepoToken;
    std::map<winrt::hstring, winrt::Windows::UI::Xaml::Interop::TypeName> mNavigationTypeMap;
    std::map<winrt::hstring, winrt::Windows::Foundation::IInspectable> mNavigationHeaderMap;
};
} // namespace winrt::vorg_windows::implementation

namespace winrt::vorg_windows::factory_implementation
{
    struct MainWindow : MainWindowT<MainWindow, implementation::MainWindow>
    {
    };
}
struct MainWindow : MainWindowT<MainWindow, implementation::MainWindow>
{
};
} // namespace winrt::vorg_windows::factory_implementation

A vorg-windows/ManagePage.idl => vorg-windows/ManagePage.idl +11 -0
@@ 0,0 1,11 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

namespace vorg_windows
{
[default_interface] runtimeclass ManagePage : Microsoft.UI.Xaml.Controls.Page
{
    ManagePage();
    Int32 MyProperty;
}
} // namespace vorg_windows

A vorg-windows/ManagePage.xaml => vorg-windows/ManagePage.xaml +16 -0
@@ 0,0 1,16 @@
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->

<Page
    x:Class="vorg_windows.ManagePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:vorg_windows"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
    </StackPanel>
</Page>

A vorg-windows/ManagePage.xaml.cpp => vorg-windows/ManagePage.xaml.cpp +38 -0
@@ 0,0 1,38 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"

#include "ManagePage.xaml.h"
#if __has_include("ManagePage.g.cpp")
#include "ManagePage.g.cpp"
#endif

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
{
ManagePage::ManagePage()
{
    InitializeComponent();
}

int32_t ManagePage::MyProperty()
{
    throw hresult_not_implemented();
}

void ManagePage::MyProperty(int32_t /* value */)
{
    throw hresult_not_implemented();
}

void ManagePage::myButton_Click(IInspectable const &, RoutedEventArgs const &)
{
    myButton().Content(box_value(L"Clicked"));
}
} // namespace winrt::vorg_windows::implementation

A vorg-windows/ManagePage.xaml.h => vorg-windows/ManagePage.xaml.h +27 -0
@@ 0,0 1,27 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once

#include "ManagePage.g.h"

namespace winrt::vorg_windows::implementation
{
struct ManagePage : ManagePageT<ManagePage>
{
    ManagePage();

    int32_t MyProperty();
    void MyProperty(int32_t value);

    void myButton_Click(Windows::Foundation::IInspectable const &sender,
                        Microsoft::UI::Xaml::RoutedEventArgs const &args);
};
} // namespace winrt::vorg_windows::implementation

namespace winrt::vorg_windows::factory_implementation
{
struct ManagePage : ManagePageT<ManagePage, implementation::ManagePage>
{
};
} // namespace winrt::vorg_windows::factory_implementation

M vorg-windows/pch.h => vorg-windows/pch.h +15 -10
@@ 2,27 2,32 @@
// Licensed under the MIT License.

#pragma once
#include <windows.h>
#include <unknwn.h>
#include <restrictederrorinfo.h>
#include <hstring.h>
#include <restrictederrorinfo.h>
#include <unknwn.h>
#include <windows.h>

// Undefine GetCurrentTime macro to prevent
// conflict with Storyboard::GetCurrentTime
#undef GetCurrentTime

#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.ApplicationModel.Activation.h>
#include <microsoft.ui.xaml.window.h>
#include <shobjidl.h>
#include <wil/cppwinrt_helpers.h>
#include <winrt/Microsoft.UI.Composition.h>
#include <winrt/Microsoft.UI.Xaml.h>
#include <winrt/Microsoft.UI.Xaml.Controls.h>
#include <winrt/Microsoft.UI.Dispatching.h>
#include <winrt/Microsoft.UI.Xaml.Controls.Primitives.h>
#include <winrt/Microsoft.UI.Xaml.Controls.h>
#include <winrt/Microsoft.UI.Xaml.Data.h>
#include <winrt/Microsoft.UI.Xaml.Input.h>
#include <winrt/Microsoft.UI.Xaml.Interop.h>
#include <winrt/Microsoft.UI.Xaml.Markup.h>
#include <winrt/Microsoft.UI.Xaml.Media.h>
#include <winrt/Microsoft.UI.Xaml.Navigation.h>
#include <winrt/Microsoft.UI.Xaml.Shapes.h>
#include <winrt/Microsoft.UI.Dispatching.h>
#include <wil/cppwinrt_helpers.h>
#include <winrt/Microsoft.UI.Xaml.h>
#include <winrt/Windows.ApplicationModel.Activation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Storage.Pickers.h>
#include <winrt/Windows.UI.Xaml.Interop.h>

M vorg-windows/vorg-windows.vcxproj => vorg-windows/vorg-windows.vcxproj +61 -0
@@ 107,6 107,22 @@
    <Manifest Include="app.manifest" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="BrowsePage.xaml.h">
      <DependentUpon>BrowsePage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </ClInclude>
    <ClInclude Include="ImportPage.xaml.h">
      <DependentUpon>ImportPage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </ClInclude>
    <ClInclude Include="LandingPage.xaml.h">
      <DependentUpon>LandingPage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </ClInclude>
    <ClInclude Include="ManagePage.xaml.h">
      <DependentUpon>ManagePage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </ClInclude>
    <ClInclude Include="pch.h" />
    <ClInclude Include="App.xaml.h">
      <DependentUpon>App.xaml</DependentUpon>


@@ 117,9 133,37 @@
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="App.xaml" />
    <Page Include="BrowsePage.xaml">
      <SubType>Designer</SubType>
    </Page>
    <Page Include="ImportPage.xaml">
      <SubType>Designer</SubType>
    </Page>
    <Page Include="LandingPage.xaml">
      <SubType>Designer</SubType>
    </Page>
    <Page Include="MainWindow.xaml" />
    <Page Include="ManagePage.xaml">
      <SubType>Designer</SubType>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="BrowsePage.xaml.cpp">
      <DependentUpon>BrowsePage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </ClCompile>
    <ClCompile Include="ImportPage.xaml.cpp">
      <DependentUpon>ImportPage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </ClCompile>
    <ClCompile Include="LandingPage.xaml.cpp">
      <DependentUpon>LandingPage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </ClCompile>
    <ClCompile Include="ManagePage.xaml.cpp">
      <DependentUpon>ManagePage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </ClCompile>
    <ClCompile Include="pch.cpp">
      <PrecompiledHeader>Create</PrecompiledHeader>
    </ClCompile>


@@ 136,10 180,26 @@
      <SubType>Code</SubType>
      <DependentUpon>App.xaml</DependentUpon>
    </Midl>
    <Midl Include="BrowsePage.idl">
      <DependentUpon>BrowsePage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Midl>
    <Midl Include="ImportPage.idl">
      <DependentUpon>ImportPage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Midl>
    <Midl Include="LandingPage.idl">
      <DependentUpon>LandingPage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Midl>
    <Midl Include="MainWindow.idl">
      <SubType>Code</SubType>
      <DependentUpon>MainWindow.xaml</DependentUpon>
    </Midl>
    <Midl Include="ManagePage.idl">
      <DependentUpon>ManagePage.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Midl>
  </ItemGroup>
  <ItemGroup>
    <Text Include="readme.txt">


@@ 164,6 224,7 @@
    <ProjectCapability Include="Msix" />
  </ItemGroup>
  <ItemGroup>
    <None Include="..\.clang-format" />
    <None Include="packages.config" />
  </ItemGroup>
  <!--

M vorg-windows/vorg-windows.vcxproj.filters => vorg-windows/vorg-windows.vcxproj.filters +8 -0
@@ 5,6 5,10 @@
  </ItemGroup>
  <ItemGroup>
    <Page Include="MainWindow.xaml" />
    <Page Include="ImportPage.xaml" />
    <Page Include="LandingPage.xaml" />
    <Page Include="BrowsePage.xaml" />
    <Page Include="ManagePage.xaml" />
  </ItemGroup>
  <ItemGroup>
    <Midl Include="App.idl" />


@@ 56,5 60,9 @@
  </ItemGroup>
  <ItemGroup>
    <None Include="packages.config" />
    <None Include="..\.clang-format" />
  </ItemGroup>
  <ItemGroup>
    <Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis" />
  </ItemGroup>
</Project>
\ No newline at end of file