Winforms interface development skills: Shows Apps, Toast Notifications (a)

Download the full version of DevExpress v19.2

DevExpress Winforms Controls built more than 140 UI controls and libraries, build perfect and smooth, beautiful and easy to use application. Using WinForms PictureEdit control, images can be displayed on the form. To control implements DirectX rendering support, you can easily handle large, high DPI image. I want to experience? Click to download >>

Toast Notifications (or simply Toasts) is initially introduced in the plane notice 8 of Microsoft Windows, they will pop up in the lower right corner of the screen and can be accessed through the Windows operating center. You can use DevExpress ToastNotificationManager components will merge these notifications to the next Windows Forms application.

DevExpress Winforms tutorial tips

WinForms Toast Notification Manager is available in nine notification templates / styles - including Windows 10 generic template that allows you to merge user interactive controls, such as buttons or editor.

DevExpress Winforms tutorial tips

Application shortcuts

DevExpress WinForms Toast Notification Manager generates a genuine Windows Toast, notification systems like these toasts as:

  • Even if the associated application is closed, Toasts will appear.
  • Toasts can be accessed from the operations center.
  • Toasts operating system using the same color scheme.

To provide this feature, you must use the native Windows API and follow all the guidelines and requirements of Microsoft, including Microsoft's application shortcuts requirements.

In the past, Microsoft's demands for application shortcuts controversial, recent technical team in the design of smaller improvements and add new sections and pages in the document assembly, to help solve this problem.

Microsoft在其Toast Notifications Overview中明确声明,如果应用程序在Windows Start屏幕中没有快捷方式方式,则它将无法显示Toast。

DevExpress Winforms tutorial tips

由于Start屏幕快捷方式存储在 %AppData%\Microsoft\Windows\Start Menu\Programs 文件夹中,因此需要遵循一个简单的规则:如果要显示toast,请将应用程序快捷方式添加到Start Menu文件夹中。

组件在其智能标记菜单中包含"Create Application Shortcut"连接,单击此链接后,您的应用将正确显示通知。

DevExpress Winforms tutorial tips

"Create Application Shortcut"命令将快捷方式添加到个人的Start屏幕,换句话说,创建应用程序快捷方式的PC是唯一可以显示toast的机器,其他任何计算机的Start屏幕都没有指向应用程序的快捷方式。如果要显示所有用户的toast,请记住您的应用程序安装程序配置在%AppData%\Microsoft\Windows\Start Menu\Programs文件夹中添加快捷方式(具有有效的AppUserModelID)。

最好的选择是使用安装程序将此快捷方式添加到用户计算机,如果这不是一个选择或您没有安装程序,则可以使用DevExpress.Data.ShellHelper.TryCreateShortcut方法添加适当的快捷方式。

using DevExpress.XtraBars.ToastNotifications;
using DevExpress.Data;

//if there's no app shortcut in the start screen, add it
if (!ShellHelper.IsApplicationShortcutExist("My Test App")) {
ShellHelper.TryCreateShortcut(
applicationId: manager.ApplicationId,
name: "My Test App");
//restart the app
Application.Restart();
}

Please note that the reliability of the method TryCreateShortcut reliable than other methods. First, your application may not have the necessary permission to write files to the system folder. Secondly, note the use of the above method Application.Restart code fragment. If the application is already running, it will add a shortcut to the Start screen will not be enabled Toast, need to re-start the application.


DevExpress v19.2 line open class is about to commence, the top 10 free participation Oh ~

DevExpress technical exchange group: 540 330 292 welcome into the group together to discuss

Scan attention DevExpress Chinese micro-channel public network number, timely access to the latest developments and the latest information

DevExpress Chinese micro-channel network

Guess you like

Origin www.cnblogs.com/AABBbaby/p/12376139.html