From 165eff627b883334ab0c7c72590dee9b69c5e09d Mon Sep 17 00:00:00 2001 From: Alberto Balbo Date: Sun, 17 Aug 2025 22:22:37 +0200 Subject: [PATCH] Aggiunta applicazione Windows Forms "TimeLapseTransfer" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sono stati aggiunti i file di progetto e configurazione per un'applicazione Windows Forms chiamata "TimeLapseTransfer". È stato creato un file di soluzione (`TimeLapseTransfer.sln`) e un file di configurazione (`App.config`) per specificare la versione del runtime supportato. È stata implementata la classe principale dell'applicazione (`Main.cs`) con l'interfaccia utente, inclusi controlli per selezionare i percorsi di origine e destinazione, un pulsante per avviare il trasferimento dei file e una barra di progresso. Inoltre, sono stati creati file di designer (`Main.Designer.cs`), file di risorse (`Main.resx`), e la classe `Program.cs` come punto di ingresso. È stato creato anche il file di progetto (`TimeLapseTransfer.csproj`) e file di informazioni sull'assembly (`AssemblyInfo.cs`). Infine, sono stati aggiunti file di risorse e impostazioni per gestire le risorse e le configurazioni dell'applicazione. --- TimeLapseTransfer/TimeLapseTransfer.sln | 25 +++ .../TimeLapseTransfer/App.config | 6 + .../TimeLapseTransfer/Main.Designer.cs | 16 ++ TimeLapseTransfer/TimeLapseTransfer/Main.cs | 187 ++++++++++++++++++ TimeLapseTransfer/TimeLapseTransfer/Main.resx | 120 +++++++++++ .../TimeLapseTransfer/Program.cs | 22 +++ .../Properties/AssemblyInfo.cs | 33 ++++ .../Properties/Resources.Designer.cs | 71 +++++++ .../Properties/Resources.resx | 117 +++++++++++ .../Properties/Settings.Designer.cs | 30 +++ .../Properties/Settings.settings | 7 + .../TimeLapseTransfer.csproj | 83 ++++++++ 12 files changed, 717 insertions(+) create mode 100644 TimeLapseTransfer/TimeLapseTransfer.sln create mode 100644 TimeLapseTransfer/TimeLapseTransfer/App.config create mode 100644 TimeLapseTransfer/TimeLapseTransfer/Main.Designer.cs create mode 100644 TimeLapseTransfer/TimeLapseTransfer/Main.cs create mode 100644 TimeLapseTransfer/TimeLapseTransfer/Main.resx create mode 100644 TimeLapseTransfer/TimeLapseTransfer/Program.cs create mode 100644 TimeLapseTransfer/TimeLapseTransfer/Properties/AssemblyInfo.cs create mode 100644 TimeLapseTransfer/TimeLapseTransfer/Properties/Resources.Designer.cs create mode 100644 TimeLapseTransfer/TimeLapseTransfer/Properties/Resources.resx create mode 100644 TimeLapseTransfer/TimeLapseTransfer/Properties/Settings.Designer.cs create mode 100644 TimeLapseTransfer/TimeLapseTransfer/Properties/Settings.settings create mode 100644 TimeLapseTransfer/TimeLapseTransfer/TimeLapseTransfer.csproj diff --git a/TimeLapseTransfer/TimeLapseTransfer.sln b/TimeLapseTransfer/TimeLapseTransfer.sln new file mode 100644 index 0000000..8c744d1 --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35312.102 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimeLapseTransfer", "TimeLapseTransfer\TimeLapseTransfer.csproj", "{35512498-B08F-4177-A4C4-72ECFD2C356B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {35512498-B08F-4177-A4C4-72ECFD2C356B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {35512498-B08F-4177-A4C4-72ECFD2C356B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {35512498-B08F-4177-A4C4-72ECFD2C356B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {35512498-B08F-4177-A4C4-72ECFD2C356B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B354D1A3-AD35-48BC-BD7C-37EEFD1E4995} + EndGlobalSection +EndGlobal diff --git a/TimeLapseTransfer/TimeLapseTransfer/App.config b/TimeLapseTransfer/TimeLapseTransfer/App.config new file mode 100644 index 0000000..aee9adf --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TimeLapseTransfer/TimeLapseTransfer/Main.Designer.cs b/TimeLapseTransfer/TimeLapseTransfer/Main.Designer.cs new file mode 100644 index 0000000..f5114dd --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/Main.Designer.cs @@ -0,0 +1,16 @@ +namespace TimeLapseTransfer +{ + partial class Main + { + private System.ComponentModel.IContainer components = null; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + } +} diff --git a/TimeLapseTransfer/TimeLapseTransfer/Main.cs b/TimeLapseTransfer/TimeLapseTransfer/Main.cs new file mode 100644 index 0000000..3947970 --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/Main.cs @@ -0,0 +1,187 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace TimeLapseTransfer +{ + public partial class Main : Form + { + public Main() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + this.sourceTextBox = new System.Windows.Forms.TextBox(); + this.destinationTextBox = new System.Windows.Forms.TextBox(); + this.sourceButton = new System.Windows.Forms.Button(); + this.destinationButton = new System.Windows.Forms.Button(); + this.startButton = new System.Windows.Forms.Button(); + this.progressBar = new System.Windows.Forms.ProgressBar(); + this.sourceLabel = new System.Windows.Forms.Label(); + this.destinationLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // sourceTextBox + // + this.sourceTextBox.Location = new System.Drawing.Point(89, 12); + this.sourceTextBox.Name = "sourceTextBox"; + this.sourceTextBox.Size = new System.Drawing.Size(411, 20); + this.sourceTextBox.TabIndex = 0; + // + // destinationTextBox + // + this.destinationTextBox.Location = new System.Drawing.Point(89, 38); + this.destinationTextBox.Name = "destinationTextBox"; + this.destinationTextBox.Size = new System.Drawing.Size(411, 20); + this.destinationTextBox.TabIndex = 1; + // + // sourceButton + // + this.sourceButton.Location = new System.Drawing.Point(506, 10); + this.sourceButton.Name = "sourceButton"; + this.sourceButton.Size = new System.Drawing.Size(75, 23); + this.sourceButton.TabIndex = 2; + this.sourceButton.Text = "Sfoglia..."; + this.sourceButton.UseVisualStyleBackColor = true; + this.sourceButton.Click += new System.EventHandler(this.SourceButton_Click); + // + // destinationButton + // + this.destinationButton.Location = new System.Drawing.Point(506, 36); + this.destinationButton.Name = "destinationButton"; + this.destinationButton.Size = new System.Drawing.Size(75, 23); + this.destinationButton.TabIndex = 3; + this.destinationButton.Text = "Sfoglia..."; + this.destinationButton.UseVisualStyleBackColor = true; + this.destinationButton.Click += new System.EventHandler(this.DestinationButton_Click); + // + // startButton + // + this.startButton.Location = new System.Drawing.Point(506, 65); + this.startButton.Name = "startButton"; + this.startButton.Size = new System.Drawing.Size(75, 23); + this.startButton.TabIndex = 4; + this.startButton.Text = "Avvia"; + this.startButton.UseVisualStyleBackColor = true; + this.startButton.Click += new System.EventHandler(this.StartButton_Click); + // + // progressBar + // + this.progressBar.Location = new System.Drawing.Point(89, 65); + this.progressBar.Name = "progressBar"; + this.progressBar.Size = new System.Drawing.Size(411, 23); + this.progressBar.TabIndex = 5; + // + // sourceLabel + // + this.sourceLabel.AutoSize = true; + this.sourceLabel.Location = new System.Drawing.Point(40, 15); + this.sourceLabel.Name = "sourceLabel"; + this.sourceLabel.Size = new System.Drawing.Size(43, 13); + this.sourceLabel.TabIndex = 6; + this.sourceLabel.Text = "Origine:"; + // + // destinationLabel + // + this.destinationLabel.AutoSize = true; + this.destinationLabel.Location = new System.Drawing.Point(12, 41); + this.destinationLabel.Name = "destinationLabel"; + this.destinationLabel.Size = new System.Drawing.Size(71, 13); + this.destinationLabel.TabIndex = 7; + this.destinationLabel.Text = "Destinazione:"; + // + // Main + // + this.ClientSize = new System.Drawing.Size(600, 100); + this.Controls.Add(this.destinationLabel); + this.Controls.Add(this.sourceLabel); + this.Controls.Add(this.progressBar); + this.Controls.Add(this.startButton); + this.Controls.Add(this.destinationButton); + this.Controls.Add(this.sourceButton); + this.Controls.Add(this.destinationTextBox); + this.Controls.Add(this.sourceTextBox); + this.Name = "Main"; + this.Text = "Seleziona Percorsi"; + this.ResumeLayout(false); + this.PerformLayout(); + } + + private void SourceButton_Click(object sender, EventArgs e) + { + using (OpenFileDialog openFileDialog = new OpenFileDialog()) + { + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + sourceTextBox.Text = openFileDialog.FileName; + } + } + } + + private void DestinationButton_Click(object sender, EventArgs e) + { + using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) + { + if (folderBrowserDialog.ShowDialog() == DialogResult.OK) + { + destinationTextBox.Text = folderBrowserDialog.SelectedPath; + } + } + } + + private void StartButton_Click(object sender, EventArgs e) + { + string sourcePath = sourceTextBox.Text; + string destinationPath = destinationTextBox.Text; + + if (string.IsNullOrEmpty(sourcePath) || string.IsNullOrEmpty(destinationPath)) + { + MessageBox.Show("Per favore, seleziona sia il percorso di origine che quello di destinazione."); + return; + } + + try + { + string[] files = Directory.GetFiles(sourcePath, "*.*") + .Where(file => file.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) || + file.EndsWith(".gpr", StringComparison.OrdinalIgnoreCase)) + .ToArray(); + + progressBar.Maximum = files.Length; + progressBar.Value = 0; + + foreach (string file in files) + { + string fileName = Path.GetFileName(file); + string destFile = Path.Combine(destinationPath, fileName); + File.Move(file, destFile); + progressBar.Value += 1; + } + + MessageBox.Show("Trasferimento completato!"); + } + catch (Exception ex) + { + MessageBox.Show($"Errore durante il trasferimento: {ex.Message}"); + } + } + + private System.Windows.Forms.TextBox sourceTextBox; + private System.Windows.Forms.TextBox destinationTextBox; + private System.Windows.Forms.Button sourceButton; + private System.Windows.Forms.Button destinationButton; + private System.Windows.Forms.Button startButton; + private System.Windows.Forms.ProgressBar progressBar; + private System.Windows.Forms.Label sourceLabel; + private System.Windows.Forms.Label destinationLabel; + } +} diff --git a/TimeLapseTransfer/TimeLapseTransfer/Main.resx b/TimeLapseTransfer/TimeLapseTransfer/Main.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/Main.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TimeLapseTransfer/TimeLapseTransfer/Program.cs b/TimeLapseTransfer/TimeLapseTransfer/Program.cs new file mode 100644 index 0000000..8fce0e6 --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace TimeLapseTransfer +{ + internal static class Program + { + /// + /// Punto di ingresso principale dell'applicazione. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Main()); + } + } +} diff --git a/TimeLapseTransfer/TimeLapseTransfer/Properties/AssemblyInfo.cs b/TimeLapseTransfer/TimeLapseTransfer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b354fbb --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Le informazioni generali relative a un assembly sono controllate dal seguente +// set di attributi. Modificare i valori di questi attributi per modificare le informazioni +// associate a un assembly. +[assembly: AssemblyTitle("TimeLapseTransfer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("TimeLapseTransfer")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili +// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da +// COM, impostare su true l'attributo ComVisible per tale tipo. +[assembly: ComVisible(false)] + +// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi +[assembly: Guid("35512498-b08f-4177-a4c4-72ecfd2c356b")] + +// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: +// +// Versione principale +// Versione secondaria +// Numero di build +// Revisione +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TimeLapseTransfer/TimeLapseTransfer/Properties/Resources.Designer.cs b/TimeLapseTransfer/TimeLapseTransfer/Properties/Resources.Designer.cs new file mode 100644 index 0000000..9369732 --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// Versione runtime:4.0.30319.42000 +// +// Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace TimeLapseTransfer.Properties +{ + + + /// + /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. + /// + // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder + // tramite uno strumento quale ResGen o Visual Studio. + // Per aggiungere o rimuovere un membro, modificare il file .ResX, quindi eseguire di nuovo ResGen + // con l'opzione /str oppure ricompilare il progetto VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Restituisce l'istanza di ResourceManager memorizzata nella cache e usata da questa classe. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TimeLapseTransfer.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte + /// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/TimeLapseTransfer/TimeLapseTransfer/Properties/Resources.resx b/TimeLapseTransfer/TimeLapseTransfer/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TimeLapseTransfer/TimeLapseTransfer/Properties/Settings.Designer.cs b/TimeLapseTransfer/TimeLapseTransfer/Properties/Settings.Designer.cs new file mode 100644 index 0000000..cc0bd62 --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace TimeLapseTransfer.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/TimeLapseTransfer/TimeLapseTransfer/Properties/Settings.settings b/TimeLapseTransfer/TimeLapseTransfer/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/TimeLapseTransfer/TimeLapseTransfer/TimeLapseTransfer.csproj b/TimeLapseTransfer/TimeLapseTransfer/TimeLapseTransfer.csproj new file mode 100644 index 0000000..d72dc22 --- /dev/null +++ b/TimeLapseTransfer/TimeLapseTransfer/TimeLapseTransfer.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {35512498-B08F-4177-A4C4-72ECFD2C356B} + WinExe + TimeLapseTransfer + TimeLapseTransfer + v4.8.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Main.cs + + + + + Main.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file