Exemplo n.º 1
0
 public void FileOpenMruTest(MruStripMenu msm, string filename)
 {
     try
     {
         msm.AddFile(filename);
     }
     catch (System.Exception ex)
     {
         _msg.Length = 0;
         _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
         Program._messageLog.WriteLine(_msg.ToString());
         AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToAppLog);
     }
     finally
     {
         ;
     }
 }
Exemplo n.º 2
0
        internal void InitMruList()
        {
            _saveMruListToRegistry    = AppConfig.GetBooleanValueFromConfigFile("SaveMruListToRegistry", "True");
            _mRUListSaveFileSubFolder = AppConfig.GetStringValueFromConfigFile("MRUListSaveFileSubFolder", @"PFApps\InitWinFormsAppWithToolbarExt\Mru\");
            _mRUListSaveRegistryKey   = AppConfig.GetStringValueFromConfigFile("MRUListSaveRegistryKey", @"SOFTWARE\PFApps\InitWinFormsAppWithToolbarExt");
            _maxMruListEntries        = AppConfig.GetIntValueFromConfigFile("MaxMruListEntries", (int)4);
            _useSubMenuForMruList     = AppConfig.GetBooleanValueFromConfigFile("UseSubMenuForMruList", "true");

            if (_msm != null)
            {
                _msm.RemoveAll();
            }

            if (_saveMruListToRegistry)
            {
                if (_useSubMenuForMruList)
                {
                    _msm = new MruStripMenu(mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _mRUListSaveRegistryKey + "\\MRU", false, _maxMruListEntries);
                }
                else
                {
                    //use inline
                    _msm = new MruStripMenuInline(mnuFile, mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _mRUListSaveRegistryKey + "\\MRU", _maxMruListEntries);
                }
                _msm.LoadFromRegistry();
            }
            else
            {
                //load from and save to the file system
                if (_useSubMenuForMruList)
                {
                    _msm = new MruStripMenu(mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _maxMruListEntries);
                }
                else
                {
                    //use inline
                    _msm = new MruStripMenuInline(mnuFile, mnuFileRecent, new MruStripMenu.ClickedHandler(OnMruFile), _maxMruListEntries);
                }
                _msm.FileSystemMruPath = _mRUListSaveFileSubFolder;
                _msm.LoadFromFileSystem();
            }
        }//end InitMruList