/// <summary> /// This method is called when the preview button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonPreview_Click(object sender, RoutedEventArgs e) { debugLogger.LogMessage(actualLeftPath, actualRightPath, "ButtonPreview_Click()", "User clicked on preview button"); if (!ShowSync()) return; bool leftDirectoryAccessible = IsDirectoryAccessible(actualLeftPath); bool rightDirectoryAccessible = IsDirectoryAccessible(actualRightPath); if (leftDirectoryAccessible && rightDirectoryAccessible) { if (!settingsManager.IsFoldersLocked()) { EnableInterface(false); previewSync = new Preview(); previewSync.LeftPath = actualLeftPath; previewSync.RightPath = actualRightPath; previewSync.ExcludeData = settingsManager.LoadExcludeData(actualLeftPath, actualRightPath); previewSync.backgroundWorkerForPreview.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorkerForPreview_RunWorkerCompleted); previewSync.PreviewSync(); // Updates UI LabelProgress.Visibility = Visibility.Visible; LabelProgress.Content = MESSAGE_PREPARING_FOLDERS; } } else { string rightsString = nsync.Properties.Resources.accessRightsInsufficient; if (!leftDirectoryAccessible) rightsString += "\n" + ShortenPath(actualLeftPath, 50); if (!rightDirectoryAccessible) rightsString += "\n" + ShortenPath(actualRightPath, 50); helper.Show(rightsString, HELPER_WINDOW_HIGH_PRIORITY, HelperWindow.windowStartPosition.windowTop); LabelProgress.Content = MESSAGE_ERROR_DETECTED; LabelProgress.Visibility = Visibility.Visible; } }