Exemplo n.º 1
0
        /// <summary>
        /// TrackBackPage Contructor
        /// </summary>
        public TrackBackPage()
        {
            InitializeComponent();

            settingsManager = Settings.Instance;

            // Get the debugLogger class instance
            debugLogger = DebugLogger.Instance;

            helper = new HelperManager(mainWindow);

            // Disables the TrackBackPage interface if no folder pairs are loaded in HomePage
            if (!File.Exists(SETTINGS_FILE_NAME) || settingsManager.LoadFolderPaths()[0] == "")
            {
                HideListViewForBothFolders(false);
                return;
            }
            else
            {
                LoadTrackBackXML();

                trackback = new TrackBackEngine();
                trackback.LeftFolderPath  = actualLeftFolderPath;
                trackback.RightFolderPath = actualRightFolderPath;

                // Displays the message 'No TrackBack Data' if the folder does not have any previously backed up folders
                if (trackback.hasTrackBackData(actualLeftFolderPath) && trackback.hasTrackBackData(actualRightFolderPath))
                {
                    GridTrackBack.IsEnabled = true;
                }
                else if (trackback.hasTrackBackData(actualLeftFolderPath))
                {
                    DisplayListViewForLeftFolderOnly(true);
                }
                else if (trackback.hasTrackBackData(actualRightFolderPath))
                {
                    DisplayListViewForRightFolderOnly(true);
                }
                else
                {
                    HideListViewForBothFolders(false);
                }

                // Adds the event handler for Restore
                trackback.backgroundWorkerForTrackBackRestore.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(backgroundWorkerForTrackBackRestore_RunWorkerCompleted);
            }
        }
        /// <summary>
        /// This method will be called when HomePage is loaded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //Create blank opacity mask
            blankOpacityMask = new LinearGradientBrush();
            blankOpacityMask.GradientStops.Add(new GradientStop(Colors.Transparent, 0));
            blankOpacityMask.GradientStops.Add(new GradientStop(Colors.Transparent, 1));
            ImageTeam14Over.OpacityMask = blankOpacityMask;

            //Create SyncEngine object
            synchronizer = new SyncEngine();
            trackback = new TrackBackEngine();

            // Initialize folder path array
            originalFolderPaths = new string[10];
            for (int i = 0; i < 10; i++)
            {
                originalFolderPaths[i] = "";
            }

            // Create respective event handlers
            synchronizer.backgroundWorkerForSync.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorkerForSync_RunWorkerCompleted);
            synchronizer.backgroundWorkerForSync.ProgressChanged += new ProgressChangedEventHandler(backgroundWorkerForSync_ProgressChanged);

            synchronizer.backgroundWorkerForPreSync.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorkerForPreSync_RunWorkerCompleted);

            trackback.backgroundWorkerForTrackBackBackup.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorkerForTrackBackBackup_RunWorkerCompleted);

            //Load the previous folder paths from settings.xml
            LoadFolderPaths();

            //Add event handler to check when main window is moved, move helper window too
            mainWindow.LocationChanged += new EventHandler(mainWindow_LocationChanged);

            debugLogger.LogMessage(actualLeftPath, actualRightPath, "HomePage.Page_Loaded()", "Homepage loaded in");
        }
        /// <summary>
        /// TrackBackPage Contructor
        /// </summary>
        public TrackBackPage()
        {
            InitializeComponent();

            settingsManager = Settings.Instance;

            // Get the debugLogger class instance
            debugLogger = DebugLogger.Instance;

            helper = new HelperManager(mainWindow);

            // Disables the TrackBackPage interface if no folder pairs are loaded in HomePage
            if (!File.Exists(SETTINGS_FILE_NAME) || settingsManager.LoadFolderPaths()[0] == "")
            {
                HideListViewForBothFolders(false);
                return;
            }
            else
            {
                LoadTrackBackXML();

                trackback = new TrackBackEngine();
                trackback.LeftFolderPath = actualLeftFolderPath;
                trackback.RightFolderPath = actualRightFolderPath;

                // Displays the message 'No TrackBack Data' if the folder does not have any previously backed up folders
                if (trackback.hasTrackBackData(actualLeftFolderPath) && trackback.hasTrackBackData(actualRightFolderPath))
                {
                    GridTrackBack.IsEnabled = true;
                }
                else if (trackback.hasTrackBackData(actualLeftFolderPath))
                {
                    DisplayListViewForLeftFolderOnly(true);
                }
                else if (trackback.hasTrackBackData(actualRightFolderPath))
                {
                    DisplayListViewForRightFolderOnly(true);
                }
                else
                {
                    HideListViewForBothFolders(false);
                }

                // Adds the event handler for Restore
                trackback.backgroundWorkerForTrackBackRestore.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(backgroundWorkerForTrackBackRestore_RunWorkerCompleted);
            }
        }