예제 #1
0
        public static void Info(string title, string msg = "")
        {
            ToastWrapper toast = Create(title, msg);

            toast.Type = ToastTypes.Info;
            toast.Show(DisplayTime);
        }
예제 #2
0
        private static ToastWrapper Create(string text, string msg = "")
        {
            string title   = string.Empty;
            string message = string.Empty;

            if (string.IsNullOrEmpty(msg))
            {
                int i = text.IndexOf(' ');
                if (i < 0)
                {
                    message = text;
                }
                else
                {
                    title   = text.Substring(0, i);
                    message = text.Substring(i, text.Length - i);
                }
            }
            else
            {
                title   = text;
                message = msg;
            }
            ToastNotification notification = new ToastNotification()
            {
                Title   = title,
                Message = message
            };
            //Create a toast and accompanying dispatcher timer.
            ToastWrapper toast = new ToastWrapper(notification);

            toast.ToastClosing += Toast_ToastClosing;
            //Add the toast to the host window
            _Host.Toasts.Add(notification);
            //display it for X seconds
            return(toast);
        }