Ejemplo n.º 1
0
 public static void Show(EnumMessageInfo info, string mes, int secend = 3, int width = 380, int height = 140)
 {
     GUIThreadHelper.BeginInvoke(() =>
     {
         PopMessageBox pop    = PopBoxs.Where(s => !s.IsOpen).ToArray().IsValid() ? PopBoxs.First(s => !s.IsOpen) : new PopMessageBox();
         pop.HorizontalOffset = SystemParameters.PrimaryScreenWidth - width;
         var ops            = PopBoxs.Where(s => s.IsOpen).ToArray();
         var strat          = ops.IsValid() ? ops.Min(s => s.VerticalOffset) : _StartVerticalOffset;
         pop.VerticalOffset = strat - height;
         pop.Width          = width;
         pop.Height         = height;
         pop.Message.Info   = info;
         pop.Message.Text   = mes;
         pop.Start(secend);
         if (!PopBoxs.Contains(pop))
         {
             PopBoxs.Add(pop);
         }
         //清理,最多缓存20个
         if (PopBoxs.Count > 20)
         {
             PopBoxs.RemoveWhere(s => !s.IsOpen);
         }
     });
 }
Ejemplo n.º 2
0
    /// <summary>
    /// 重启画布动画 Restart Storyboard
    /// 先stop,再Begin
    /// </summary>
    /// <param name="this"></param>
    public static void Restart(this Storyboard @this)
    {
        if (@this == null)
        {
            return;
        }
        @this.Stop();

        Executer.TryRunByThreadPool(() =>
        {
            System.Threading.Thread.Sleep(100);
            GUIThreadHelper.BeginInvoke(@this.Begin);
        });
    }
 protected override void OnPropertyChanged(PropertyChangedEventArgs e)
 {
     GUIThreadHelper.BeginInvoke(() => RaisePropertyChanged(e));
 }