public FormMain() { InitializeComponent(); // Configure folder pickers this.folderBrowserDialogSrc.ShowNewFolderButton = false; this.folderBrowserDialogSrc.Description = "Select the source images directory"; this.folderBrowserDialogDest.ShowNewFolderButton = false; this.folderBrowserDialogDest.Description = "Select the target images directory"; // Load settings m_config = Hydrator.HydrateFrom <ProcessConfig>("josie_config.stx"); // Load settings to UI //labelDestPath.Text = m_config.PathDest; //labelSrcPath.Text = m_config.PathSrc; //this.folderBrowserDialogSrc.SelectedPath = m_config.PathSrc; //this.folderBrowserDialogDest.SelectedPath = m_config.PathDest; //textBoxPrefix.Text = string.IsNullOrEmpty(m_config.Prefix) ? ImageHelper.DEFAULT_PREFIX : m_config.Prefix; // Initialize background worker this.backgroundWorker1.WorkerSupportsCancellation = true; this.backgroundWorker1.WorkerReportsProgress = true; this.backgroundWorker1.ProgressChanged += BackgroundWorker1_ProgressChanged; this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork); this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.DefaultExt = "stx"; openFileDialog1.Title = "Browse Stampyx Files"; openFileDialog1.Filter = "Stampyx files (*.stx)|*.stx"; openFileDialog1.FilterIndex = 1; DialogResult result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { m_configFname = openFileDialog1.FileName; m_config = Hydrator.HydrateFrom <ProcessConfig>(m_configFname); m_configRevert = Hydrator.HydrateFrom <ProcessConfig>(m_configFname); toolStripStatusLabel1.Text = m_configFname; labelSrcPath.Text = m_config.PathSrc; labelDestPath.Text = m_config.PathDest; textBoxPrefix.Text = m_config.Prefix; chkboxMaintMode.Checked = m_config.IsMaint; } if (m_configFname == String.Empty) { toolStripStatusLabel1.Text = "Invalid file."; return; } }
static void Main(string[] args) { string fname = args[0]; if (string.IsNullOrEmpty(fname)) { System.Environment.Exit(1); } if (!File.Exists(fname)) { System.Environment.Exit(1); } m_config = Hydrator.HydrateFrom <ProcessConfig>(fname); ImageHelper.ProcessFilesInBackground(null, m_config); }