private void OnRiminderTimeOut(RiminderController riminder) { DeleteRimender(riminder); ParameterizedThreadStart parameterizedThreadStart = new ParameterizedThreadStart(ShowReminder); Thread newWindowThread = new Thread(parameterizedThreadStart); newWindowThread.SetApartmentState(ApartmentState.STA); newWindowThread.IsBackground = true; newWindowThread.Start(riminder); }
public void DeleteRimender(RiminderController reminder) { lock (locker) { Application.Current.Dispatcher.Invoke(reminder.RemoveReminder); using (DB db = new DB()) { db.DeleteRiminder(reminder.reminder); db.UpdateWorkTask(reminder.workTask); } } if (SelectWorkTask == reminder.workTask) { OnPropertyChanged("GetText"); } }
public void AddRimender(RiminderController reminder) { lock (locker) { reminder.reminder.Id = Guid.NewGuid(); Application.Current.Dispatcher.Invoke(reminder.AddReminder); using (DB db = new DB()) { db.InsertRiminder(reminder.reminder); db.UpdateWorkTask(reminder.workTask); } } if (SelectWorkTask == reminder.workTask) { OnPropertyChanged("GetText"); } }
private void ShowReminder(object o) { RiminderController riminder = o as RiminderController; ReminderWindow reminderWindow = new ReminderWindow(); reminderWindow.DataContext = riminder.reminder; reminderWindow.OnRememberAfterOneDay += () => { riminder.DateReminder = riminder.DateReminder.AddDays(1); AddRimender(riminder); }; reminderWindow.OnRememberAfterOneHours += () => { riminder.DateReminder = riminder.DateReminder.AddHours(1); AddRimender(riminder); }; reminderWindow.Show(); System.Windows.Threading.Dispatcher.Run(); }