Beispiel #1
0
        private static void ToastBase(string title, System.Drawing.Bitmap bitmap, Brush color, string msg = null, Action func = null)
        {
            IncrementToastCount();
            var toast = new ToastView();

            var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;

            var toastHeight   = (int)(toast.Height + 10);
            var desktopHeight = (int)(desktopWorkingArea.Height / toastHeight);

            var XOffset = (ToastController.Instance.Offset / desktopHeight) + 1;
            var YOffset = XOffset > 1
                ? (ToastController.Instance.Offset % desktopHeight) + 1
                : (ToastController.Instance.Offset % desktopHeight);

            toast.Left = desktopWorkingArea.Right - XOffset * toast.Width;
            toast.Top  = desktopWorkingArea.Bottom - YOffset * toastHeight;

            toast.Image.Source        = BitmapSourceConverter.ConvertFromImage(bitmap);
            toast.bgColour.Background = color;
            toast.Title.Text          = title;
            if (msg == null)
            {
                toast.Message.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                toast.Message.Text = msg;
            }

            if (func != null)
            {
                toast.OnClickEvent += new ToastView.OnClick(func);
            }

            toast.Show();
        }
Beispiel #2
0
 public Button SetSmallImage(Bitmap smallImage)
 {
     _smallImage = BitmapSourceConverter.ConvertFromImage(smallImage);
     return(this);
 }
Beispiel #3
0
 public Button SetLargeImage(Bitmap largeImage)
 {
     _largeImage = BitmapSourceConverter.ConvertFromImage(largeImage);
     return(this);
 }