internal void SyncCompReplace(PNSyncComp sc)
 {
     try
     {
         var s = _SyncComps.FirstOrDefault(scd => scd.CompName == sc.CompName);
         if (s == null) return;
         s.DataDir = sc.DataDir;
         s.DBDir = sc.DBDir;
         s.UseDataDir = sc.UseDataDir;
         fillSyncComps(false);
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
 internal WndSyncComps(WndSettings prefs, PNSyncComp sc, AddEditMode mode):this()
 {
     _Prefs = prefs;
     _Mode = mode;
     _SyncComp = sc;
 }
 internal void SyncCompAdd(PNSyncComp sc)
 {
     try
     {
         _SyncComps.Add(sc);
         fillSyncComps(false);
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
 private void cmdOK_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (_Mode == AddEditMode.Add && _Prefs.SyncCompExists(txtCompName.Text.Trim()))
         {
             string message = PNLang.Instance.GetMessageText("sync_comp_exists", "Local synchronization target with this name already exists");
             PNMessageBox.Show(message, PNStrings.PROG_NAME, MessageBoxButton.OK, MessageBoxImage.Information);
             //_PreventUnload = true;
         }
         else
         {
             var sc = new PNSyncComp { CompName = txtCompName.Text.Trim(), DataDir = txtDataDir.Text.Trim(), UseDataDir = chkUseDataDir.IsChecked != null && chkUseDataDir.IsChecked.Value };
             if (chkUseDataDir.IsChecked != null && !chkUseDataDir.IsChecked.Value)
             {
                 sc.DBDir = txtDBDir.Text.Trim();
             }
             if (_Mode == AddEditMode.Add)
                 _Prefs.SyncCompAdd(sc);
             else
                 _Prefs.SyncCompReplace(sc);
             DialogResult = true;
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }