Rättat registryhantering + .CopyTo istället för MoveTo

This commit is contained in:
2021-04-21 20:55:34 +02:00
parent fbb246d09b
commit 96ca8d0424
2 changed files with 22 additions and 3 deletions

View File

@ -50,6 +50,9 @@ namespace PictureReposit
// //
// pictureBox1 // pictureBox1
// //
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.Location = new System.Drawing.Point(183, 72); this.pictureBox1.Location = new System.Drawing.Point(183, 72);
this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(654, 548); this.pictureBox1.Size = new System.Drawing.Size(654, 548);
@ -150,6 +153,7 @@ namespace PictureReposit
this.txtRootDir.Size = new System.Drawing.Size(164, 23); this.txtRootDir.Size = new System.Drawing.Size(164, 23);
this.txtRootDir.TabIndex = 10; this.txtRootDir.TabIndex = 10;
this.txtRootDir.Text = "D:\\Bildlabb\\LabRotCat"; this.txtRootDir.Text = "D:\\Bildlabb\\LabRotCat";
this.txtRootDir.TextChanged += new System.EventHandler(this.txtRootDir_TextChanged);
// //
// Form1 // Form1
// //

View File

@ -20,7 +20,7 @@ namespace PictureReposit
{ {
InitializeComponent(); InitializeComponent();
RegistryKey PictureHandling = Registry.LocalMachine.OpenSubKey(@"Software\Tfoman\PictureHandling"); RegistryKey PictureHandling = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Tfoman\PictureReposit");
if (PictureHandling == null) if (PictureHandling == null)
{ {
txtRootDir.Text = @"D:\Bildlabb\LabRotCat"; txtRootDir.Text = @"D:\Bildlabb\LabRotCat";
@ -188,7 +188,22 @@ namespace PictureReposit
private void txtRootDir_TextChanged(object sender, EventArgs e) private void txtRootDir_TextChanged(object sender, EventArgs e)
{ {
//Software\Tfoman\PictureReposit
RegistryKey Tfoman = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Tfoman", true);
RegistryKey PictureHandling = Tfoman.OpenSubKey(@"PictureReposit", true);
if (PictureHandling == null)
{
if (Tfoman == null)
{
Tfoman = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Tfoman");
}
else
PictureHandling = Tfoman.CreateSubKey(@"PictureReposit");
}
else
{
PictureHandling.SetValue(@"RootMap", txtRootDir.Text);
}
} }
} }
} }