Ejemplo n.º 1
0
 /// <summary>
 /// Refreshes the recent files menu.
 /// </summary>
 protected void RefreshRecentFilesMenu()
 {
     if (!DesignMode)
     {
         MenuBuilderHandler?.RebuildMenus(this.Files, this.OnRecentFileMenuItemClick, this.ClearListMenuItemText, this.OnClearListMenuItemClick);
     }
 }
Ejemplo n.º 2
0
        private void OnClearListMenuItemClick()
        {
            var fileArray = new StringCollection();

            fileArray.AddRange(this.Files.ToArray());
            try
            {
                if (StorageHandler != null)
                {
                    foreach (var s in StorageHandler.Files)
                    {
                        try { File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Recent), Path.GetFileName(s), ".lnk")); } catch { }
                    }
                    StorageHandler.Files = null;
                }
                MenuBuilderHandler?.ClearRecentFiles();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            ClearListMenuItemClick?.Invoke(fileArray);
        }