Пример #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            // Load settings
            try
            {
                WindowsRegistry registry = new WindowsRegistry(Microsoft.Win32.RegistryHive.CurrentUser);
                registry.OpenSubKey(REG_SUBKEY);
                pathBox.Text             = (string)registry.GetValue(REG_PATH, "");
                numericUpDownLevel.Value = (int)registry.GetValue(REG_SUBLEVEL, DEFAULT_LEVEL);

                // Registry contains KBytes
                int targetBytes = (int)registry.GetValue(REG_SIZE, DEFAULT_SIZE);
                SetTargetSize((long)targetBytes * 1024);
            }
            catch
            {}
        }
Пример #2
0
        private void FormMain_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            _computer?.Stop();

            // Save settings
            try
            {
                WindowsRegistry registry = new WindowsRegistry(Microsoft.Win32.RegistryHive.CurrentUser);
                registry.OpenSubKey(REG_SUBKEY);
                registry.SetValue(REG_PATH, pathBox.Text);
                registry.SetValue(REG_SUBLEVEL, (int)numericUpDownLevel.Value);

                // Store KBytes
                registry.SetValue(REG_SIZE, (int)(GetTargetSize() / 1024));
            }
            catch
            {}
        }