📄 homescreen.hpp
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
#pragma once
#ifndef __HOMESCREEN_HPP__
#define __HOMESCREEN_HPP__
#include <DialogControl.hpp>
#include <regext.h>
#include <PaintHelper.hpp>
#include <string.hxx>
#include "EnterPin.hpp"
#include <LogoScreen.hpp>
#include <SettingsApi.hpp>
class HomeScreen_t :
public DialogControl_t<HomeScreen_t>,
public LogoScreen_t
{
public:
HomeScreen_t();
~HomeScreen_t();
//WndClassName
static
const WCHAR*
GetWindowClassName(
void
);
BOOL
DialogWindowProc(
UINT Message,
WPARAM wParam,
LPARAM lParam,
bool& Handled
);
HRESULT
Initialize(
);
HRESULT
UnInitialize(
void
);
private:
enum AuthLaunchRequest_e
{
LaunchInvalid = 0,
LaunchHomescreen,
LaunchCancelSetting,
LaunchSettings,
LaunchSpeedDial,
LaunchDirectory,
LaunchMissedCalls,
};
enum TextId_e
{
TextMain = 0,
TextSub,
TextDate,
TextTime,
TextInformational,
TextInformational1 = TextInformational,
TextInformational2,
UnknownTextId, // MUST be last in the enumeration
};
inline
void
SetState(
DWORD Flag,
bool Set
);
inline
bool
HasTimeChanged(
__in const SYSTEMTIME* pTime
) const;
inline
bool
HasDateChanged(
__in const SYSTEMTIME* pTime
) const;
void
CloseHelpMessage(
void
);
void
GetAutoHandledCallText(
ce::wstring& Buffer
);
void
GetDateText(
ce::wstring& Buffer
);
void
GetMainText(
ce::wstring& Buffer
);
void
GetStatusText(
ce::wstring& Buffer
);
void
GetSubText(
ce::wstring& Buffer
);
void
GetTimeText(
ce::wstring& Buffer
);
LRESULT
OnCommand(
WORD CommandId,
WORD NotifyCode,
HWND Control
);
LRESULT
OnDestroy(
void
);
LRESULT
OnEraseBackground(
HDC hdc,
LPARAM lParam
);
LRESULT
OnGetText(
__in_ecount(cchBuffer) WCHAR* pBuffer,
int cchBuffer
);
LRESULT
OnGetTextLength(
void
);
LRESULT
OnHelp(
void
);
LRESULT
OnHotKey(
UINT HotKeyId,
short Modifiers,
short VirtualKey
);
LRESULT
OnInitDialog(
HWND ControlToReceiveFocus,
__in void* pParameters
);
LRESULT
OnNotify(
int ControlId,
__in NMHDR* pNotificationHeader
);
LRESULT
OnRegistrySettingsChange(
LPARAM lParam
);
LRESULT
OnTimer(
UINT TimerId,
__in_opt TIMERPROC* pTimerProc
);
LRESULT
OnHibernate(
void
);
void
RefreshMenuButtons(
void
);
void
RegisterNotifications(
void
);
void
UnRegisterNotifications(
void
);
HRESULT
SetHomeScreenText(
TextId_e Id
);
HRESULT
AuthenticateLaunch(
AuthLaunchRequest_e Request
);
HRESULT
OnRequestAuthenticated(
AuthLaunchRequest_e Request
);
HRESULT
LockDevice(
void
);
LRESULT
OnAuthenticateUser(
UINT NotificationMessage,
HWND NotificationWindow
);
void
OnUnlockRequestComplete(
AuthenticationResult_e Result
);
private:
enum ButtonIndex_e
{
ButtonLock = 0,
ButtonSettings,
ButtonCancel = ButtonSettings,
ButtonMissedCalls = ButtonSettings,
ButtonLast, //MUST be the last item
};
enum RegistrySetting_e
{
RegistrationStatus = 0,
AutoForwarding,
AutoForwardingNumber,
DoNotDisturb,
AutoHandledCall,
AutoHandledCallerId,
MissedCalls,
SIPAccount,
SIPAccountURI,
LoginUserName,
DeviceLocked,
RegistrySettingLast, //MUST be the last item
};
struct RegistrySetting_t
{
HKEY m_Key;
const WCHAR* m_pSubKey;
const WCHAR* m_pValue;
};
static const RegistrySetting_t sc_RegistrySettings[];
struct TextInfo_t
{
int m_ControlId;
PH_FONT m_FontId;
};
static const TextInfo_t sc_MappingTextInfo[];
static const UINT sc_AutoHandledNotificationTimeOut;
static const UINT sc_MainTimerTimeOut;
static const UINT sc_PressAndHoldTimeOut;
static const DWORD DEVICE_LOCKED;
static const DWORD WAITING_FOR_PRESS_AND_HOLD;
static const DWORD AUTOFORWARDING;
static const DWORD DO_NOT_DISTURB;
static const DWORD MISSED_CALLS;
DWORD m_State;
UINT m_AutoHandledTimerId;
UINT m_MainTimerId;
SYSTEMTIME m_LastUpdated;
UINT m_LastHotKey;
DWORD m_PressAndHoldTimeout;
short m_MenuButtonMapping[ButtonLast];
HREGNOTIFY m_Notifications[RegistrySettingLast];
DWORD m_RegistrationStatus;
DWORD m_AutoHandledCallState;
ce::wstring m_AutoForwardingNumber;
ce::wstring m_AutoHandledCallerId;
ce::wstring m_SIPAccount;
ce::wstring m_SIPAccountURI;
ce::wstring m_LoginUserName;
int m_DividerLinePosition;
HWND m_HelpMessageBox;
EnterPinDialog_t m_UnlockDialog;
AuthLaunchRequest_e m_CurrentAuthRequest;
};
#endif //!defined __MENUSCREEN_HPP__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -