Ejemplo n.º 1
0
 /// <summary>
 /// Receive edited service from the EditViewModel
 /// </summary>
 private void getServiceEdit()
 {
     Messenger.Default.Register <ServiceItem>(
         this,
         service =>
     {
         if (SelectedServicesCollection.Any(x => x.OriginalDisplayName == service.OriginalDisplayName))
         {
             SelectedServicesCollection[SelectedServicesCollection.IndexOf(service)].DisplayName = service.DisplayName;
             SelectedServicesCollection[SelectedServicesCollection.IndexOf(service)].Description = service.Description;
         }
     });
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Save services in SelectedServicesCollection when programm closes
 /// </summary>
 private void saveServices()
 {
     try
     {
         ServiceManager.SetSavedServiceItems(SelectedServicesCollection.ToList());
     }
     catch (Exception ex)
     {
         string caption          = "Save error";
         string exception        = ex.Message;
         string exceptionMessage = String.Format("{0} {1}", exception, "\n" + ex.InnerException ?? ex.InnerException.Message);
         base.ShowErrorMessage(exceptionMessage, caption);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Get selected services from the collection of services on the AddWindow
 /// </summary>
 private void displaySelectedServices()
 {
     Messenger.Default.Register <ObservableCollection <ServiceItem> >(
         this,
         services =>
     {
         foreach (ServiceItem service in services)
         {
             if (!SelectedServicesCollection.Any(x => x.DisplayName == service.DisplayName))
             {
                 SelectedServicesCollection.Add(service);
             }
         }
     });
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Refresh all services in datagrid selected or not, check if still exists and display info message if was removed
 /// </summary>
 private void refreshAllServicesStatus()
 {
     if (SelectedServicesCollection.Count != 0)
     {
         foreach (ServiceItem service in SelectedServicesCollection.ToList())
         {
             if (ServiceManager.IsServiceExists(service.ServiceName))
             {
                 service.Status    = ServiceManager.RefreshStatus(service).Status;
                 service.StartMode = ServiceManager.RefreshStatus(service).StartMode;
             }
             else
             {
                 SelectedServicesCollection.Remove(service);
                 base.ShowInfoMessage(service.DisplayName + " " + "(" + service.ServiceName + ")" + " " + "was removed", "Load Info");
             }
         }
     }
 }