예제 #1
0
        /// <inheritdoc />
        protected override void OnPluginCrashed(PluginInstance pluginInstance)
        {
            ToastContent toastContent = new ToastContent
            {
                Visual = new ToastVisual
                {
                    BindingGeneric = new ToastBindingGeneric
                    {
                        Children =
                        {
                            new AdaptiveText
                            {
                                Text = $"{pluginInstance.ToString().CapitalizeFirst()} has crashed."
                            }
                        }
                    }
                },
                Actions = new ToastActionsCustom
                {
                    Buttons =
                    {
                        // Restart action
                        new ToastButton("Restart",
                                        new QueryString
                        {
                            { "action",                        ToastActionRestartAfterCrash},
                            { ToastActionParameterPluginId,    pluginInstance.Package.Id  }
                        }.ToString())
                        {
                            ActivationType = ToastActivationType.Background
                        },

                        // Open logs folder action
                        new ToastButton("Open the logs folder",SMAFileSystem.LogDir.FullPathWin)
                        {
                            ActivationType = ToastActivationType.Protocol
                        }
                    }
                }
            };

            var doc = new XmlDocument();

            doc.LoadXml(toastContent.GetContent());

            // And create the toast notification
            var toast = new ToastNotification(doc);

            // And then show it
            DesktopNotificationManager.CreateToastNotifier().Show(toast);
        }
예제 #2
0
        /// <inheritdoc />
        protected override void OnPluginCrashed(PluginInstance pluginInstance)
        {
            $"{pluginInstance.ToString().CapitalizeFirst()} has crashed.".ShowDesktopNotification(
                // Restart action
                new ToastButton("Restart",
                                new QueryString
            {
                { "action", ToastActionRestartAfterCrash },
                { ToastActionParameterPluginId, pluginInstance.Package.Id }
            }.ToString())
            {
                ActivationType = ToastActivationType.Background
            },

                // Open logs folder action
                new ToastButton("Open the logs folder", SMAFileSystem.LogDir.FullPathWin)
            {
                ActivationType = ToastActivationType.Protocol
            }
                );
        }