Example #1
0
        private void Initialize()
        {
            toastAttributes = attributes as ToastAttributes;
            if (null == toastAttributes)
            {
                throw new Exception("Toast attribute parse error.");
            }
            ApplyAttributes(this, toastAttributes);

            toastBackground = new NPatchVisual();
            SetToastBackground();

            this.VisibilityChanged += OnVisibilityChanged;
            timer       = new Timer(toastAttributes.Duration ?? duration);
            timer.Tick += OnTick;
            timer.Start();
        }
Example #2
0
 public ToastAttributes(ToastAttributes attributes) : base(attributes)
 {
     if (null == attributes)
     {
         return;
     }
     if (null != attributes.BackgroundImageAttributes)
     {
         BackgroundImageAttributes = attributes.BackgroundImageAttributes.Clone() as ImageAttributes;
     }
     if (null != attributes.TextAttributes)
     {
         TextAttributes = attributes.TextAttributes.Clone() as TextAttributes;
     }
     TextLineHeight = attributes.TextLineHeight;
     TextLineSpace  = attributes.TextLineSpace;
     Duration       = attributes.Duration;
 }
Example #3
0
 public Toast(ToastAttributes attributes) : base(attributes)
 {
     Initialize();
 }