/// <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;
            }
        }
        /// <summary>
        /// This method is called when when synchronization is completed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorkerForSync_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            EnableInterface(true);

            // This condition eliminates the scenario when e.Result throws an exception when the background
            // worker encounters an error or gets cancelled
            if (e.Cancelled || e.Error != null)
            {
                // This condition is met when the background worker is cancelled
                if (e.Cancelled)
                {
                    helper.Show(nsync.Properties.Resources.syncTerminated, HELPER_WINDOW_HIGH_PRIORITY, HelperWindow.windowStartPosition.windowTop);
                    LabelProgress.Content = MESSAGE_SYNC_TERMINATED;
                    ButtonSync.Visibility = Visibility.Visible;
                    ButtonPreview.Visibility = Visibility.Visible;
                }
                // This condition is met when the background worker encounters an error
                else if (e.Error != null)
                {
                    helper.Show(nsync.Properties.Resources.defaultErrorMessage, HELPER_WINDOW_HIGH_PRIORITY, HelperWindow.windowStartPosition.windowTop);
                    LabelProgress.Content = MESSAGE_ERROR_DETECTED;
                    ButtonSync.Visibility = Visibility.Hidden;
                    ButtonPreview.Visibility = Visibility.Hidden;
                }
                LabelProgressPercent.Visibility = Visibility.Hidden;
                ImageTeam14Over.OpacityMask = blankOpacityMask;

                IsFolderExist();
                return;
            }
            else
            {
                if (!(bool)e.Result)
                {
                    debugLogger.LogMessage(actualLeftPath, actualRightPath, "backgroundWorkerForSync_RunWorkerCompleted()", nsync.Properties.Resources.insufficientDiskSpace);
                    helper.Show(nsync.Properties.Resources.insufficientDiskSpace, HELPER_WINDOW_HIGH_PRIORITY, HelperWindow.windowStartPosition.windowTop);
                    LabelProgress.Content = MESSAGE_ERROR_DETECTED;
                    LabelProgressPercent.Visibility = Visibility.Hidden;
                    ImageTeam14Over.OpacityMask = blankOpacityMask;
                    ButtonSync.Visibility = Visibility.Hidden;
                    ButtonPreview.Visibility = Visibility.Hidden;
                    IsFolderExist();
                    return;
                }

                if (synchronizer.IsFoldersSync())
                {
                    ImageTeam14Over.OpacityMask = blankOpacityMask;

                    // Update MRU
                    SaveFolderPaths();
                    ReloadFolderPaths();

                    LabelProgress.Content = MESSAGE_SYNC_COMPLETED;
                    LabelProgressPercent.Content = "100 %";
                    helper.Show(nsync.Properties.Resources.synchronizedFolders, HELPER_WINDOW_HIGH_PRIORITY, HelperWindow.windowStartPosition.windowTop);
                    debugLogger.LogMessage(actualLeftPath, actualRightPath, "backgroundWorkerForSync_RunWorkerCompleted()", nsync.Properties.Resources.synchronizedFolders);
                    return;
                }

                previewSync = new Preview();
                previewSync.LeftPath = actualLeftPath;
                previewSync.RightPath = actualRightPath;
                // If filters were activated, let summary sync know as well.
                int excludeWindowStatus = settingsManager.GetExcludeWindowStatus();
                if (excludeWindowStatus == 1)
                {
                    previewSync.ExcludeData = excludeData;
                }
                else if (excludeWindowStatus == 0)
                {
                    excludeData = new ExcludeData();
                    previewSync.ExcludeData = excludeData;
                }

                debugLogger.LogMessage(actualLeftPath, actualRightPath, "backgroundWorkerForSync_RunWorkerCompleted()", "Sync done!");

                previewSync.backgroundWorkerForSummary.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorkerForSummary_RunWorkerCompleted);
                previewSync.SummarySync();
            }
        }