private static void HandleNewRecentlyOpenedEntry(RecentlyOpenedInfo entry, List <RecentlyOpenedInfo> list) { var entryIndex = -1; for (var actIndex = 0; actIndex < list.Count; actIndex++) { if (list[actIndex].Path == entry.Path) { entryIndex = actIndex; break; } } if (entryIndex > 0) { list.RemoveAt(entryIndex); list.Insert(0, entry); } else if (entryIndex == 0) { // Nothing to do } else { list.Insert(0, entry); while (list.Count > 10) { list.RemoveAt(list.Count - 1); } } }
private void OnCommand_LoadRecentlyOpened_Execute(RecentlyOpenedInfo recentlyOpened) { switch (recentlyOpened.Type) { case RecentlyOpenedType.File: this.Messenger.Publish(new MessageLoadGpxFilesRequest(new [] { recentlyOpened.Path }, null)); break; case RecentlyOpenedType.Directory: this.Messenger.Publish(new MessageLoadGpxFilesRequest(null, new [] { recentlyOpened.Path })); break; } }
public RecentlyOpenedViewModel(RecentlyOpenedInfo recentlyOpened, DelegateCommand <RecentlyOpenedInfo> commandLoad) { this.Model = recentlyOpened; this.Command_Load = commandLoad; }