Exemplo n.º 1
0
        private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Remember that the window is closing,
            // so that all events from the Searcher are ignored from now on:
            m_closing = true;

            // Stop the search thread if it is running:
            Searcher.Stop();

            // Save config values:
            if (this.WindowState == FormWindowState.Normal)
            {
                UserConfig.Data.LocationX = this.Location.X;
                UserConfig.Data.LocationY = this.Location.Y;
                UserConfig.Data.Width     = this.Size.Width;
                UserConfig.Data.Height    = this.Size.Height;
            }
            if (this.WindowState != FormWindowState.Minimized)
            {
                UserConfig.Data.WindowState = (Int32)this.WindowState;
            }

            UserConfig.Data.SearchDir             = searchDirTextBox.Text;
            UserConfig.Data.IncludeSubDirsChecked = includeSubDirsCheckBox.Checked;
            UserConfig.Data.FileName          = fileNameTextBox.Text;
            UserConfig.Data.NewerThanChecked  = newerThanCheckBox.Checked;
            UserConfig.Data.NewerThanDateTime = newerThanDateTimePicker.Value;
            UserConfig.Data.OlderThanChecked  = olderThanCheckBox.Checked;
            UserConfig.Data.OlderThanDateTime = olderThanDateTimePicker.Value;
            UserConfig.Data.ContainingChecked = containingCheckBox.Checked;
            UserConfig.Data.ContainingText    = containingTextBox.Text;
            UserConfig.Data.AsciiChecked      = asciiRadioButton.Checked;
            UserConfig.Data.UnicodeChecked    = unicodeRadioButton.Checked;
            UserConfig.Data.Delimeter         = delimeterTextBox.Text;

            UserConfig.Save();
        }