[OOBE] Out of box experience window (#9973)
42
.github/actions/spell-check/expect.txt
vendored
@ -14,14 +14,12 @@ Acceleratorkeys
|
||||
ACCEPTFILES
|
||||
accessibile
|
||||
accessibilityinsights
|
||||
acf
|
||||
Acl
|
||||
aclapi
|
||||
AColumn
|
||||
acos
|
||||
acrt
|
||||
Actioncenter
|
||||
Actionkeyword
|
||||
activatable
|
||||
ACTIVATEAPP
|
||||
activationaction
|
||||
@ -144,10 +142,8 @@ bc
|
||||
bcc
|
||||
bck
|
||||
Bcl
|
||||
bdaa
|
||||
bddac
|
||||
BEGINLABELEDIT
|
||||
benjamhooper
|
||||
betadele
|
||||
betsegaw
|
||||
BGR
|
||||
@ -184,7 +180,6 @@ bricelam
|
||||
BRIGHTGREEN
|
||||
Browsable
|
||||
bsd
|
||||
bsearch
|
||||
BSODs
|
||||
bstr
|
||||
BText
|
||||
@ -439,7 +434,6 @@ DELA
|
||||
deletethis
|
||||
delims
|
||||
DENORMAL
|
||||
deondre
|
||||
depersist
|
||||
deprioritized
|
||||
deps
|
||||
@ -637,7 +631,6 @@ EFFE
|
||||
efgh
|
||||
EFile
|
||||
egistry
|
||||
Elems
|
||||
ELogo
|
||||
elseif
|
||||
Emoji
|
||||
@ -660,7 +653,6 @@ epicgames
|
||||
ERASEBKGND
|
||||
EREOF
|
||||
EResize
|
||||
eriawan
|
||||
errc
|
||||
errorlevel
|
||||
ERRORMESSAGE
|
||||
@ -717,9 +709,7 @@ Favicon
|
||||
fcharset
|
||||
fd
|
||||
fda
|
||||
FDFC
|
||||
feimage
|
||||
FFB
|
||||
ffcd
|
||||
ffd
|
||||
FFDDDDDD
|
||||
@ -731,7 +721,6 @@ FILEFLAGS
|
||||
FILEFLAGSMASK
|
||||
FILEOP
|
||||
FILEOS
|
||||
filesfolder
|
||||
FILESUBTYPE
|
||||
FILESYSPATH
|
||||
filesystem
|
||||
@ -799,7 +788,6 @@ Giftbox
|
||||
github
|
||||
githubusercontent
|
||||
gitignore
|
||||
globalplugins
|
||||
globals
|
||||
gmx
|
||||
google
|
||||
@ -817,7 +805,6 @@ HACCEL
|
||||
hangeul
|
||||
hanja
|
||||
hanselman
|
||||
happlebao
|
||||
hardcoded
|
||||
HARDWAREINPUT
|
||||
hashcode
|
||||
@ -853,9 +840,8 @@ hitinfo
|
||||
HIWORD
|
||||
hk
|
||||
HKCC
|
||||
HKCU
|
||||
HKCR
|
||||
HKE
|
||||
HKCU
|
||||
hkey
|
||||
HKL
|
||||
HKLM
|
||||
@ -929,6 +915,7 @@ IComparer
|
||||
ICONERROR
|
||||
ICONINFORMATION
|
||||
ICONQUESTION
|
||||
Iconsempty
|
||||
Iconset
|
||||
IContext
|
||||
ICONWARNING
|
||||
@ -1099,10 +1086,10 @@ ITemplate
|
||||
ITEMSTATEICONCLICK
|
||||
ITest
|
||||
ith
|
||||
itsme
|
||||
IThrottled
|
||||
IThumbnail
|
||||
ITrigger
|
||||
itsme
|
||||
IUI
|
||||
IUnknown
|
||||
IUri
|
||||
@ -1122,7 +1109,6 @@ Jarryd
|
||||
javascript
|
||||
jfif
|
||||
jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi
|
||||
jhutchings
|
||||
jjw
|
||||
jobject
|
||||
jp
|
||||
@ -1133,7 +1119,6 @@ JPN
|
||||
json
|
||||
JSONOf
|
||||
jsonval
|
||||
jsoref
|
||||
jsx
|
||||
junja
|
||||
jxr
|
||||
@ -1366,7 +1351,6 @@ moz
|
||||
mozilla
|
||||
mpmc
|
||||
mru
|
||||
msazure
|
||||
msbuild
|
||||
msc
|
||||
msclr
|
||||
@ -1375,7 +1359,6 @@ mscorlib
|
||||
msdata
|
||||
msdn
|
||||
msedge
|
||||
MSGBOX
|
||||
mshtmdid
|
||||
msi
|
||||
MSIHANDLE
|
||||
@ -1438,7 +1421,7 @@ NESW
|
||||
netcore
|
||||
netcoreapp
|
||||
netframework
|
||||
netfx
|
||||
NETFX
|
||||
netsh
|
||||
netstandard
|
||||
Neue
|
||||
@ -1550,7 +1533,7 @@ onedrive
|
||||
onedrivelogo
|
||||
ONITEM
|
||||
onstd
|
||||
OOBE
|
||||
oobe
|
||||
opencode
|
||||
opensource
|
||||
Openthe
|
||||
@ -1745,7 +1728,7 @@ queryfocus
|
||||
QUERYOPEN
|
||||
QUEUESYNC
|
||||
qwertyuiopasdfghjklzxcvbnm
|
||||
QWORD
|
||||
qword
|
||||
qwrtyuiopsghjklzxvnm
|
||||
Radiobuttons
|
||||
RAII
|
||||
@ -1791,7 +1774,6 @@ REMAPUNSUCCESSFUL
|
||||
Remotable
|
||||
REMOTEDISPLAY
|
||||
REMOTESESSION
|
||||
removefolder
|
||||
Removelnk
|
||||
renamable
|
||||
RENAMEONCOLLISION
|
||||
@ -1858,8 +1840,7 @@ RUNLEVEL
|
||||
runsettings
|
||||
runtimeclass
|
||||
runtimeconfig
|
||||
Runtimes
|
||||
Rutkas
|
||||
runtimes
|
||||
rv
|
||||
rvalue
|
||||
rvm
|
||||
@ -1889,10 +1870,9 @@ SEARCHFOR
|
||||
searchqueryhelper
|
||||
SEARCHREPLACEGROUP
|
||||
searchterm
|
||||
Searcn
|
||||
Secur
|
||||
securityoverview
|
||||
Segoe
|
||||
segoe
|
||||
Sekan
|
||||
SENDCHANGE
|
||||
sendinput
|
||||
@ -1995,7 +1975,6 @@ SLogo
|
||||
SMALLICON
|
||||
SMTO
|
||||
snd
|
||||
snickler
|
||||
somil
|
||||
SORTDOWN
|
||||
SOURCECLIENTAREAONLY
|
||||
@ -2114,7 +2093,6 @@ syslog
|
||||
SYSMENU
|
||||
systemd
|
||||
SYSTEMTIME
|
||||
systray
|
||||
sz
|
||||
tadele
|
||||
Tahoma
|
||||
@ -2315,7 +2293,6 @@ VDId
|
||||
vec
|
||||
VERBSONLY
|
||||
VERBW
|
||||
verifybothfolderfilesequal
|
||||
verrsrc
|
||||
VERSIONINFO
|
||||
Versioning
|
||||
@ -2382,7 +2359,6 @@ webpage
|
||||
website
|
||||
webview
|
||||
wekyb
|
||||
welcomeoverview
|
||||
Whichdoes
|
||||
whitespaces
|
||||
WIC
|
||||
@ -2497,7 +2473,6 @@ XElement
|
||||
XFile
|
||||
XIncrement
|
||||
XInstance
|
||||
XJson
|
||||
xlink
|
||||
XLoc
|
||||
xml
|
||||
@ -2518,7 +2493,6 @@ YDiff
|
||||
YESNO
|
||||
YIncrement
|
||||
yinwang
|
||||
YJson
|
||||
YLogo
|
||||
yml
|
||||
YOffset
|
||||
|
@ -268,7 +268,10 @@
|
||||
<Directory Id="SettingsV2StylesInstallFolder" Name="Styles"/>
|
||||
<Directory Id="SettingsV2PropertiesInstallFolder" Name="Properties"/>
|
||||
<Directory Id="SettingsV2AssetsInstallFolder" Name="Assets">
|
||||
<Directory Id="SettingsV2AssetsModulesInstallFolder" Name="Modules" />
|
||||
<Directory Id="SettingsV2OOBEAssetsFluentIconsInstallFolder" Name="FluentIcons" />
|
||||
<Directory Id="SettingsV2AssetsModulesInstallFolder" Name="Modules" >
|
||||
<Directory Id="SettingsV2OOBEAssetsModulesInstallFolder" Name="OOBE" />
|
||||
</Directory>
|
||||
</Directory>
|
||||
<Directory Id="SettingsV2ControlsInstallFolder" Name="Controls"/>
|
||||
<Directory Id="SettingsV2XamlInstallFolder" Name="Microsoft.UI.Xaml">
|
||||
@ -683,6 +686,20 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
<DirectoryRef Id="SettingsV2OOBEAssetsModulesInstallFolder" FileSource="$(var.BinX64Dir)Settings\Assets\Modules\OOBE">
|
||||
<Component Id="SettingsV2OOBEAssetsModules" Guid="E2360A83-6694-4B33-B5F6-641A906359EE" Win64="yes">
|
||||
<?foreach File in ColorPicker.gif;FancyZones.gif;FileExplorer.png;ImageResizer.gif;KBM.gif;PowerRename.gif;Run.gif;OOBEShortcutGuide.png;VideoConferenceMute.png?>
|
||||
<File Source="$(var.BinX64Dir)Settings\Assets\Modules\OOBE\$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
<DirectoryRef Id="SettingsV2OOBEAssetsFluentIconsInstallFolder" FileSource="$(var.BinX64Dir)Settings\Assets\FluentIcons">
|
||||
<Component Id="SettingsV2OOBEAssetsFluentIcons" Guid="6A380D5A-DA63-45B5-B68F-06D57CDD1B9C" Win64="yes">
|
||||
<?foreach File in ColorPicker.png;FancyZones.png;FileExplorerPreview.png;ImageResizer.png;KeyboardManager.png;PowerRename.png;PowerToys.png;PowerToysRun.png;ShortcutGuide.png;VideoConferenceMute.png ?>
|
||||
<File Source="$(var.BinX64Dir)Settings\Assets\FluentIcons\FluentIcons$(var.File)" />
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
<DirectoryRef Id="SettingsV2ControlsInstallFolder" FileSource="$(var.BinX64Dir)Settings\Controls">
|
||||
<Component Id="SettingsV2Controls" Guid="05C55C88-B59A-4450-A07C-EB7626E0781A" Win64="yes">
|
||||
<?foreach File in HotkeySettingsControl.xbf?>
|
||||
@ -778,6 +795,8 @@
|
||||
<ComponentRef Id="SettingsV2" />
|
||||
<ComponentRef Id="SettingsV2Assets" />
|
||||
<ComponentRef Id="SettingsV2AssetsModules" />
|
||||
<ComponentRef Id="SettingsV2OOBEAssetsFluentIcons" />
|
||||
<ComponentRef Id="SettingsV2OOBEAssetsModules" />
|
||||
<ComponentRef Id="SettingsV2Controls" />
|
||||
<ComponentRef Id="SettingsV2Properties" />
|
||||
<ComponentRef Id="SettingsV2Styles" />
|
||||
|
@ -5,6 +5,7 @@ namespace PTSettingsHelper
|
||||
{
|
||||
constexpr inline const wchar_t* settings_filename = L"\\settings.json";
|
||||
constexpr inline const wchar_t* log_settings_filename = L"log_settings.json";
|
||||
constexpr inline const wchar_t* oobe_filename = L"oobe_settings.json";
|
||||
|
||||
std::wstring get_root_save_folder_location()
|
||||
{
|
||||
@ -77,4 +78,34 @@ namespace PTSettingsHelper
|
||||
result = result.append(log_settings_filename);
|
||||
return result.wstring();
|
||||
}
|
||||
|
||||
bool get_oobe_opened_state()
|
||||
{
|
||||
std::filesystem::path oobePath(PTSettingsHelper::get_root_save_folder_location());
|
||||
oobePath = oobePath.append(oobe_filename);
|
||||
if (std::filesystem::exists(oobePath))
|
||||
{
|
||||
auto saved_settings = json::from_file(oobePath.c_str());
|
||||
if (!saved_settings.has_value())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool opened = saved_settings->GetNamedBoolean(L"openedAtFirstLaunch", false);
|
||||
return opened;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void save_oobe_opened_state()
|
||||
{
|
||||
std::filesystem::path oobePath(PTSettingsHelper::get_root_save_folder_location());
|
||||
oobePath = oobePath.append(oobe_filename);
|
||||
|
||||
json::JsonObject obj;
|
||||
obj.SetNamedValue(L"openedAtFirstLaunch", json::value(true));
|
||||
|
||||
json::to_file(oobePath.c_str(), obj);
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,7 @@ namespace PTSettingsHelper
|
||||
void save_general_settings(const json::JsonObject& settings);
|
||||
json::JsonObject load_general_settings();
|
||||
std::wstring get_log_settings_file_location();
|
||||
|
||||
bool get_oobe_opened_state();
|
||||
void save_oobe_opened_state();
|
||||
}
|
||||
|
@ -138,5 +138,13 @@ public
|
||||
static String ^ PowerLauncherSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowColorPickerSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT);
|
||||
}
|
||||
|
||||
static String ^ ShowShortcutGuideSharedEvent() {
|
||||
return gcnew String(CommonSharedConstants::SHOW_SHORTCUT_GUIDE_SHARED_EVENT);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -13,6 +13,12 @@ namespace CommonSharedConstants
|
||||
// Path to the event used by PowerLauncher
|
||||
const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab";
|
||||
|
||||
// Path to the event used to show Color Picker
|
||||
const wchar_t SHOW_COLOR_PICKER_SHARED_EVENT[] = L"Local\\ShowColorPickerEvent-8c46be2a-3e05-4186-b56b-4ae986ef2525";
|
||||
|
||||
// Path to the event used to show Shortcut Guide
|
||||
const wchar_t SHOW_SHORTCUT_GUIDE_SHARED_EVENT[] = L"Local\\ShowShortcutGuideEvent-6982d682-7462-404f-95af-86ae3f089c4f";
|
||||
|
||||
// Max DWORD for key code to disable keys.
|
||||
const int VK_DISABLED = 0x100;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using interop;
|
||||
|
||||
namespace ColorPicker.Helpers
|
||||
{
|
||||
[Export(typeof(NativeEventWaiter))]
|
||||
public class NativeEventWaiter
|
||||
{
|
||||
private AppStateHandler _appStateHandler;
|
||||
|
||||
[ImportingConstructor]
|
||||
public NativeEventWaiter(AppStateHandler appStateHandler)
|
||||
{
|
||||
_appStateHandler = appStateHandler;
|
||||
WaitForEventLoop(Constants.ShowColorPickerSharedEvent(), _appStateHandler.ShowColorPicker);
|
||||
}
|
||||
|
||||
public static void WaitForEventLoop(string eventName, Action callback)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName);
|
||||
while (true)
|
||||
{
|
||||
if (eventHandle.WaitOne())
|
||||
{
|
||||
Logger.LogInfo("Successfully waited for SHOW_COLOR_PICKER_EVENT");
|
||||
Application.Current.Dispatcher.Invoke(callback);
|
||||
}
|
||||
}
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ namespace ColorPicker.ViewModels
|
||||
private readonly ZoomWindowHelper _zoomWindowHelper;
|
||||
private readonly AppStateHandler _appStateHandler;
|
||||
private readonly IUserSettings _userSettings;
|
||||
private readonly NativeEventWaiter _nativeEventWaiter;
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for <see cref="OtherColor"/>
|
||||
@ -48,11 +49,13 @@ namespace ColorPicker.ViewModels
|
||||
ZoomWindowHelper zoomWindowHelper,
|
||||
AppStateHandler appStateHandler,
|
||||
KeyboardMonitor keyboardMonitor,
|
||||
NativeEventWaiter nativeEventWaiter,
|
||||
IUserSettings userSettings)
|
||||
{
|
||||
_zoomWindowHelper = zoomWindowHelper;
|
||||
_appStateHandler = appStateHandler;
|
||||
_userSettings = userSettings;
|
||||
_nativeEventWaiter = nativeEventWaiter;
|
||||
|
||||
if (mouseInfoProvider != null)
|
||||
{
|
||||
|
@ -41,6 +41,7 @@ void D2DWindow::show(UINT x, UINT y, UINT width, UINT height)
|
||||
on_show();
|
||||
SetWindowPos(hwnd, HWND_TOPMOST, x, y, width, height, 0);
|
||||
ShowWindow(hwnd, SW_SHOWNORMAL);
|
||||
SetForegroundWindow(hwnd);
|
||||
UpdateWindow(hwnd);
|
||||
}
|
||||
|
||||
|
29
src/modules/shortcut_guide/native_event_waiter.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include "pch.h"
|
||||
#include "native_event_waiter.h"
|
||||
|
||||
void NativeEventWaiter::run()
|
||||
{
|
||||
while (!aborting)
|
||||
{
|
||||
auto result = WaitForSingleObject(event_handle, timeout);
|
||||
if (!aborting && result == WAIT_OBJECT_0)
|
||||
{
|
||||
action();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NativeEventWaiter::NativeEventWaiter(const std::wstring& event_name, std::function<void()> action)
|
||||
{
|
||||
event_handle = CreateEventW(NULL, FALSE, FALSE, event_name.c_str());
|
||||
this->action = action;
|
||||
running_thread = std::thread([&]() { run(); });
|
||||
}
|
||||
|
||||
NativeEventWaiter::~NativeEventWaiter()
|
||||
{
|
||||
aborting = true;
|
||||
SetEvent(event_handle);
|
||||
running_thread.join();
|
||||
CloseHandle(event_handle);
|
||||
}
|
20
src/modules/shortcut_guide/native_event_waiter.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "common/interop/shared_constants.h"
|
||||
|
||||
class NativeEventWaiter
|
||||
{
|
||||
static const int timeout = 1000;
|
||||
|
||||
HANDLE event_handle;
|
||||
std::function<void()> action;
|
||||
std::atomic<bool> aborting;
|
||||
|
||||
void run();
|
||||
std::thread running_thread;
|
||||
|
||||
public:
|
||||
|
||||
NativeEventWaiter(const std::wstring& event_name, std::function<void()> action);
|
||||
~NativeEventWaiter();
|
||||
};
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <common/SettingsAPI/settings_objects.h>
|
||||
#include <common/debug_control.h>
|
||||
#include <common/interop/shared_constants.h>
|
||||
#include <sstream>
|
||||
#include <modules/shortcut_guide/ShortcutGuideConstants.h>
|
||||
|
||||
@ -94,6 +95,8 @@ namespace
|
||||
((style & WS_THICKFRAME) == WS_THICKFRAME);
|
||||
return result;
|
||||
}
|
||||
|
||||
const LPARAM eventActivateWindow = 1;
|
||||
}
|
||||
|
||||
OverlayWindow::OverlayWindow()
|
||||
@ -212,6 +215,13 @@ void OverlayWindow::enable()
|
||||
instance->target_state->toggle_force_shown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (msg == WM_APP && lparam == eventActivateWindow)
|
||||
{
|
||||
instance->target_state->toggle_force_shown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (msg != WM_HOTKEY)
|
||||
{
|
||||
return 0;
|
||||
@ -260,6 +270,12 @@ void OverlayWindow::enable()
|
||||
}
|
||||
}
|
||||
RegisterHotKey(winkey_popup->get_window_handle(), alternative_switch_hotkey_id, alternative_switch_modifier_mask, alternative_switch_vk_code);
|
||||
|
||||
auto show_action = [&]() {
|
||||
PostMessageW(winkey_popup->get_window_handle(), WM_APP, 0, eventActivateWindow);
|
||||
};
|
||||
|
||||
event_waiter = std::make_unique<NativeEventWaiter>(CommonSharedConstants::SHOW_SHORTCUT_GUIDE_SHARED_EVENT, show_action);
|
||||
}
|
||||
_enabled = true;
|
||||
}
|
||||
@ -276,6 +292,7 @@ void OverlayWindow::disable(bool trace_event)
|
||||
Trace::EnableShortcutGuide(false);
|
||||
}
|
||||
UnregisterHotKey(winkey_popup->get_window_handle(), alternative_switch_hotkey_id);
|
||||
event_waiter.reset();
|
||||
winkey_popup->hide();
|
||||
target_state->exit();
|
||||
target_state.reset();
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <interface/powertoy_module_interface.h>
|
||||
#include "overlay_window.h"
|
||||
#include "native_event_waiter.h"
|
||||
|
||||
#include "Generated Files/resource.h"
|
||||
|
||||
@ -44,6 +45,7 @@ private:
|
||||
std::unique_ptr<D2DOverlayWindow> winkey_popup;
|
||||
bool _enabled = false;
|
||||
HHOOK hook_handle;
|
||||
std::unique_ptr<NativeEventWaiter> event_waiter;
|
||||
|
||||
void init_settings();
|
||||
void disable(bool trace_event);
|
||||
|
@ -67,6 +67,7 @@
|
||||
<ClInclude Include="d2d_svg.h" />
|
||||
<ClInclude Include="d2d_text.h" />
|
||||
<ClInclude Include="d2d_window.h" />
|
||||
<ClInclude Include="native_event_waiter.h" />
|
||||
<ClInclude Include="overlay_window.h" />
|
||||
<ClInclude Include="keyboard_state.h" />
|
||||
<ClInclude Include="Generated Files/resource.h" />
|
||||
@ -83,6 +84,7 @@
|
||||
<ClCompile Include="d2d_svg.cpp" />
|
||||
<ClCompile Include="d2d_text.cpp" />
|
||||
<ClCompile Include="d2d_window.cpp" />
|
||||
<ClCompile Include="native_event_waiter.cpp" />
|
||||
<ClCompile Include="overlay_window.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="keyboard_state.cpp" />
|
||||
|
@ -36,6 +36,9 @@
|
||||
<ClCompile Include="tasklist_positions.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="native_event_waiter.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
@ -73,6 +76,9 @@
|
||||
<ClInclude Include="start_visible.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="native_event_waiter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <common/utils/winapi_error.h>
|
||||
#include <common/version/version.h>
|
||||
#include <common/utils/window.h>
|
||||
#include <runner/settings_window.h>
|
||||
|
||||
extern updating::notifications::strings Strings;
|
||||
|
||||
@ -77,12 +78,8 @@ void open_menu_from_another_instance()
|
||||
PostMessageW(hwnd_main, WM_COMMAND, ID_SETTINGS_MENU_COMMAND, 0);
|
||||
}
|
||||
|
||||
int runner(bool isProcessElevated, bool openSettings)
|
||||
int runner(bool isProcessElevated, bool openSettings, bool openOobe)
|
||||
{
|
||||
std::filesystem::path logFilePath(PTSettingsHelper::get_root_save_folder_location());
|
||||
logFilePath.append(LogSettings::runnerLogPath);
|
||||
Logger::init(LogSettings::runnerLoggerName, logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location());
|
||||
|
||||
Logger::info("Runner is starting. Elevated={}", isProcessElevated);
|
||||
DPIAware::EnableDPIAwarenessForThisProcess();
|
||||
|
||||
@ -161,6 +158,11 @@ int runner(bool isProcessElevated, bool openSettings)
|
||||
open_settings_window();
|
||||
}
|
||||
|
||||
if (openOobe)
|
||||
{
|
||||
open_oobe_window();
|
||||
}
|
||||
|
||||
result = run_message_loop();
|
||||
}
|
||||
catch (std::runtime_error& err)
|
||||
@ -336,6 +338,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
break;
|
||||
}
|
||||
|
||||
std::filesystem::path logFilePath(PTSettingsHelper::get_root_save_folder_location());
|
||||
logFilePath.append(LogSettings::runnerLogPath);
|
||||
Logger::init(LogSettings::runnerLoggerName, logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location());
|
||||
|
||||
wil::unique_mutex_nothrow msi_mutex;
|
||||
wil::unique_mutex_nothrow msix_mutex;
|
||||
|
||||
@ -401,6 +407,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
}
|
||||
}
|
||||
|
||||
bool openOobe = false;
|
||||
try
|
||||
{
|
||||
openOobe = !PTSettingsHelper::get_oobe_opened_state();
|
||||
if (openOobe)
|
||||
{
|
||||
PTSettingsHelper::save_oobe_opened_state();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
Logger::error("Failed to get or save OOBE state with an exception: {}", e.what());
|
||||
}
|
||||
|
||||
int result = 0;
|
||||
try
|
||||
{
|
||||
@ -411,6 +431,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
auto general_settings = load_general_settings();
|
||||
const bool openSettings = std::string(lpCmdLine).find("--open-settings") != std::string::npos;
|
||||
|
||||
|
||||
// Apply the general settings but don't save it as the modules() variable has not been loaded yet
|
||||
apply_general_settings(general_settings, false);
|
||||
int rvalue = 0;
|
||||
@ -420,7 +441,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
std::string(lpCmdLine).find("--dont-elevate") != std::string::npos))
|
||||
{
|
||||
|
||||
result = runner(elevated, openSettings);
|
||||
result = runner(elevated, openSettings, openOobe);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ BOOL run_settings_non_elevated(LPCWSTR executable_path, LPWSTR executable_args,
|
||||
|
||||
DWORD g_settings_process_id = 0;
|
||||
|
||||
void run_settings_window()
|
||||
void run_settings_window(bool showOobeWindow)
|
||||
{
|
||||
g_isLaunchInProgress = true;
|
||||
|
||||
@ -303,7 +303,7 @@ void run_settings_window()
|
||||
executable_path.append(L"\\PowerToysSettings.exe");
|
||||
}
|
||||
|
||||
// Arg 2: pipe server. Generate unique names for the pipes, if getting a UUID is possible.
|
||||
// Args 2,3: pipe server. Generate unique names for the pipes, if getting a UUID is possible.
|
||||
std::wstring powertoys_pipe_name(L"\\\\.\\pipe\\powertoys_runner_");
|
||||
std::wstring settings_pipe_name(L"\\\\.\\pipe\\powertoys_settings_");
|
||||
UUID temp_uuid;
|
||||
@ -327,10 +327,10 @@ void run_settings_window()
|
||||
uuid_chars = nullptr;
|
||||
}
|
||||
|
||||
// Arg 3: process pid.
|
||||
// Arg 4: process pid.
|
||||
DWORD powertoys_pid = GetCurrentProcessId();
|
||||
|
||||
// Arg 4: settings theme.
|
||||
// Arg 5: settings theme.
|
||||
const std::wstring settings_theme_setting{ get_general_settings().theme };
|
||||
std::wstring settings_theme = L"system";
|
||||
if (settings_theme_setting == L"dark" || (settings_theme_setting == L"system" && WindowsColors::is_dark_mode()))
|
||||
@ -338,33 +338,18 @@ void run_settings_window()
|
||||
settings_theme = L"dark";
|
||||
}
|
||||
|
||||
// Arg 4: settings theme.
|
||||
GeneralSettings save_settings = get_general_settings();
|
||||
|
||||
// Arg 6: elevated status
|
||||
bool isElevated{ get_general_settings().isElevated };
|
||||
std::wstring settings_elevatedStatus;
|
||||
settings_elevatedStatus = isElevated;
|
||||
|
||||
if (isElevated)
|
||||
{
|
||||
settings_elevatedStatus = L"true";
|
||||
}
|
||||
else
|
||||
{
|
||||
settings_elevatedStatus = L"false";
|
||||
}
|
||||
|
||||
std::wstring settings_elevatedStatus = isElevated ? L"true" : L"false";
|
||||
|
||||
// Arg 7: is user an admin
|
||||
bool isAdmin{ get_general_settings().isAdmin };
|
||||
std::wstring settings_isUserAnAdmin;
|
||||
std::wstring settings_isUserAnAdmin = isAdmin ? L"true" : L"false";
|
||||
|
||||
if (isAdmin)
|
||||
{
|
||||
settings_isUserAnAdmin = L"true";
|
||||
}
|
||||
else
|
||||
{
|
||||
settings_isUserAnAdmin = L"false";
|
||||
}
|
||||
// Arg 8: should oobe window be shown
|
||||
std::wstring settings_showOobe = showOobeWindow ? L"true" : L"false";
|
||||
|
||||
// create general settings file to initialize the settings file with installation configurations like :
|
||||
// 1. Run on start up.
|
||||
@ -384,7 +369,9 @@ void run_settings_window()
|
||||
executable_args.append(settings_elevatedStatus);
|
||||
executable_args.append(L" ");
|
||||
executable_args.append(settings_isUserAnAdmin);
|
||||
|
||||
executable_args.append(L" ");
|
||||
executable_args.append(settings_showOobe);
|
||||
|
||||
BOOL process_created = false;
|
||||
|
||||
// Due to a bug in .NET, running the Settings process as non-elevated
|
||||
@ -510,7 +497,9 @@ void open_settings_window()
|
||||
{
|
||||
if (!g_isLaunchInProgress)
|
||||
{
|
||||
std::thread(run_settings_window).detach();
|
||||
std::thread([]() {
|
||||
run_settings_window(false);
|
||||
}).detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -526,3 +515,10 @@ void close_settings_window()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void open_oobe_window()
|
||||
{
|
||||
std::thread([]() {
|
||||
run_settings_window(true);
|
||||
}).detach();
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
void open_settings_window();
|
||||
void close_settings_window();
|
||||
void close_settings_window();
|
||||
|
||||
void open_oobe_window();
|
@ -0,0 +1,18 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events
|
||||
{
|
||||
[EventData]
|
||||
public class OobeModuleRunEvent : EventBase, IEvent
|
||||
{
|
||||
public string ModuleName { get; set; }
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events
|
||||
{
|
||||
[EventData]
|
||||
public class OobeSectionEvent : EventBase, IEvent
|
||||
{
|
||||
public string Section { get; set; }
|
||||
|
||||
public double TimeOpenedMs { get; set; }
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events
|
||||
{
|
||||
[EventData]
|
||||
public class OobeSettingsEvent : EventBase, IEvent
|
||||
{
|
||||
public string ModuleName { get; set; }
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events
|
||||
{
|
||||
[EventData]
|
||||
public class OobeStartedEvent : EventBase, IEvent
|
||||
{
|
||||
public bool OobeStarted { get; set; } = true;
|
||||
|
||||
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 10 MiB |
After Width: | Height: | Size: 237 KiB |
After Width: | Height: | Size: 1.5 MiB |
After Width: | Height: | Size: 1.5 MiB |
After Width: | Height: | Size: 256 KiB |
After Width: | Height: | Size: 958 KiB |
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 156 KiB |
@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
internal static class NativeMethods
|
||||
public static class NativeMethods
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern uint SendInput(uint nInputs, NativeKeyboardHelper.INPUT[] pInputs, int cbSize);
|
||||
@ -14,7 +14,12 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
|
||||
internal static extern short GetAsyncKeyState(int vKey);
|
||||
|
||||
#pragma warning disable CA1401 // P/Invokes should not be visible
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindow(System.IntPtr hWnd, int nCmdShow);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool AllowSetForegroundWindow(int dwProcessId);
|
||||
#pragma warning restore CA1401 // P/Invokes should not be visible
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,42 @@
|
||||
<Compile Include="Helpers\StartProcessHelper.cs" />
|
||||
<Compile Include="ICoreWindowInterop.cs" />
|
||||
<Compile Include="Interop.cs" />
|
||||
<Compile Include="OOBE\Enums\PowerToysModulesEnum.cs" />
|
||||
<Compile Include="OOBE\ViewModel\OobeShellViewModel.cs" />
|
||||
<Compile Include="OOBE\ViewModel\OobePowerToysModule.cs" />
|
||||
<Compile Include="OOBE\Views\OobeColorPicker.xaml.cs">
|
||||
<DependentUpon>OobeColorPicker.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeFancyZones.xaml.cs">
|
||||
<DependentUpon>OobeFancyZones.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeFileExplorer.xaml.cs">
|
||||
<DependentUpon>OobeFileExplorer.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeImageResizer.xaml.cs">
|
||||
<DependentUpon>OobeImageResizer.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeKBM.xaml.cs">
|
||||
<DependentUpon>OobeKBM.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeOverview.xaml.cs">
|
||||
<DependentUpon>OobeOverview.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobePowerRename.xaml.cs">
|
||||
<DependentUpon>OobePowerRename.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeRun.xaml.cs">
|
||||
<DependentUpon>OobeRun.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeShellPage.xaml.cs">
|
||||
<DependentUpon>OobeShellPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeShortcutGuide.xaml.cs">
|
||||
<DependentUpon>OobeShortcutGuide.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE\Views\OobeVideoConference.xaml.cs">
|
||||
<DependentUpon>OobeVideoConference.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Services\ActivationService.cs" />
|
||||
<Compile Include="Services\NavigationService.cs" />
|
||||
<Compile Include="ViewModels\Commands\ButtonClickCommand.cs" />
|
||||
@ -153,11 +189,30 @@
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\FluentIcons\FluentIconsColorPicker.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsFancyZones.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsFileExplorerPreview.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsImageResizer.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsKeyboardManager.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsPowerRename.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsPowerToys.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsPowerToysRun.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsShortcutGuide.png" />
|
||||
<Content Include="Assets\FluentIcons\FluentIconsVideoConferenceMute.png" />
|
||||
<Content Include="Assets\Logo.scale-200.png" />
|
||||
<Content Include="Assets\Modules\ColorPicker.png" />
|
||||
<Content Include="Assets\Modules\FancyZones.png" />
|
||||
<Content Include="Assets\Modules\ImageResizer.png" />
|
||||
<Content Include="Assets\Modules\KBM.png" />
|
||||
<Content Include="Assets\Modules\OOBE\ColorPicker.gif" />
|
||||
<Content Include="Assets\Modules\OOBE\FancyZones.gif" />
|
||||
<Content Include="Assets\Modules\OOBE\FileExplorer.png" />
|
||||
<Content Include="Assets\Modules\OOBE\ImageResizer.gif" />
|
||||
<Content Include="Assets\Modules\OOBE\KBM.gif" />
|
||||
<Content Include="Assets\Modules\OOBE\PowerRename.gif" />
|
||||
<Content Include="Assets\Modules\OOBE\Run.gif" />
|
||||
<Content Include="Assets\Modules\OOBE\OOBEShortcutGuide.png" />
|
||||
<Content Include="Assets\Modules\OOBE\VideoConferenceMute.png" />
|
||||
<Content Include="Assets\Modules\PowerLauncher.png" />
|
||||
<Content Include="Assets\Modules\PowerPreview.png" />
|
||||
<Content Include="Assets\Modules\PowerRename.png" />
|
||||
@ -216,6 +271,50 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeColorPicker.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeFancyZones.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeFileExplorer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeImageResizer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeKBM.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeOverview.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobePowerRename.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeRun.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeShellPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeShortcutGuide.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="OOBE\Views\OobeVideoConference.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Styles\Button.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -300,6 +399,7 @@
|
||||
<Name>Microsoft.PowerToys.Settings.UI.Library</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
|
@ -0,0 +1,20 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
|
||||
{
|
||||
public enum PowerToysModulesEnum
|
||||
{
|
||||
Overview = 0,
|
||||
ColorPicker,
|
||||
FancyZones,
|
||||
ImageResizer,
|
||||
KBM,
|
||||
Run,
|
||||
PowerRename,
|
||||
FileExplorer,
|
||||
ShortcutGuide,
|
||||
VideoConference,
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.ViewModel
|
||||
{
|
||||
public class OobePowerToysModule
|
||||
{
|
||||
private System.Diagnostics.Stopwatch timeOpened = new System.Diagnostics.Stopwatch();
|
||||
|
||||
public string ModuleName { get; set; }
|
||||
|
||||
public string Tag { get; set; }
|
||||
|
||||
public bool IsNew { get; set; }
|
||||
|
||||
public string Image { get; set; }
|
||||
|
||||
public string Icon { get; set; }
|
||||
|
||||
public string FluentIcon { get; set; }
|
||||
|
||||
public string PreviewImageSource { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public string Link { get; set; }
|
||||
|
||||
public string DescriptionLink { get; set; }
|
||||
|
||||
public OobePowerToysModule()
|
||||
{
|
||||
}
|
||||
|
||||
public OobePowerToysModule(OobePowerToysModule other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleName = other.ModuleName;
|
||||
Tag = other.Tag;
|
||||
IsNew = other.IsNew;
|
||||
Image = other.Image;
|
||||
Icon = other.Icon;
|
||||
FluentIcon = other.FluentIcon;
|
||||
PreviewImageSource = other.PreviewImageSource;
|
||||
Description = other.Description;
|
||||
Link = other.Link;
|
||||
DescriptionLink = other.DescriptionLink;
|
||||
timeOpened = other.timeOpened;
|
||||
}
|
||||
|
||||
public void LogOpeningSettingsEvent()
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new OobeSettingsEvent() { ModuleName = this.ModuleName });
|
||||
}
|
||||
|
||||
public void LogRunningModuleEvent()
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new OobeModuleRunEvent() { ModuleName = this.ModuleName });
|
||||
}
|
||||
|
||||
public void LogOpeningModuleEvent()
|
||||
{
|
||||
timeOpened.Start();
|
||||
}
|
||||
|
||||
public void LogClosingModuleEvent()
|
||||
{
|
||||
timeOpened.Stop();
|
||||
PowerToysTelemetry.Log.WriteEvent(new OobeSectionEvent() { Section = this.ModuleName, TimeOpenedMs = timeOpened.ElapsedMilliseconds });
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.ViewModel
|
||||
{
|
||||
public class OobeShellViewModel
|
||||
{
|
||||
public OobeShellViewModel()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeColorPicker"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,0,0"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Margin="0,4,0,0"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}" Margin="0,0,0,4">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToUse"
|
||||
Style="{StaticResource OobeSubtitleStyle}"/>
|
||||
|
||||
<TextBlock x:Uid="Oobe_ColorPicker_HowToUse"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<TextBlock x:Uid="Oobe_TipsAndTricks"
|
||||
Style="{StaticResource OobeSubtitleStyle}"/>
|
||||
|
||||
<TextBlock x:Uid="Oobe_ColorPicker_TipsAndTricks"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4"
|
||||
Margin="0,32,0,0">
|
||||
<Button Style="{StaticResource AccentButtonStyle}" Click="Start_ColorPicker_Click">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_Launch"/>
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}"/>
|
||||
</TextBlock>
|
||||
</Button>
|
||||
<Button Click="SettingsLaunchButton_Click">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock x:Uid="OOBE_Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,61 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Threading;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeColorPicker : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeColorPicker()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.ColorPicker]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void Start_ColorPicker_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.ColorPickerSharedEventCallback != null)
|
||||
{
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, OobeShellPage.ColorPickerSharedEventCallback()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
}
|
||||
}
|
||||
|
||||
ViewModel.LogRunningModuleEvent();
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(ColorPickerPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeFancyZones"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Height="280"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,32,24"
|
||||
VerticalAlignment="Top">
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Margin="0,4,0,0"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}"
|
||||
Margin="0,0,0,4">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToUse"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
<TextBlock x:Uid="Oobe_FancyZones_HowToUse"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_TipsAndTricks"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
<TextBlock x:Uid="Oobe_FancyZones_TipsAndTricks"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4"
|
||||
Margin="0,32,0,0">
|
||||
<Button Click="SettingsLaunchButton_Click">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock x:Uid="OOBE_Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,47 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeFancyZones : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeFancyZones()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.FancyZones]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(FancyZonesPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<Page x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeFileExplorer"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Height="280"
|
||||
Grid.Row="0"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,32,24"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock Margin="0,4,0,0"
|
||||
TextWrapping="Wrap"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}"
|
||||
Margin="0,0,0,4">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToEnable"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_FileExplorer_HowToEnable"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4"
|
||||
Margin="0,32,0,0">
|
||||
|
||||
<Button Click="SettingsLaunchButton_Click">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock x:Uid="OOBE_Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,47 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeFileExplorer : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeFileExplorer()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.FileExplorer]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(PowerPreviewPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeImageResizer"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Height="280"
|
||||
Grid.Row="0"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,32,24"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock Margin="0,4,0,0"
|
||||
TextWrapping="Wrap"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}"
|
||||
Margin="0,0,0,4">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToLaunch"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_ImageResizer_HowToLaunch"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_TipsAndTricks"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_ImageResizer_TipsAndTricks"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4"
|
||||
Margin="0,32,0,0">
|
||||
<Button Click="SettingsLaunchButton_Click">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock Text="Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,47 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeImageResizer : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeImageResizer()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.ImageResizer]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(ImageResizerPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
<Page x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeKBM"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,32,24"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock Margin="0,4,0,0"
|
||||
TextWrapping="Wrap"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}"
|
||||
Margin="0,0,0,4">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToCreateMappings"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_KBM_HowToCreateMappings"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_TipsAndTricks"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_KBM_TipsAndTricks"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4"
|
||||
Margin="0,32,0,0">
|
||||
<Button Click="SettingsLaunchButton_Click">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock Text="Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,47 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeKBM : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeKBM()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.KBM]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(KeyboardManagerPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
<Page x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeOverview"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Height="320"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,32,24"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock Margin="0,4,0,0"
|
||||
TextWrapping="Wrap">
|
||||
<Run x:Uid="Oobe_Overview_Description" />
|
||||
<Hyperlink NavigateUri="{x:Bind ViewModel.DescriptionLink}"
|
||||
Foreground="{ThemeResource SystemControlBackgroundAccentBrush}">
|
||||
<Run x:Uid="Oobe_Overview_DescriptionLinkText" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
|
||||
<TextBlock Margin="0,32,0,0"
|
||||
TextWrapping="Wrap">
|
||||
<Run x:Uid="Oobe_Overview_CheckoutLatestVersion" />
|
||||
<Hyperlink NavigateUri="{x:Bind ViewModel.Link}">
|
||||
<Run x:Uid="Oobe_Overview_LatestVersionLink" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
|
||||
<Button Click="SettingsLaunchButton_Click"
|
||||
Margin="0,32,0,0">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock x:Uid="OOBE_Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,44 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
public sealed partial class OobeOverview : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeOverview()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.Overview]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(GeneralPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
<Page x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobePowerRename"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,32,24"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock Margin="0,4,0,0"
|
||||
TextWrapping="Wrap"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}"
|
||||
Margin="0,0,0,4">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</HyperlinkButton>
|
||||
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToUse"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_PowerRename_HowToUse"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_TipsAndTricks"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_PowerRename_TipsAndTricks"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4"
|
||||
Margin="0,32,0,0">
|
||||
|
||||
<Button Click="SettingsLaunchButton_Click">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock x:Uid="OOBE_Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,47 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobePowerRename : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobePowerRename()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.PowerRename]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(PowerRenamePage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeRun"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,32,24"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock Margin="0,4,0,0"
|
||||
TextWrapping="Wrap"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}"
|
||||
Margin="0,0,0,4">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToLaunch"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_Run_HowToLaunch" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_TipsAndTricks"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_Run_TipsAndTricks"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Margin="0,32,0,0"
|
||||
Spacing="4">
|
||||
|
||||
<Button Click="Start_Run_Click" Style="{StaticResource AccentButtonStyle}">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_Launch" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</Button>
|
||||
|
||||
<Button Click="SettingsLaunchButton_Click">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock x:Uid="OOBE_Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,61 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Threading;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeRun : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeRun()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.Run]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void Start_Run_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.RunSharedEventCallback != null)
|
||||
{
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, OobeShellPage.RunSharedEventCallback()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
}
|
||||
}
|
||||
|
||||
ViewModel.LogRunningModuleEvent();
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(PowerLauncherPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
<UserControl
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeShellPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:winui="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:localModels="using:Microsoft.PowerToys.Settings.UI.OOBE.ViewModel"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Loaded="UserControl_Loaded">
|
||||
|
||||
<UserControl.Resources>
|
||||
<DataTemplate x:Key="NavigationViewMenuItem" x:DataType="localModels:OobePowerToysModule">
|
||||
<winui:NavigationViewItem Content="{x:Bind ModuleName}" Tag="{x:Bind Tag}">
|
||||
<winui:NavigationViewItem.Icon>
|
||||
<BitmapIcon UriSource="{x:Bind FluentIcon}" ShowAsMonochrome="False"/>
|
||||
</winui:NavigationViewItem.Icon>
|
||||
</winui:NavigationViewItem>
|
||||
</DataTemplate>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource WideLayoutMinWidth}" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SmallLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="{StaticResource SmallLayoutMinWidth}" />
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="NavigationView.PaneDisplayMode"
|
||||
Value="LeftMinimal" />
|
||||
<Setter Target="NavigationView.IsPaneToggleButtonVisible"
|
||||
Value="True" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<winui:NavigationView IsSettingsVisible="False"
|
||||
IsPaneToggleButtonVisible="False"
|
||||
IsPaneOpen="True"
|
||||
x:Name="NavigationView"
|
||||
OpenPaneLength="296"
|
||||
PaneDisplayMode="Left"
|
||||
SelectionChanged="NavigationView_SelectionChanged"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
MenuItemsSource="{x:Bind Modules, Mode=OneTime}"
|
||||
MenuItemTemplate="{StaticResource NavigationViewMenuItem}">
|
||||
<winui:NavigationView.PaneCustomContent>
|
||||
<StackPanel Grid.Column="0" Margin="16"
|
||||
Orientation="Vertical">
|
||||
<TextBlock x:Uid="Oobe_GettingStarted"
|
||||
TextWrapping="Wrap"
|
||||
FontWeight="SemiBold"
|
||||
Style="{StaticResource PageTitleStyle}"
|
||||
Margin="0,0,0,16" />
|
||||
</StackPanel>
|
||||
</winui:NavigationView.PaneCustomContent>
|
||||
<winui:NavigationView.Content>
|
||||
<Frame x:Name="NavigationFrame" />
|
||||
</winui:NavigationView.Content>
|
||||
</winui:NavigationView>
|
||||
</Grid>
|
||||
</UserControl>
|
@ -0,0 +1,225 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
public sealed partial class OobeShellPage : UserControl
|
||||
{
|
||||
public static Func<string> RunSharedEventCallback { get; set; }
|
||||
|
||||
public static void SetRunSharedEventCallback(Func<string> implementation)
|
||||
{
|
||||
RunSharedEventCallback = implementation;
|
||||
}
|
||||
|
||||
public static Func<string> ColorPickerSharedEventCallback { get; set; }
|
||||
|
||||
public static void SetColorPickerSharedEventCallback(Func<string> implementation)
|
||||
{
|
||||
ColorPickerSharedEventCallback = implementation;
|
||||
}
|
||||
|
||||
public static Func<string> ShortcutGuideSharedEventCallback { get; set; }
|
||||
|
||||
public static void SetShortcutGuideSharedEventCallback(Func<string> implementation)
|
||||
{
|
||||
ShortcutGuideSharedEventCallback = implementation;
|
||||
}
|
||||
|
||||
public static Action<Type> OpenMainWindowCallback { get; set; }
|
||||
|
||||
public static void SetOpenMainWindowCallback(Action<Type> implementation)
|
||||
{
|
||||
OpenMainWindowCallback = implementation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets view model.
|
||||
/// </summary>
|
||||
public OobeShellViewModel ViewModel { get; } = new OobeShellViewModel();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a shell handler to be used to update contents of the shell dynamically from page within the frame.
|
||||
/// </summary>
|
||||
public static OobeShellPage OobeShellHandler { get; set; }
|
||||
|
||||
public ObservableCollection<OobePowerToysModule> Modules { get; }
|
||||
|
||||
public OobeShellPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = ViewModel;
|
||||
OobeShellHandler = this;
|
||||
|
||||
Modules = new ObservableCollection<OobePowerToysModule>();
|
||||
ResourceLoader loader = ResourceLoader.GetForViewIndependentUse();
|
||||
|
||||
Modules.Insert((int)PowerToysModulesEnum.Overview, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_Welcome"),
|
||||
Tag = "Overview",
|
||||
IsNew = false,
|
||||
Icon = "\uEF3C",
|
||||
Image = "ms-appx:///Assets/Modules/ColorPicker.png",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsPowerToys.png",
|
||||
PreviewImageSource = "https://github.com/microsoft/PowerToys/raw/master/doc/images/overview/PT%20hero%20image.png",
|
||||
DescriptionLink = "https://aka.ms/PowerToysOverview",
|
||||
Link = "https://github.com/microsoft/PowerToys/releases/",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.ColorPicker, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_ColorPicker"),
|
||||
Tag = "ColorPicker",
|
||||
IsNew = false,
|
||||
Icon = "\uEF3C",
|
||||
Image = "ms-appx:///Assets/Modules/ColorPicker.png",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsColorPicker.png",
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/ColorPicker.gif",
|
||||
Description = loader.GetString("Oobe_ColorPicker_Description"),
|
||||
Link = "https://aka.ms/PowerToysOverview_ColorPicker",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.FancyZones, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_FancyZones"),
|
||||
Tag = "FancyZones",
|
||||
IsNew = false,
|
||||
Icon = "\uE737",
|
||||
Image = "ms-appx:///Assets/Modules/FancyZones.png",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsFancyZones.png",
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/FancyZones.gif",
|
||||
Description = loader.GetString("Oobe_FancyZones_Description"),
|
||||
Link = "https://aka.ms/PowerToysOverview_FancyZones",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.ImageResizer, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_ImageResizer"),
|
||||
Tag = "ImageResizer",
|
||||
IsNew = false,
|
||||
Icon = "\uEB9F",
|
||||
Image = "ms-appx:///Assets/Modules/ImageResizer.png",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsImageResizer.png",
|
||||
Description = loader.GetString("Oobe_ImageResizer_Description"),
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/ImageResizer.gif",
|
||||
Link = "https://aka.ms/PowerToysOverview_ImageResizer",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.KBM, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_KBM"),
|
||||
Tag = "KBM",
|
||||
IsNew = false,
|
||||
Icon = "\uE765",
|
||||
Image = "ms-appx:///Assets/Modules/KeyboardManager.png",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsKeyboardManager.png",
|
||||
Description = loader.GetString("Oobe_KBM_Description"),
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/KBM.gif",
|
||||
Link = "https://aka.ms/PowerToysOverview_KeyboardManager",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.Run, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_Run"),
|
||||
Tag = "Run",
|
||||
IsNew = false,
|
||||
Icon = "\uE773",
|
||||
Image = "ms-appx:///Assets/Modules/PowerLauncher.png",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsPowerToysRun.png",
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/Run.gif",
|
||||
Description = loader.GetString("Oobe_PowerRun_Description"),
|
||||
Link = "https://aka.ms/PowerToysOverview_PowerToysRun",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.PowerRename, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_PowerRename"),
|
||||
Tag = "PowerRename",
|
||||
IsNew = false,
|
||||
Icon = "\uE8AC",
|
||||
Image = "ms-appx:///Assets/Modules/PowerRename.png",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsPowerRename.png",
|
||||
Description = loader.GetString("Oobe_PowerRename_Description"),
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/PowerRename.gif",
|
||||
Link = "https://aka.ms/PowerToysOverview_PowerRename",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.FileExplorer, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_FileExplorer"),
|
||||
Tag = "FileExplorer",
|
||||
IsNew = false,
|
||||
Icon = "\uEC50",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsFileExplorerPreview.png",
|
||||
Image = "ms-appx:///Assets/Modules/PowerPreview.png",
|
||||
Description = loader.GetString("Oobe_FileExplorer_Description"),
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/FileExplorer.png",
|
||||
Link = "https://aka.ms/PowerToysOverview_FileExplorerAddOns",
|
||||
});
|
||||
Modules.Insert((int)PowerToysModulesEnum.ShortcutGuide, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_ShortcutGuide"),
|
||||
Tag = "ShortcutGuide",
|
||||
IsNew = false,
|
||||
Icon = "\uEDA7",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsShortcutGuide.png",
|
||||
Image = "ms-appx:///Assets/Modules/ShortcutGuide.png",
|
||||
Description = loader.GetString("Oobe_ShortcutGuide_Description"),
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/OOBEShortcutGuide.png",
|
||||
Link = "https://aka.ms/PowerToysOverview_ShortcutGuide",
|
||||
});
|
||||
/* Modules.Insert((int)PowerToysModulesEnum.VideoConference, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = loader.GetString("Oobe_VideoConference"),
|
||||
Tag = "VideoConference",
|
||||
IsNew = true,
|
||||
Icon = "\uEC50",
|
||||
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsVideoConferenceMute.png",
|
||||
Image = "ms-appx:///Assets/Modules/VideoConference.png",
|
||||
Description = loader.GetString("Oobe_VideoConference_Description"),
|
||||
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/VideoConferenceMute.png",
|
||||
Link = "https://aka.ms/PowerToysOverview_VideoConference",
|
||||
}); */
|
||||
}
|
||||
|
||||
public void OnClosing()
|
||||
{
|
||||
if (NavigationView.SelectedItem != null)
|
||||
{
|
||||
((OobePowerToysModule)NavigationView.SelectedItem).LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
|
||||
private void UserControl_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (Modules.Count > 0)
|
||||
{
|
||||
NavigationView.SelectedItem = Modules[(int)PowerToysModulesEnum.Overview];
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Params are required for event handler signature requirements.")]
|
||||
private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args)
|
||||
{
|
||||
OobePowerToysModule selectedItem = args.SelectedItem as OobePowerToysModule;
|
||||
|
||||
switch (selectedItem.Tag)
|
||||
{
|
||||
case "Overview": NavigationFrame.Navigate(typeof(OobeOverview)); break;
|
||||
case "ColorPicker": NavigationFrame.Navigate(typeof(OobeColorPicker)); break;
|
||||
case "FancyZones": NavigationFrame.Navigate(typeof(OobeFancyZones)); break;
|
||||
case "Run": NavigationFrame.Navigate(typeof(OobeRun)); break;
|
||||
case "ImageResizer": NavigationFrame.Navigate(typeof(OobeImageResizer)); break;
|
||||
case "KBM": NavigationFrame.Navigate(typeof(OobeKBM)); break;
|
||||
case "PowerRename": NavigationFrame.Navigate(typeof(OobePowerRename)); break;
|
||||
case "FileExplorer": NavigationFrame.Navigate(typeof(OobeFileExplorer)); break;
|
||||
case "ShortcutGuide": NavigationFrame.Navigate(typeof(OobeShortcutGuide)); break;
|
||||
case "VideoConference": NavigationFrame.Navigate(typeof(OobeVideoConference)); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeShortcutGuide"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,32,24"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock Margin="0,4,0,0"
|
||||
TextWrapping="Wrap"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}"
|
||||
Margin="0,0,0,4">
|
||||
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToLaunch"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_ShortcutGuide_HowToLaunch"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Margin="0,32,0,0"
|
||||
Spacing="8">
|
||||
<Button Click="Start_ShortcutGuide_Click" Style="{StaticResource AccentButtonStyle}">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_Launch" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</Button>
|
||||
<Button Click="SettingsLaunchButton_Click">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock x:Uid="OOBE_Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,61 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Threading;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeShortcutGuide : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeShortcutGuide()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.ShortcutGuide]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void Start_ShortcutGuide_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.ShortcutGuideSharedEventCallback != null)
|
||||
{
|
||||
using (var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, OobeShellPage.ShortcutGuideSharedEventCallback()))
|
||||
{
|
||||
eventHandle.Set();
|
||||
}
|
||||
}
|
||||
|
||||
ViewModel.LogRunningModuleEvent();
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(ShortcutGuidePage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeVideoConference"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Stretch="UniformToFill"
|
||||
Source="{x:Bind ViewModel.PreviewImageSource}" />
|
||||
|
||||
<ScrollViewer Grid.Row="1"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical"
|
||||
Margin="32,24,32,24"
|
||||
VerticalAlignment="Top">
|
||||
|
||||
<TextBlock Text="{x:Bind ViewModel.ModuleName}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Margin="0,4,0,0"
|
||||
Text="{x:Bind ViewModel.Description}" />
|
||||
|
||||
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}"
|
||||
Margin="0,0,0,4">
|
||||
<TextBlock>
|
||||
<Run x:Uid="Oobe_LearnMore" />
|
||||
<Run Text="{x:Bind ViewModel.ModuleName}" />
|
||||
</TextBlock>
|
||||
</HyperlinkButton>
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToLaunch"
|
||||
Style="{StaticResource OobeSubtitleStyle}" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_VideoConference_HowToLaunch"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Margin="0,32,0,0"
|
||||
Spacing="8">
|
||||
<Button Click="SettingsLaunchButton_Click">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<TextBlock Text=""
|
||||
Margin="0,3,0,0"
|
||||
FontFamily="Segoe MDL2 Assets" />
|
||||
<TextBlock x:Uid="OOBE_Settings" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Page>
|
@ -0,0 +1,41 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeVideoConference : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeVideoConference()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.VideoConference]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
@ -977,4 +977,172 @@
|
||||
<data name="Run_PluginUseDescription.Text" xml:space="preserve">
|
||||
<value>You can include or remove each plugin from the global results, change the direct activation phrase and configure additional options.</value>
|
||||
</data>
|
||||
<data name="Oobe_GetStarted.Text" xml:space="preserve">
|
||||
<value>Let's get started!</value>
|
||||
</data>
|
||||
<data name="Oobe_PowerToysDescription.Text" xml:space="preserve">
|
||||
<value>Welcome to PowerToys! These overviews will help you quickly learn the basics of all our utilities.</value>
|
||||
</data>
|
||||
<data name="Oobe_GettingStarted.Text" xml:space="preserve">
|
||||
<value>Getting started</value>
|
||||
</data>
|
||||
<data name="Oobe_Launch.Text" xml:space="preserve">
|
||||
<value>Launch</value>
|
||||
</data>
|
||||
<data name="Oobe_LearnMore.Text" xml:space="preserve">
|
||||
<value>Learn more about</value>
|
||||
</data>
|
||||
<data name="Oobe_ColorPicker_Description" xml:space="preserve">
|
||||
<value>Color Picker is a system-wide color selection tool for Windows 10 that enables you to pick colors from any currently running application and automatically copies it in a configurable format to your clipboard.</value>
|
||||
</data>
|
||||
<data name="Oobe_FancyZones_Description" xml:space="preserve">
|
||||
<value>FancyZones is a window manager that makes it easy to create complex window layouts and quickly position windows into those layouts.</value>
|
||||
</data>
|
||||
<data name="Oobe_FileExplorer_Description" xml:space="preserve">
|
||||
<value>PowerToys introduces add-ons to the Window’s File Explorer that will currently enable Markdown files (.md) and SVG icons (.svg) to be viewed in the preview pane.</value>
|
||||
</data>
|
||||
<data name="Oobe_ImageResizer_Description" xml:space="preserve">
|
||||
<value>Image Resizer is a Windows shell extension for simple bulk image-resizing.</value>
|
||||
</data>
|
||||
<data name="Oobe_KBM_Description" xml:space="preserve">
|
||||
<value>Keyboard Manager allows you to customize the keyboard to be more productive by remapping keys and creating your own keyboard shortcuts.</value>
|
||||
</data>
|
||||
<data name="Oobe_PowerRename_Description" xml:space="preserve">
|
||||
<value>PowerRename enables you to perform simple bulk renaming, searching and replacing file names.</value>
|
||||
</data>
|
||||
<data name="Oobe_PowerRun_Description" xml:space="preserve">
|
||||
<value>PowerToys Run is a quick launcher for power users that contains some additional features without sacrificing performance.</value>
|
||||
</data>
|
||||
<data name="Oobe_ShortcutGuide_Description" xml:space="preserve">
|
||||
<value>Shortcut Guide presents the user with a listing of available shortcuts for the current state of the desktop.</value>
|
||||
</data>
|
||||
<data name="Oobe_VideoConference_Description" xml:space="preserve">
|
||||
<value>Video Conference Mute allows users to quickly mute the microphone and turn off the camera while on a conference call with a single keystroke, regardless of what application has focus on your computer.</value>
|
||||
</data>
|
||||
<data name="Oobe_Overview_CheckoutLatestVersion.Text" xml:space="preserve">
|
||||
<value>For returning users, check out what is new on this latest version of</value>
|
||||
</data>
|
||||
<data name="Oobe_Overview_Description.Text" xml:space="preserve">
|
||||
<value>Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows 10 experience for greater productivity.
|
||||
Take a moment to preview the various utilities listed or view our comprehensive documentation on</value>
|
||||
</data>
|
||||
<data name="Oobe_Overview_DescriptionLinkText.Text" xml:space="preserve">
|
||||
<value>Microsoft Docs.</value>
|
||||
</data>
|
||||
<data name="Oobe_Overview_LatestVersionLink.Text" xml:space="preserve">
|
||||
<value>PowerToys in our release notes.</value>
|
||||
</data>
|
||||
<data name="Oobe_ColorPicker_HowToUse.Text" xml:space="preserve">
|
||||
<value>Win + Shift + C to open Color Picker.</value>
|
||||
</data>
|
||||
<data name="Oobe_ColorPicker_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>To select a color with more precision, scroll the mouse wheel to zoom in.</value>
|
||||
</data>
|
||||
<data name="Oobe_FancyZones_HowToUse.Text" xml:space="preserve">
|
||||
<value>Shift + drag while dragging the window to snap a window to a zone, and release the window in the desired zone.
|
||||
Win + ` to open the FancyZones editor.</value>
|
||||
</data>
|
||||
<data name="Oobe_FancyZones_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>Snap a window to multiple zones by holding the Ctrl key (while also holding Shift) when dragging a window.</value>
|
||||
</data>
|
||||
<data name="Oobe_FileExplorer_HowToEnable.Text" xml:space="preserve">
|
||||
<value>Open Windows File Explorer, select the View tab in the File Explorer ribbon, then select Preview Pane.
|
||||
From there, simply click on a Markdown file or SVG icon in the File Explorer and observe the content on the preview pane!</value>
|
||||
</data>
|
||||
<data name="Oobe_HowToCreateMappings.Text" xml:space="preserve">
|
||||
<value>How to create mappings</value>
|
||||
</data>
|
||||
<data name="Oobe_HowToEnable.Text" xml:space="preserve">
|
||||
<value>How to enable</value>
|
||||
</data>
|
||||
<data name="Oobe_HowToLaunch.Text" xml:space="preserve">
|
||||
<value>How to launch</value>
|
||||
</data>
|
||||
<data name="Oobe_HowToUse.Text" xml:space="preserve">
|
||||
<value>How to use</value>
|
||||
</data>
|
||||
<data name="Oobe_ImageResizer_HowToLaunch.Text" xml:space="preserve">
|
||||
<value>In File Explorer, right-clicking one or more image files and clicking on Resize pictures from the context menu.</value>
|
||||
</data>
|
||||
<data name="Oobe_ImageResizer_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>Want a custom size? You can add them in the PowerToys Settings!</value>
|
||||
</data>
|
||||
<data name="Oobe_KBM_HowToCreateMappings.Text" xml:space="preserve">
|
||||
<value>Launch PowerToys settings, navigate to the Keyboard Manager menu, and select either Remap a key or Remap a shortcut.</value>
|
||||
</data>
|
||||
<data name="Oobe_KBM_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>Want to only have a shortcut work for a single application? Use the Target App field when creating the shortcut remapping.</value>
|
||||
</data>
|
||||
<data name="Oobe_PowerRename_HowToUse.Text" xml:space="preserve">
|
||||
<value>In File Explorer, right-clicking one or more selected files and clicking on PowerRename from the context menu.</value>
|
||||
</data>
|
||||
<data name="Oobe_PowerRename_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>PowerRename supports searching for files using regular expressions to enable more advanced renaming functionalities.</value>
|
||||
</data>
|
||||
<data name="Oobe_Run_HowToLaunch.Text" xml:space="preserve">
|
||||
<value>Alt + Space to open PowerToys and just start typing.</value>
|
||||
</data>
|
||||
<data name="Oobe_Run_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>PowerToys runs supports various action keys to funnel search queries for a specific subset of results. Typing < searches for running processes only, ? will search only for file, or . for installed applications! See PowerToys documentation for the complete set of 'Action Keys' available.</value>
|
||||
</data>
|
||||
<data name="Oobe_ShortcutGuide_HowToLaunch.Text" xml:space="preserve">
|
||||
<value>Win + ? to open Shortcut Guide, press it again to close or press Esc. You can also launch it by holding the Win key for one second!</value>
|
||||
</data>
|
||||
<data name="Oobe_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>Tips & tricks</value>
|
||||
</data>
|
||||
<data name="Oobe_VideoConference_HowToLaunch.Text" xml:space="preserve">
|
||||
<value>Win + N to toggle both your microphone and video
|
||||
Win + Shift + A to toggle your microphone
|
||||
Win + Shift + O to toggle your video</value>
|
||||
</data>
|
||||
<data name="Oobe_ColorPicker" xml:space="preserve">
|
||||
<value>Color Picker</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_FancyZones" xml:space="preserve">
|
||||
<value>FancyZones</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_FileExplorer" xml:space="preserve">
|
||||
<value>File Explorer add-ons</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_ImageResizer" xml:space="preserve">
|
||||
<value>ImageResizer</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_KBM" xml:space="preserve">
|
||||
<value>Keyboard Manager</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_Overview" xml:space="preserve">
|
||||
<value>Overview</value>
|
||||
</data>
|
||||
<data name="Oobe_PowerRename" xml:space="preserve">
|
||||
<value>PowerRename</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_Run" xml:space="preserve">
|
||||
<value>PowerToys Run</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_ShortcutGuide" xml:space="preserve">
|
||||
<value>Shortcut Guide</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_VideoConference" xml:space="preserve">
|
||||
<value>Video Conference</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_Welcome" xml:space="preserve">
|
||||
<value>Welcome to PowerToys</value>
|
||||
<comment>Do not localize 'PowerToys'</comment>
|
||||
</data>
|
||||
<data name="OOBE_Settings.Text" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="Oobe_Button.Text" xml:space="preserve">
|
||||
<value>PowerToys Tour</value>
|
||||
</data>
|
||||
</root>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<!--Common texts-->
|
||||
<Style x:Key="PageTitleStyle" TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontWeight" Value="SemiLight" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="{StaticResource LargeFontSize}" />
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||
<Setter Property="TextWrapping" Value="NoWrap" />
|
||||
@ -28,4 +28,9 @@
|
||||
<Style x:Key="SettingsGroupTitleStyleAsHeader" TargetType="TextBlock" BasedOn="{StaticResource SettingsGroupTitleStyle}">
|
||||
<Setter Property="Margin" Value="0,0,0,4" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="OobeSubtitleStyle" TargetType="TextBlock">
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Margin" Value="0,16,0,0" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
@ -187,6 +187,10 @@
|
||||
RelativePanel.Below="AboutImage"
|
||||
Orientation="Vertical" >
|
||||
|
||||
<HyperlinkButton Click="OobeButton_Click">
|
||||
<TextBlock x:Uid="Oobe_Button"/>
|
||||
</HyperlinkButton>
|
||||
|
||||
<HyperlinkButton x:Uid="GeneralPage_ImageHyperlinkToDocs">
|
||||
<TextBlock x:Uid="General_Repository"/>
|
||||
</HyperlinkButton>
|
||||
|
@ -122,5 +122,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
Helpers.StartProcessHelper.Start(Helpers.StartProcessHelper.ColorsSettings);
|
||||
}
|
||||
|
||||
private void OobeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShellPage.OpenOobeWindowCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,7 @@
|
||||
</ic:EventTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
<ScrollViewer x:Name="scrollViewer"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Grid.Column="0">
|
||||
<Grid Margin="{StaticResource MediumLeftRightBottomMargin}">
|
||||
<Frame x:Name="shellFrame" />
|
||||
|
@ -2,8 +2,10 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.PowerToys.Settings.UI.Services;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Windows.Data.Json;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
@ -21,6 +23,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
/// <param name="msg">message.</param>
|
||||
public delegate void IPCMessageCallback(string msg);
|
||||
|
||||
/// <summary>
|
||||
/// Declaration for the opening oobe window callback function.
|
||||
/// </summary>
|
||||
public delegate void OobeOpeningCallback();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a shell handler to be used to update contents of the shell dynamically from page within the frame.
|
||||
/// </summary>
|
||||
@ -41,6 +48,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
/// </summary>
|
||||
public static IPCMessageCallback CheckForUpdatesMsgCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets callback function for opening oobe window
|
||||
/// </summary>
|
||||
public static OobeOpeningCallback OpenOobeWindowCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets view model.
|
||||
/// </summary>
|
||||
@ -114,6 +126,15 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
CheckForUpdatesMsgCallback = implementation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set oobe opening callback function
|
||||
/// </summary>
|
||||
/// <param name="implementation">delegate function implementation.</param>
|
||||
public static void SetOpenOobeCallback(OobeOpeningCallback implementation)
|
||||
{
|
||||
OpenOobeWindowCallback = implementation;
|
||||
}
|
||||
|
||||
public static void SetElevationStatus(bool isElevated)
|
||||
{
|
||||
IsElevated = isElevated;
|
||||
@ -124,6 +145,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
IsUserAnAdmin = isAdmin;
|
||||
}
|
||||
|
||||
public static void Navigate(Type type)
|
||||
{
|
||||
NavigationService.Navigate(type);
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
shellFrame.Navigate(typeof(GeneralPage));
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Application x:Class="PowerToys.Settings.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml">
|
||||
Startup="Application_Startup">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
|
@ -2,7 +2,10 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Windows;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace PowerToys.Settings
|
||||
{
|
||||
@ -11,5 +14,60 @@ namespace PowerToys.Settings
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
private MainWindow settingsWindow;
|
||||
|
||||
public bool ShowOobe { get; set; }
|
||||
|
||||
public void OpenSettingsWindow(Type type)
|
||||
{
|
||||
if (settingsWindow == null)
|
||||
{
|
||||
settingsWindow = new MainWindow();
|
||||
}
|
||||
|
||||
settingsWindow.Show();
|
||||
settingsWindow.NavigateToSection(type);
|
||||
}
|
||||
|
||||
private void InitHiddenSettingsWindow()
|
||||
{
|
||||
settingsWindow = new MainWindow();
|
||||
|
||||
// To avoid visual flickering, show the window with a size of 0,0
|
||||
// and don't show it in the taskbar
|
||||
var originalHight = settingsWindow.Height;
|
||||
var originalWidth = settingsWindow.Width;
|
||||
settingsWindow.Height = 0;
|
||||
settingsWindow.Width = 0;
|
||||
settingsWindow.ShowInTaskbar = false;
|
||||
|
||||
settingsWindow.Show();
|
||||
settingsWindow.Hide();
|
||||
|
||||
settingsWindow.Height = originalHight;
|
||||
settingsWindow.Width = originalWidth;
|
||||
settingsWindow.ShowInTaskbar = true;
|
||||
}
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
if (!ShowOobe)
|
||||
{
|
||||
settingsWindow = new MainWindow();
|
||||
settingsWindow.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new OobeStartedEvent());
|
||||
|
||||
// Create the Settings window so that it's fully initialized and
|
||||
// it will be ready to receive the notification if the user opens
|
||||
// the Settings from the tray icon.
|
||||
InitHiddenSettingsWindow();
|
||||
|
||||
OobeWindow oobeWindow = new OobeWindow();
|
||||
oobeWindow.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
xmlns:Controls="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls"
|
||||
xmlns:xaml="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"
|
||||
mc:Ignorable="d"
|
||||
Title="PowerToys Settings" MinWidth="480" Height="800" Width="1100" Closing="MainWindow_Closing">
|
||||
Title="PowerToys Settings" MinWidth="480" Height="800" Width="1100" Closing="MainWindow_Closing" Loaded="MainWindow_Loaded" Activated="MainWindow_Activated">
|
||||
<Grid>
|
||||
<xaml:WindowsXamlHost InitialTypeName="Microsoft.PowerToys.Settings.UI.Views.ShellPage" ChildChanged="WindowsXamlHost_ChildChanged" />
|
||||
</Grid>
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
@ -16,6 +16,8 @@ namespace PowerToys.Settings
|
||||
// Interaction logic for MainWindow.xaml.
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private static Window inst;
|
||||
|
||||
private bool isOpen = true;
|
||||
|
||||
public MainWindow()
|
||||
@ -29,6 +31,23 @@ namespace PowerToys.Settings
|
||||
PowerToysTelemetry.Log.WriteEvent(new SettingsBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
|
||||
}
|
||||
|
||||
public static void CloseHiddenWindow()
|
||||
{
|
||||
if (inst != null && inst.Visibility == Visibility.Hidden)
|
||||
{
|
||||
inst.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void NavigateToSection(Type type)
|
||||
{
|
||||
if (inst != null)
|
||||
{
|
||||
Activate();
|
||||
ShellPage.Navigate(type);
|
||||
}
|
||||
}
|
||||
|
||||
private void WindowsXamlHost_ChildChanged(object sender, EventArgs e)
|
||||
{
|
||||
// If sender is null, it could lead to a NullReferenceException. This might occur on restarting as admin (check https://github.com/microsoft/PowerToys/issues/7393 for details)
|
||||
@ -63,6 +82,13 @@ namespace PowerToys.Settings
|
||||
Program.GetTwoWayIPCManager().Send(msg);
|
||||
});
|
||||
|
||||
// open oobe
|
||||
ShellPage.SetOpenOobeCallback(() =>
|
||||
{
|
||||
var oobe = new OobeWindow();
|
||||
oobe.Show();
|
||||
});
|
||||
|
||||
// receive IPC Message
|
||||
Program.IPCMessageReceivedCallback = (string msg) =>
|
||||
{
|
||||
@ -97,7 +123,15 @@ namespace PowerToys.Settings
|
||||
|
||||
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
isOpen = false;
|
||||
if (OobeWindow.IsOpened)
|
||||
{
|
||||
e.Cancel = true;
|
||||
((Window)sender).Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
isOpen = false;
|
||||
}
|
||||
|
||||
// XAML Islands: If the window is closed while minimized, exit the process. Required to avoid process not terminating issue - https://github.com/microsoft/PowerToys/issues/4430
|
||||
if (WindowState == WindowState.Minimized)
|
||||
@ -106,5 +140,18 @@ namespace PowerToys.Settings
|
||||
System.Threading.Tasks.Task.Run(() => { Environment.Exit(0); });
|
||||
}
|
||||
}
|
||||
|
||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
inst = (Window)sender;
|
||||
}
|
||||
|
||||
private void MainWindow_Activated(object sender, EventArgs e)
|
||||
{
|
||||
if (((Window)sender).Visibility == Visibility.Hidden)
|
||||
{
|
||||
((Window)sender).Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
src/settings-ui/PowerToys.Settings/OobeWindow.xaml
Normal file
@ -0,0 +1,19 @@
|
||||
<Window x:Class="PowerToys.Settings.OobeWindow"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:PowerToys.Settings"
|
||||
xmlns:Controls="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls"
|
||||
xmlns:xaml="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"
|
||||
mc:Ignorable="d"
|
||||
Title="Welcome to PowerToys"
|
||||
MinWidth="480" Height="700" Width="1100"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Loaded="Window_Loaded"
|
||||
Closed="Window_Closed">
|
||||
<Grid>
|
||||
<xaml:WindowsXamlHost InitialTypeName="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeShellPage" ChildChanged="WindowsXamlHost_ChildChanged" />
|
||||
</Grid>
|
||||
</Window>
|
88
src/settings-ui/PowerToys.Settings/OobeWindow.xaml.cs
Normal file
@ -0,0 +1,88 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Windows;
|
||||
using interop;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Views;
|
||||
using Microsoft.Toolkit.Wpf.UI.XamlHost;
|
||||
|
||||
namespace PowerToys.Settings
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for OobeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class OobeWindow : Window
|
||||
{
|
||||
private static Window inst;
|
||||
private OobeShellPage shellPage;
|
||||
|
||||
public static bool IsOpened
|
||||
{
|
||||
get
|
||||
{
|
||||
return inst != null;
|
||||
}
|
||||
}
|
||||
|
||||
public OobeWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
if (shellPage != null)
|
||||
{
|
||||
shellPage.OnClosing();
|
||||
}
|
||||
|
||||
inst = null;
|
||||
MainWindow.CloseHiddenWindow();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (inst != null)
|
||||
{
|
||||
inst.Close();
|
||||
}
|
||||
|
||||
inst = this;
|
||||
}
|
||||
|
||||
private void WindowsXamlHost_ChildChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WindowsXamlHost windowsXamlHost = sender as WindowsXamlHost;
|
||||
shellPage = windowsXamlHost.GetUwpInternalObject() as OobeShellPage;
|
||||
|
||||
OobeShellPage.SetRunSharedEventCallback(() =>
|
||||
{
|
||||
return Constants.PowerLauncherSharedEvent();
|
||||
});
|
||||
|
||||
OobeShellPage.SetColorPickerSharedEventCallback(() =>
|
||||
{
|
||||
return Constants.ShowColorPickerSharedEvent();
|
||||
});
|
||||
|
||||
OobeShellPage.SetShortcutGuideSharedEventCallback(() =>
|
||||
{
|
||||
NativeMethods.AllowSetForegroundWindow(PowerToys.Settings.Program.PowerToysPID);
|
||||
return Constants.ShowShortcutGuideSharedEvent();
|
||||
});
|
||||
|
||||
OobeShellPage.SetOpenMainWindowCallback((Type type) =>
|
||||
{
|
||||
((App)Application.Current).OpenSettingsWindow(type);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -19,10 +19,12 @@ namespace PowerToys.Settings
|
||||
Theme, // used in the old settings
|
||||
ElevatedStatus,
|
||||
IsUserAdmin,
|
||||
ShowOobeWindow,
|
||||
}
|
||||
|
||||
// Quantity of arguments
|
||||
private const int ArgumentsQty = 6;
|
||||
private const int RequiredArgumentsQty = 6;
|
||||
private const int RequiredAndOptionalArgumentsQty = 7;
|
||||
|
||||
// Create an instance of the IPC wrapper.
|
||||
private static TwoWayPipeMessageIPCManaged ipcmanager;
|
||||
@ -43,7 +45,7 @@ namespace PowerToys.Settings
|
||||
App app = new App();
|
||||
app.InitializeComponent();
|
||||
|
||||
if (args != null && args.Length >= ArgumentsQty)
|
||||
if (args != null && args.Length >= RequiredArgumentsQty)
|
||||
{
|
||||
_ = int.TryParse(args[(int)Arguments.PTPid], out int powerToysPID);
|
||||
PowerToysPID = powerToysPID;
|
||||
@ -51,6 +53,12 @@ namespace PowerToys.Settings
|
||||
IsElevated = args[(int)Arguments.ElevatedStatus] == "true";
|
||||
IsUserAnAdmin = args[(int)Arguments.IsUserAdmin] == "true";
|
||||
|
||||
if (args.Length == RequiredAndOptionalArgumentsQty)
|
||||
{
|
||||
// open oobe window
|
||||
app.ShowOobe = args[(int)Arguments.ShowOobeWindow] == "true";
|
||||
}
|
||||
|
||||
RunnerHelper.WaitForPowerToysRunner(PowerToysPID, () =>
|
||||
{
|
||||
Environment.Exit(0);
|
||||
|