예제 #1
0
        /// <summary>
        /// Button Add source folder
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            CommonOpenFileDialog dialog = new CommonOpenFileDialog();

            dialog.IsFolderPicker = true;

            // ----- Set Init Dir -----
            if (olvFolders.GetItemCount() > 0)
            {
                ffolder item = (ffolder)olvFolders.GetItem(olvFolders.GetItemCount() - 1).RowObject;
                if (System.IO.Directory.Exists(item.Path))
                {
                    dialog.InitialDirectory = item.Path;
                }
            }


            // ----- Show open dialog -----
            if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
            {
                ffolder folder = new ffolder(System.IO.Path.GetFileName(dialog.FileName), dialog.FileName);
                olvFolders.AddObject(folder);           // add folder to OLV
            }
            dialog.Dispose();
        }
예제 #2
0
        /// <summary>
        /// Form Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMain_Load(object sender, EventArgs e)
        {
            // ----- Get app version -----
            this.Text = this.Text + " v" + Application.ProductVersion.Substring(0, Application.ProductVersion.Length - 2);

            // ----- Init ObjectListView -----
            System.Globalization.CultureInfo provider = System.Globalization.CultureInfo.InvariantCulture;
            olvFolders.SetObjects(new List <ffolder>());
            colTimeShift.AspectGetter = delegate(object x) { return(((ffolder)x).TimeShift.ToString()); };
            colTimeShift.AspectPutter = delegate(object x, object newValue) { try { ((ffolder)x).TimeShift = TimeSpan.Parse((string)newValue); } catch { } };

            // ----- Load settings -----
            txtDestFolder.Text = Properties.Settings.Default.DestFolder;
            string[] SourceFolders = Properties.Settings.Default.SourceFolders.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string[] TimeShifts    = Properties.Settings.Default.TimeShift.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            cbFileMask.Text            = Properties.Settings.Default.Mask;
            chbWriteToExif.Checked     = Properties.Settings.Default.WriteSTExif;
            chbSetImgDate.Checked      = Properties.Settings.Default.SetFileDate;
            chbClearDestFolder.Checked = Properties.Settings.Default.ClearFolder;

            // ----- Add source folders to ObjectListView -----
            for (int i = 0; i < SourceFolders.Length; i++)
            {
                TimeSpan shift = TimeSpan.Zero;
                if (SourceFolders.Length == TimeShifts.Length)
                {
                    try
                    {
                        shift = TimeSpan.Parse(TimeShifts[i]);
                    }
                    catch { }
                }

                ffolder folder = new ffolder(System.IO.Path.GetFileName(SourceFolders[i]), SourceFolders[i], shift);
                olvFolders.AddObject(folder);
            }
        }