public FileSystemMonitorServer(FolderTraceProfile profile)
 {
     serverState = ServerState.Stopped;
     ActiveProfile = profile;
 }
 private void ApplyProfileToServer()
 {
     FolderTraceProfile profile = new FolderTraceProfile();
     for (int i = 0; i < gridTraces.Rows.Count; i++)
     {
         FolderTrace trace = (FolderTrace)gridTraces.Rows[i].Tag;
         if (trace != null && trace.State == FolderTraceState.Running)
         {
             profile.Traces.Add(trace);
         }
     }
     try
     {
         DataProvider.Server.ActiveProfile = profile;
     }
     catch (Exception ex)
     {
         EventLogger.RecordException(Constants.AdminApplicationEventSource, ex, "Failed to connect to server: ");
         FormHelper.ShowErrorMessage("Cannot establish connection to server! Please check that the service is started.", "Error");
     }
 }