-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
1,292 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// clang-format off | ||
#include "pch.h" | ||
#include "BindableBase.h" | ||
#include "BindableBase.g.cpp" | ||
// clang-format on | ||
|
||
using namespace winrt::Microsoft::UI::Xaml::Data; | ||
|
||
namespace winrt::OobSimulator::implementation | ||
{ | ||
void | ||
BindableBase::RaisePropertyChanged(hstring const& propertyName) | ||
{ | ||
m_propertyChanged(*this, PropertyChangedEventArgs(propertyName)); | ||
} | ||
|
||
winrt::event_token | ||
BindableBase::PropertyChanged(PropertyChangedEventHandler const& handler) | ||
{ | ||
return m_propertyChanged.add(handler); | ||
} | ||
|
||
void | ||
BindableBase::PropertyChanged(winrt::event_token const& token) noexcept | ||
{ | ||
m_propertyChanged.remove(token); | ||
} | ||
} // namespace winrt::OobSimulator::implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef BINDABLE_BASE_H | ||
#define BINDABLE_BASE_H | ||
|
||
#include "BindableBase.g.h" | ||
|
||
namespace winrt::OobSimulator::implementation | ||
{ | ||
struct BindableBase : BindableBaseT<BindableBase> | ||
{ | ||
void | ||
RaisePropertyChanged(hstring const& propertyName); | ||
winrt::event_token | ||
PropertyChanged(winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler); | ||
void | ||
PropertyChanged(winrt::event_token const& token) noexcept; | ||
|
||
private: | ||
event<winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler> m_propertyChanged; | ||
}; | ||
} // namespace winrt::OobSimulator::implementation | ||
|
||
namespace winrt::OobSimulator::factory_implementation | ||
{ | ||
struct BindableBase : BindableBaseT<BindableBase, implementation::BindableBase> | ||
{ | ||
}; | ||
} // namespace winrt::OobSimulator::factory_implementation | ||
|
||
#endif // BINDABLE_BASE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// BindableBase.idl | ||
|
||
namespace OobSimulator | ||
{ | ||
// clang-format off | ||
[default_interface] | ||
unsealed runtimeclass BindableBase : Microsoft.UI.Xaml.DependencyObject, Microsoft.UI.Xaml.Data.INotifyPropertyChanged | ||
// clang-format on | ||
{ | ||
BindableBase(); | ||
// clang-format off | ||
protected void RaisePropertyChanged(String propertyName); | ||
// clang-format on | ||
} | ||
} // namespace OobSimulator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// clang-format off | ||
#include "pch.h" | ||
#include "DelegateCommand.h" | ||
// clang-format on | ||
|
||
using namespace winrt::Windows::Foundation; | ||
|
||
namespace winrt::OobSimulator::implementation | ||
{ | ||
DelegateCommand::DelegateCommand(std::function<void(IInspectable)> const& execute, std::function<bool(IInspectable)> const& canExecute) | ||
{ | ||
if (!execute) { | ||
throw winrt::hresult_invalid_argument(L"execute"); | ||
} | ||
|
||
m_executeDelegate = execute; | ||
m_canExecuteDelegate = canExecute; | ||
} | ||
|
||
void | ||
DelegateCommand::Execute(IInspectable const& parameter) | ||
{ | ||
if (m_executeDelegate) { | ||
m_executeDelegate(parameter); | ||
} | ||
} | ||
|
||
bool | ||
DelegateCommand::CanExecute(IInspectable const& parameter) | ||
{ | ||
if (!m_canExecuteDelegate) { | ||
return true; | ||
} | ||
|
||
bool canExecute = m_canExecuteDelegate(parameter); | ||
if (m_lastCanExecute != canExecute) { | ||
m_lastCanExecute = canExecute; | ||
RaiseCanExecuteChanged(); | ||
} | ||
|
||
return m_lastCanExecute; | ||
} | ||
|
||
winrt::event_token | ||
DelegateCommand::CanExecuteChanged(EventHandler<IInspectable> const& handler) | ||
{ | ||
return m_canExecuteChanged.add(handler); | ||
} | ||
|
||
void | ||
DelegateCommand::CanExecuteChanged(winrt::event_token const& token) | ||
{ | ||
m_canExecuteChanged.remove(token); | ||
} | ||
|
||
void | ||
DelegateCommand::RaiseCanExecuteChanged() | ||
{ | ||
m_canExecuteChanged(*this, IInspectable()); | ||
} | ||
} // namespace winrt::OobSimulator::implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef DELEGATE_COMMAND_H | ||
#define DELEGATE_COMMAND_H | ||
|
||
#include "DelegateCommand.g.h" | ||
#include <functional> | ||
|
||
namespace winrt::OobSimulator::implementation | ||
{ | ||
struct DelegateCommand : DelegateCommandT<DelegateCommand> | ||
{ | ||
DelegateCommand(std::function<void(winrt::Windows::Foundation::IInspectable)> const& execute, std::function<bool(winrt::Windows::Foundation::IInspectable)> const& canExecute = nullptr); | ||
|
||
void | ||
Execute(winrt::Windows::Foundation::IInspectable const& parameter); | ||
|
||
bool | ||
CanExecute(winrt::Windows::Foundation::IInspectable const& parameter); | ||
|
||
winrt::event_token | ||
CanExecuteChanged(winrt::Windows::Foundation::EventHandler<winrt::Windows::Foundation::IInspectable> const& handler); | ||
|
||
void | ||
CanExecuteChanged(winrt::event_token const& token); | ||
|
||
void | ||
RaiseCanExecuteChanged(); | ||
|
||
private: | ||
std::function<void(winrt::Windows::Foundation::IInspectable)> m_executeDelegate; | ||
std::function<bool(winrt::Windows::Foundation::IInspectable)> m_canExecuteDelegate; | ||
bool m_lastCanExecute = true; | ||
|
||
winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Windows::Foundation::IInspectable>> m_canExecuteChanged; | ||
}; | ||
} // namespace winrt::OobSimulator::implementation | ||
|
||
#endif // DELEGATE_COMMAND_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// DelegateCommand.idl | ||
|
||
namespace OobSimulator | ||
{ | ||
runtimeclass DelegateCommand : Microsoft.UI.Xaml.DependencyObject, Microsoft.UI.Xaml.Input.ICommand | ||
{ | ||
void RaiseCanExecuteChanged(); | ||
} | ||
} // namespace OobSimulator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// clang-format off | ||
#include "pch.h" | ||
#include "Globals.h" | ||
// clang-format on | ||
|
||
HWND g_hwnd = nullptr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef GLOBALS_H | ||
#define GLOBALS_H | ||
|
||
#include <Windows.h> | ||
|
||
extern HWND g_hwnd; | ||
|
||
#endif // GLOBALS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Microsoft Corporation and Contributors. | ||
// Licensed under the MIT License. | ||
|
||
namespace OobSimulator | ||
{ | ||
[default_interface] | ||
runtimeclass MainPage : Microsoft.UI.Xaml.Controls.Page | ||
{ | ||
MainPage(); | ||
|
||
Double NavViewCompactModeThresholdWidth | ||
{ | ||
get; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!-- Copyright (c) Microsoft Corporation and Contributors. --> | ||
<!-- Licensed under the MIT License. --> | ||
|
||
<Page | ||
x:Class="OobSimulator.MainPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:OobSimulator" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d"> | ||
|
||
<muxc:NavigationView x:Name="NavView" Loaded="NavView_Loaded" ItemInvoked="NavView_ItemInvoked" BackRequested="NavView_BackRequested" PaneDisplayMode="Top" AlwaysShowHeader="False"> | ||
<muxc:NavigationView.MenuItems> | ||
<muxc:NavigationViewItemHeader Content="UWB" /> | ||
<muxc:NavigationViewItemSeparator /> | ||
<muxc:NavigationViewItem Tag="uwbsessiondata" Content="Session Data Generator"> | ||
<NavigationViewItem.Icon> | ||
<FontIcon Glyph="" /> | ||
</NavigationViewItem.Icon> | ||
</muxc:NavigationViewItem> | ||
</muxc:NavigationView.MenuItems> | ||
<ScrollViewer> | ||
<Frame x:Name="ContentFrame" IsTabStop="True" NavigationFailed="ContentFrame_NavigationFailed" Navigated="ContentFrame_Navigated"/> | ||
</ScrollViewer> | ||
</muxc:NavigationView> | ||
|
||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup> | ||
<VisualState> | ||
<VisualState.StateTriggers> | ||
<AdaptiveTrigger MinWindowWidth="{x:Bind NavViewCompactModeThresholdWidth}" /> | ||
</VisualState.StateTriggers> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateManager.VisualStateGroups> | ||
</Page> |
Oops, something went wrong.