public IPredefinedToastNotificationContent CreateContent(string bodyText)
            {
                PredefinedToastNotificationVewModel vm = CreateDefaultViewModel();

                vm.ToastTemplate = NotificationTemplate.LongText;
                vm.Text1         = bodyText;
                return(new WpfPredefinedToastNotificationContent(vm));
            }
            public IPredefinedToastNotificationContent CreateTwoLineHeaderContent(string headlineText, string bodyText)
            {
                PredefinedToastNotificationVewModel vm = CreateDefaultViewModel();

                vm.ToastTemplate = NotificationTemplate.LongHeaderAndShortText;
                vm.Text1         = headlineText;
                vm.Text2         = bodyText;
                return(new WpfPredefinedToastNotificationContent(vm));
            }
            public IPredefinedToastNotificationContent CreateOneLineHeaderContent(string headlineText, string bodyText1, string bodyText2)
            {
                PredefinedToastNotificationVewModel vm = CreateDefaultViewModel();

                vm.ToastTemplate = NotificationTemplate.ShortHeaderAndTwoTextFields;
                vm.Text1         = headlineText;
                vm.Text2         = bodyText1;
                vm.Text3         = bodyText2;
                return(new WpfPredefinedToastNotificationContent(vm));
            }
 static PredefinedToastNotificationVewModel CreateDefaultViewModel() {
     Icon icon = Icon.ExtractAssociatedIcon(Environment.GetCommandLineArgs()[0]);
     BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHIcon(
                 icon.Handle,
                 new System.Windows.Int32Rect(0, 0, icon.Width, icon.Height),
                 BitmapSizeOptions.FromEmptyOptions());
     var vm = new PredefinedToastNotificationVewModel();
     vm.Icon = bitmapSource;
     vm.BackgroundColor = BackgroundCalculator.GetBestMatch(icon.ToBitmap());
     return vm;
 }
            static PredefinedToastNotificationVewModel CreateDefaultViewModel()
            {
                var  vm   = new PredefinedToastNotificationVewModel();
                Icon icon = ExtractAssociatedIcon(Environment.GetCommandLineArgs()[0]);

                if (icon != null)
                {
                    BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHIcon(
                        icon.Handle,
                        new System.Windows.Int32Rect(0, 0, icon.Width, icon.Height),
                        BitmapSizeOptions.FromEmptyOptions());
                    vm.Icon            = bitmapSource;
                    vm.BackgroundColor = BackgroundCalculator.GetBestMatch(icon.ToBitmap());
                }
                else
                {
                    vm.BackgroundColor = BackgroundCalculator.DefaultGrayColor;
                }
                return(vm);
            }
Esempio n. 6
0
 public WpfPredefinedToastNotificationContent(PredefinedToastNotificationVewModel viewModel)
 {
     ViewModel = viewModel;
     Duration  = msDefaultDuration;
 }
 public WpfPredefinedToastNotificationContent(PredefinedToastNotificationVewModel viewModel) {
     ViewModel = viewModel;
     Duration = msDefaultDuration;
 }