Windows form uygulamasını kullanarak toast bildirimlerini kullanmak istiyorum.
Universal app de sorun olmuyor çalışıyor fakat windows app de bir türlü çalıştıramadım stackoverflowda bikaç konu inceledim hiç bir şekilde çalıştıramadım. Yardımlarınızı bekliyorum.
kodlarım;
https://stackoverflow.com/questions/56238528/windows-10-8-toast-notification-for-windows-form-application?noredirect=1#comment99119621_56238528 kodlarımın olduğu link
namespace WindowsFormsApp1 { public partial class Form1: Form { [DllImport("shell32.dll", SetLastError = true)] static extern void SetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] string AppID); private const String APP_ID = "Microsoft.Samples.WindowsFormsApp1"; public Form1() { SetCurrentProcessExplicitAppUserModelID(APP_ID); InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) {} private void button1_Click(object sender, EventArgs e) { GenerateToast("Titleee", "Contenttt"); } public void GenerateToast(string header, string content) { ToastTemplateType toastTemplate = ToastTemplateType.ToastImageAndText02; XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate); XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text"); toastTextElements[0].AppendChild(toastXml.CreateTextNode(header)); toastTextElements[1].AppendChild(toastXml.CreateTextNode(content)); XmlNodeList toastImageElements = toastXml.GetElementsByTagName("image"); ((XmlElement) toastImageElements[0]).SetAttribute("src", "Resources\Pixelkit-Flat-Jewels-Chat.ico"); IXmlNode toastNode = toastXml.SelectSingleNode("/toast"); ((XmlElement) toastNode).SetAttribute("duration", "long"); ToastNotification toast = new ToastNotification(toastXml); try { ToastNotificationManager.CreateToastNotifier(APP_ID).Show(toast); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }}