Ejemplo n.º 1
0
        /// <summary>
        /// Performs custom actions on System.Windows.Forms.Form.Closing event</summary>
        /// <param name="e">Cancel event args</param>
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            s_lastColumnWidths = base.ColumnWidths;

            if (SettingsService != null && s_settingsRegistered)
            {
                // save settings
                if (WindowState == FormWindowState.Normal)
                {
                    s_lastSize     = Size;
                    s_lastLocation = Location;
                }
                else
                {
                    s_lastSize     = RestoreBounds.Size;
                    s_lastLocation = RestoreBounds.Location;
                }

                if (SelectedFileNames.Any())
                {
                    LastAccessedDirectory = Path.GetDirectoryName(SelectedFileNames.First());
                }
            }
            base.OnClosing(e);
        }
Ejemplo n.º 2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            m_timer.Stop();

            // Perform selection end logic: update fileNameComboBox.Text to the selected files

            int selectedFiles = SelectedFileNames.Count();

            if (selectedFiles == 1)
            {
                fileNameComboBox.Text = Path.GetFileName(SelectedFileNames.First());
            }
            else if (selectedFiles > 1)
            {
                var sb = new StringBuilder();
                foreach (var fileName in SelectedFileNames)
                {
                    sb.Append(@"""");
                    sb.Append(Path.GetFileName(fileName));
                    sb.Append(@""" ");
                }
                fileNameComboBox.Text = sb.ToString();
            }
            else
            {
                fileNameComboBox.Text = string.Empty;
            }
        }