コード例 #1
0
        /// <summary>
        /// Displays the file cleanup output file.
        /// </summary>
        private void DisplayDeletedFileList()
        {
            if ( moProfile.bValue("-ShowDeletedFileList", false) )
            {
                if ( !this.mbHasNoDeletionGroups )
                {
                    string lsFileAsStream = this.sFileAsStream(this.sDeletedFileListOutputPathFile);

                    if ( null != lsFileAsStream )
                    {
                        ScrollingText   loFileList = new ScrollingText(lsFileAsStream, "Deleted File List");
                                        loFileList.TextBackground = Brushes.LightYellow;
                                        loFileList.TextFontFamily = new FontFamily("Courier New");
                                        loFileList.Show();

                                        if ( null != this.oUI )
                                        this.oUI.oOtherWindows.Add(loFileList);
                    }
                }
                else
                {
                    string lsFileGroup1 = moProfile.sValue("-CleanupSet", "One of many file groups to delete goes here.");

                    this.ShowError(
                              string.Format(@"
Here's what you have configured:

-CleanupSet={0}


Please add at least one '-FilesToDelete=' reference. See 'Help' for examples.

No file cleanup will be done until you update the configuration.
"                           , lsFileGroup1)
                            , "No File Cleanup Sets Defined"
                            );
                }
            }
        }
コード例 #2
0
ファイル: UI.xaml.cs プロジェクト: GeorgeSchiro/GoPcBackup
        private void ShowHelp()
        {
            if ( this.bNoPrompts )
                return;

            // If a help window is already open, close it.
            foreach (ScrollingText loWindow in moOtherWindows)
            {
                if ( loWindow.Title.Contains("Help") )
                {
                    loWindow.Close();
                    moOtherWindows.Remove(loWindow);
                    break;
                }
            }

            ScrollingText   loHelp = new ScrollingText(moProfile["-Help"].ToString(), "Backup Help", true);
                            loHelp.TextBackground = Brushes.Khaki;
                            loHelp.Show();

                            moOtherWindows.Add(loHelp);
        }
コード例 #3
0
        /// <summary>
        /// Displays the given file (ie. asPathFile) using whatever
        /// application is associated with its filename extension.
        /// </summary>
        private void DisplayFileAsErrors(string asFileAsStream, string asCaption)
        {
            ScrollingText   loErrors = new ScrollingText(asFileAsStream, asCaption);
                            loErrors.Show();

                            if ( null != this.oUI )
                            this.oUI.oOtherWindows.Add(loErrors);
        }
コード例 #4
0
ファイル: UI.xaml.cs プロジェクト: GeorgeSchiro/GoPcBackup
        // This method is called before anything else (after init & load events).
        // Most of the UI initialization code goes here.
        private void LogoImageAnimation_Completed(object sender, EventArgs e)
        {
            mbStartupDone = true;

            if ( !moProfile.bValue("-AllConfigWizardStepsCompleted", false) )
            {
                if ( moProfile.bValue("-LicenseAccepted", false) )
                {
                    this.DisplayWizard();
                }
                else
                {
                    const string lsLicenseCaption = "MIT License";
                    const string lsLicensePathFile = "MIT License.txt";

                    // Fetch license.
                    tvFetchResource.ToDisk(Application.ResourceAssembly.GetName().Name
                            , lsLicensePathFile, null);

                    ScrollingText loLicense = null;

                    if ( !this.bNoPrompts )
                    {
                        tvMessageBox.ShowBriefly(this, string.Format("The \"{0}\" will now be displayed."
                                        + "\r\n\r\nPlease accept it if you would like to use this software."
                                , lsLicenseCaption), lsLicenseCaption, tvMessageBoxIcons.Information, 3000);

                        loLicense = new ScrollingText(moDoGoPcBackup.sFileAsStream(
                                              moProfile.sRelativeToProfilePathFile(lsLicensePathFile))
                                            , lsLicenseCaption, true);
                        loLicense.TextBackground = Brushes.LightYellow;
                        loLicense.OkButtonText = "Accept";
                        loLicense.bDefaultButtonDisabled = true;
                        loLicense.ShowDialog();
                    }

                    if ( null != loLicense && loLicense.bOkButtonClicked )
                    {
                        moProfile["-LicenseAccepted"] = true;
                        moProfile.Save();

                        this.DisplayWizard();
                    }
                }
            }
            else
            {
                // Display all of the main application elements needed
                // after the configuration wizard has been completed.
                this.HideMiddlePanels();
                this.MainButtonPanel.IsEnabled = true;
                this.GetSetOutputTextPanelErrorCache();
                this.PopulateTimerDisplay(mcsStoppedText);

                bool lbPreviousBackupError = this.ShowPreviousBackupStatus();

                // No timer checked or a previous backup error means show the window
                // immediately. Otherwise, it will be accessible via the system tray.
                if ( !(bool)this.chkUseTimer.IsChecked || lbPreviousBackupError )
                {
                    this.ShowMe();
                }
                else
                {
                    this.HideMe();
                    this.ShowMissingBackupDevices();
                }

                this.CreateSysTrayIcon();

                // Since error output is cached (see "this.GetSetOutputTextPanelErrorCache()"),
                // the cached error output text should be displayed right away.
                if ( moProfile.ContainsKey("-PreviousBackupOk") && !moProfile.bValue("-PreviousBackupOk", false) )
                    this.DisplayOutputText();

                // If the timer is checked, start the main loop.
                if ( (bool)this.chkUseTimer.IsChecked )
                {
                    // Don't bother displaying the timer if there was a previous backup error.
                    // FYI, "ContainsKey" is used since existence checking is done on this key
                    // elsewhere (yeah I know, so much for black boxes).
                    if ( !moProfile.ContainsKey("-PreviousBackupOk") || moProfile.bValue("-PreviousBackupOk", false) )
                        this.MiddlePanelTimer.Visibility = Visibility.Visible;

                    this.MainLoop();
                }
            }
        }