Inheritance: System.Windows.Forms.Form
Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SDOptions _options = new SDOptions();
            SDOptionsFile.TryLoadOptions(out _options);
            OptionsForm f = new OptionsForm();

            // password required ?
            if(_options.PasswordRequired && _options.Password != null) {
                PasswordDialog dialog = new PasswordDialog();
                dialog.Password = _options.Password;

                if(dialog.ShowDialog() != DialogResult.OK) {
                    // invalid password or canceled by user
                    return;
                }
            }

            // display options window
            f.StartPanel = OptionsFormStartPanel.General;
            f.Options = _options;

            if(f.ShowDialog() == DialogResult.OK) {
                _options = f.Options;
                SDOptionsFile.TrySaveOptions(_options);
            }
        }
Ejemplo n.º 2
0
        static void Main()
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);

            // configure the debugger
            Debug.BreakOnFailedAssertion = true;
            Debug.StoreMessages = true;
            Debug.SaveStackInfo = true;
            Debug.ExceptionManager.DumpHeader = "SecureDelete Dump File";
            Debug.ExceptionManager.DebugMessagesPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\SecureDelete\\SecureDeleteMessages.xml";
            Debug.ExceptionManager.DumpPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\SecureDelete\\SecureDeleteDump.txt";
            Debug.ExceptionManager.Dump = true;
            Debug.ExceptionManager.SaveDebugMessages = true;
            Debug.ExceptionManager.OnWriteDump += Program.DumpSettings;
            Debug.ExceptionManager.OnUnhandledException += Program.UnhadledExceptionHandler;
            Debug.ExceptionManager.CrashNotifier = new SecureDeleteCrashNotifier();
            Debug.ExceptionManager.ReportCrash = true;
            Debug.ExceptionManager.AttachExceptionManager();

            Debug.AddListner(new WMListener());

            // run
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // initialize locations if running the first time
            SecureDeleteLocations.InitializeLocations();

            // show password dialog if enabled
            MainForm mainForm = new MainForm();
            mainForm.Inteface.LoadOptions();

            if(mainForm.Inteface.Options.PasswordRequired && mainForm.Inteface.Options.Password != null) {
                PasswordDialog dialog = new PasswordDialog();
                dialog.Password = mainForm.Inteface.Options.Password;

                Application.Run(dialog);
                if(dialog.DialogResult != DialogResult.OK) {
                    // invalid password or canceled by user
                    return;
                }
            }

            Application.Run(mainForm);
        }