Esempio n. 1
0
        /// <summary>
        /// Flushes all the ini settings
        /// </summary>
        private void FlushIniSettings()
        {
            var zBuilder            = new StringBuilder();
            var dictionaryFilenames = new Dictionary <string, object>();

            foreach (var sFile in m_listRecentFiles)
            {
                var sLowerFile = sFile.ToLower();
                if (dictionaryFilenames.ContainsKey(sLowerFile))
                {
                    continue;
                }
                dictionaryFilenames.Add(sLowerFile, null);
                zBuilder.Append(sFile + KeyCapConstants.CharFileSplit);
            }
            m_zIniManager.SetValue(IniSettings.PreviousFiles, zBuilder.ToString());
            m_zIniManager.FlushIniSettings();
        }
Esempio n. 2
0
        private void KeyCaptureConfig_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (m_bRun && !panelKeySetup.Enabled)
            {
                switch (e.CloseReason)
                {
                case CloseReason.TaskManagerClosing:
                case CloseReason.WindowsShutDown:
                    SaveOnClose(e);
                    break;

                default:
                    e.Cancel = true;
                    Hide();
                    break;
                }
            }
            else
            {
                SaveOnClose(e);
                if (e.Cancel)
                {
                    return;
                }
                var zBuilder            = new StringBuilder();
                var dictionaryFilenames = new Dictionary <string, object>();
                foreach (var sFile in m_listRecentFiles)
                {
                    var sLowerFile = sFile.ToLower();
                    if (dictionaryFilenames.ContainsKey(sLowerFile))
                    {
                        continue;
                    }
                    dictionaryFilenames.Add(sLowerFile, null);
                    zBuilder.Append(sFile + KeyCapConstants.CharFileSplit);
                }
                m_zIniManager.SetValue(IniSettings.PreviousFiles, zBuilder.ToString());
                m_zIniManager.FlushIniSettings();
            }
        }