Permalink
Browse files

Cleanup and removed duplicated Recent/Recent Files in jump list

  • Loading branch information...
1 parent cab60e2 commit abc2018e32f1b56bc451be8208240683f938ddbc @JakeGinnivan JakeGinnivan committed May 22, 2012
View
@@ -3,6 +3,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<JumpList.JumpList>
- <JumpList ShowRecentCategory="True" />
+ <JumpList ShowRecentCategory="False" />
</JumpList.JumpList>
</Application>
@@ -36,7 +36,7 @@ public void Handle(FileOpenEvent message)
public void OpenFileAsync(string openedFile)
{
- if (!IsWin7())
+ if (!IsWin7OrAbove())
return;
var currentFiles = jumpList.JumpItems.OfType<JumpTask>().Select(t => t.Arguments).ToList();
@@ -45,10 +45,10 @@ public void OpenFileAsync(string openedFile)
{
// find file in list
var settings = settingsService.GetSettings<MarkPadSettings>();
- var files = settings.RecentFiles;
- var index = files.IndexOf(openedFile);
- if (index >= 0) files.RemoveAt(index);
- files.Insert(0, openedFile);
+ var index = settings.RecentFiles.IndexOf(openedFile);
+ if (index >= 0)
+ settings.RecentFiles.RemoveAt(index);
+ settings.RecentFiles.Insert(0, openedFile);
settingsService.SaveSettings(settings);
// Sometimes the settings and the jumplist can get out of sequence.
@@ -61,10 +61,10 @@ public void OpenFileAsync(string openedFile)
{
// update settings
var settings = settingsService.GetSettings<MarkPadSettings>();
- var files = settings.RecentFiles ?? new List<string>();
- files.Insert(0, openedFile);
- if (files.Count > 5) files.RemoveAt(5);
+ settings.RecentFiles.Insert(0, openedFile);
+ if (settings.RecentFiles.Count > 5)
+ settings.RecentFiles.RemoveAt(5);
settingsService.SaveSettings(settings);
InsertFileFirst(openedFile);
@@ -73,7 +73,7 @@ public void OpenFileAsync(string openedFile)
private void InsertFileFirst(string openedFile)
{
- if (!IsWin7())
+ if (!IsWin7OrAbove())
return;
if (jumpList != null)
@@ -86,7 +86,7 @@ private void InsertFileFirst(string openedFile)
public void Handle(AppReadyEvent message)
{
- if (!IsWin7())
+ if (!IsWin7OrAbove())
return;
jumpList = GetJumpList();
@@ -103,7 +103,7 @@ public void Dispose()
private void PopulateJumpList(IEnumerable<string> recentFiles)
{
- if (!IsWin7())
+ if (!IsWin7OrAbove())
return;
if (recentFiles == null) return;
@@ -120,7 +120,7 @@ private void PopulateJumpList(IEnumerable<string> recentFiles)
private static JumpItem CreateJumpListItem(string file)
{
- if (!IsWin7())
+ if (!IsWin7OrAbove())
return null;
var path = Assembly.GetEntryAssembly().CodeBase;
@@ -134,7 +134,7 @@ private static JumpItem CreateJumpListItem(string file)
};
}
- private static bool IsWin7()
+ private static bool IsWin7OrAbove()
{
// check for Windows7
var os = Environment.OSVersion.Version;
@@ -146,7 +146,7 @@ private static bool IsWin7()
private static JumpList GetJumpList()
{
- if (!IsWin7())
+ if (!IsWin7OrAbove())
return null;
var list = JumpList.GetJumpList(Application.Current);
Binary file not shown.

0 comments on commit abc2018

Please sign in to comment.