public MyTask() { InitializeComponent(); #region 创建状态栏图标 bar.Left = SystemParameters.WorkArea.Size.Width - bar.Width; bar.Top = SystemParameters.WorkArea.Size.Height - bar.Height; bar.txtMessage.Text = "我的任务已启动"; bar.Show(); bar.Topmost = true; bar.CloseMessage(10); #endregion this.ItemTask.ItemsSource = tasklist; tasklist.Add(new TaskViewModel() { Id = 1, DateCreate = DateTime.Now, Description = "my first Task", IsRemind = true, Name = "完成演讲ppt", PlanFinishDate = DateTime.Now });; }
private void ShowMessage(string message, int?delay = 5) { TaskBar bar = new TaskBar(); bar.Left = SystemParameters.WorkArea.Size.Width - bar.Width; bar.Top = SystemParameters.WorkArea.Size.Height - bar.Height; bar.Topmost = true; bar.txtMessage.Text = message; bar.Show(); if (delay.HasValue) { bar.CloseMessage(delay.Value); } }