Exemplo n.º 1
0
 public void DeleteApp(ScheduledApplication app)
 {
     try
     {
         lock (LockObject)
         {
             Apps.Remove(app);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemplo n.º 2
0
 public void AddApplication(ScheduledApplication app)
 {
     try
     {
         lock (LockObject)
         {
             Apps.Add(app);
             Apps = Apps.OrderBy(a => a.ScheduledTime).ToList();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         //TODO: save to file
     }
 }
Exemplo n.º 3
0
 private void AddToSchedule()
 {
     try
     {
         ScheduledApplication app = new ScheduledApplication();
         app.Name          = AppPathBox.Text;
         app.ScheduledTime = DateTime.Now;
         TimeSpan ts = new TimeSpan(int.Parse(HoursBox.Text) - DateTime.Now.Hour,
                                    int.Parse(MinutesBox.Text) - DateTime.Now.Minute, 0);
         app.ScheduledTime += ts;
         schedule.AddApplication(app);
         scheduleBox.ItemsSource = schedule.Apps;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 4
0
 public void ExecuteApp(ScheduledApplication app)
 {
     if (Apps.IndexOf(app) != -1)
     {
         try
         {
             lock (LockObject)
             {
                 Apps.Remove(app);
                 Process.Start(app.Name);
             }
         }
         catch (Exception ex)
         {
             Apps.Remove(app);
             Console.WriteLine(ex.Message);
         }
     }
 }