Beispiel #1
0
        public static void AddNewEntry(string filename, string filepath, string game, Settings.RecentFileType type)
        {
            Settings.RecentFileEntry alreadyExistsEntry = null;

            if (App.AssemblyStorage.AssemblySettings.ApplicationRecents == null)
            {
                App.AssemblyStorage.AssemblySettings.ApplicationRecents = new ObservableCollection <Settings.RecentFileEntry>();
            }

            foreach (
                var entry in
                App.AssemblyStorage.AssemblySettings.ApplicationRecents.Where(
                    entry => entry.FileName == filename && entry.FilePath == filepath && entry.FileGame == game))
            {
                alreadyExistsEntry = entry;
            }

            if (alreadyExistsEntry == null)
            {
                // Add New Entry
                var newEntry = new Settings.RecentFileEntry
                {
                    FileGame = game,
                    FileName = filename,
                    FilePath = filepath,
                    FileType = type
                };
                App.AssemblyStorage.AssemblySettings.ApplicationRecents.Insert(0, newEntry);
            }
            else
            {
                // Move existing Entry
                App.AssemblyStorage.AssemblySettings.ApplicationRecents.Remove(alreadyExistsEntry);
                App.AssemblyStorage.AssemblySettings.ApplicationRecents.Insert(0, alreadyExistsEntry);
            }

            JumpLists.UpdateJumplists();
        }
Beispiel #2
0
        public static void AddNewEntry(string date, string thumburl, string url)
        {
            Settings.ImgurHistoryEntry alreadyExistsEntry = null;

            if (App.AssemblyStorage.AssemblySettings.ImgurUploadHistory == null)
            {
                App.AssemblyStorage.AssemblySettings.ImgurUploadHistory = new ObservableCollection <Settings.ImgurHistoryEntry>();
            }

            foreach (
                var entry in
                App.AssemblyStorage.AssemblySettings.ImgurUploadHistory.Where(
                    entry => entry.Date == date && entry.ThumbURL == thumburl && entry.URL == url))
            {
                alreadyExistsEntry = entry;
            }

            if (alreadyExistsEntry == null)
            {
                // Add New Entry
                var newEntry = new Settings.ImgurHistoryEntry
                {
                    Date     = date,
                    ThumbURL = thumburl,
                    URL      = url
                };
                App.AssemblyStorage.AssemblySettings.ImgurUploadHistory.Insert(0, newEntry);
            }
            else
            {
                // Move existing Entry
                App.AssemblyStorage.AssemblySettings.ImgurUploadHistory.Remove(alreadyExistsEntry);
                App.AssemblyStorage.AssemblySettings.ImgurUploadHistory.Insert(0, alreadyExistsEntry);
            }

            JumpLists.UpdateJumplists();
        }