コード例 #1
0
        public void ShowNotification(NotificationContentModel model)
        {
            ToastContent content = new ToastContent
            {
                Visual = new ToastVisual
                {
                    BindingGeneric = new ToastBindingGeneric
                    {
                        Children =
                        {
                            new AdaptiveText
                            {
                                Text = model.Title
                            },
                            new AdaptiveText
                            {
                                Text = model.Message
                            }
                        }
                    }
                }
            };

            ToastNotification notification = new ToastNotification(content.GetXml());

            ToastNotificationManager.CreateToastNotifier().Show(notification);
        }
        public static void SetCallbackType(this Operation operation, SchemaRegistry schemaRegistry, Type callbackType, string description)
        {
            operation.EnsureVendorExtensions();

            if (!operation.vendorExtensions.ContainsKey(Constants.X_MS_NOTIFICATION_CONTENT))
            {
                var schemaInfo = schemaRegistry.GetOrRegister(callbackType);

                var notificationData = new NotificationContentModel()
                {
                    Description = description,
                    Schema      = new SchemaModel(schemaInfo)
                };

                operation.vendorExtensions.Add(Constants.X_MS_NOTIFICATION_CONTENT,
                                               notificationData);
            }
        }