public ImageTagger() { LoadingScreen loadingScreen = new LoadingScreen (); loadingScreen.Show (); // Configuration config = GetConfiguration (); // Window properties this.components = new System.ComponentModel.Container (); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Text = "Image-Tagger Playground"; if (config.WindowSize.Width != 0 && config.WindowSize.Height != 0) { this.Width = config.WindowSize.Width; this.Height = config.WindowSize.Height; } // this.KeyPreview = true; // this.KeyPress += new KeyPressEventHandler (HandleKeyPress); this.Resize += new EventHandler (Form_Resize); // Create Menu CreateMenuStrip (); // left/right Splitcontainer SplitContainer leftRightSplitter = new SplitContainer (); leftRightSplitter.Dock = DockStyle.Fill; this.Controls.Add (leftRightSplitter); // Panel 1Navigation leftRightSplitter.Panel1MinSize = 210; leftRightSplitter.SplitterDistance = 210; leftRightSplitter.Panel1.BackColor = Color.AntiqueWhite; // Init ImageBrowser imageBrowser = new ImageBrowser (); imageBrowser.Dock = DockStyle.Fill; leftRightSplitter.Panel1.Controls.Add (imageBrowser); imageBrowser.ImageClick += HandleImage1Click; if (!String.IsNullOrEmpty (config.DefaultDirectory)) { OpenDirectory (config.DefaultDirectory); } // Panel 2 mainImage.Dock = DockStyle.Fill; mainImage.SizeMode = PictureBoxSizeMode.Zoom; leftRightSplitter.Panel2.Controls.Add (mainImage); loadingScreen.Hide (); }
public Configuration GetConfiguration() { var config = LoadConfiguration (); if (config == null) { config = new Configuration { CheckExtensionsCaseSensitive = false, ValidExtensions = new List<String> { ".jpg", ".jpeg", ".png", ".tiff", ".gif" }, Shortcut = new ConfigurationShortcut { // File OpenDirectory = Keys.O, // Navigation PreviousImage = Keys.A, NextImage = Keys.D, PreviousPage = Keys.W, NextPage = Keys.S }, WindowSize = new Size (1253, 810) }; } return config; }
void LoadConfiguration_Click(object sender, EventArgs e) { config = LoadConfiguration (); if(config != null) { MessageBox.Show ("Configuration loaded"); } else { MessageBox.Show ("Error loading configuration"); } }
public Configuration LoadConfiguration() { String basePath = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); String applicationName = Application.ProductName; String folder = Path.Combine (basePath, applicationName); String path = Path.Combine (folder, ".ImageTagger.config"); return config = Configuration.Load (path); }