Beispiel #1
0
 /// <summary>
 /// Save MRU list to XML file.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="VM"></param>
 public static void Save(string path, IMRUListViewModel VM)
 {
     try
     {
         XmlSerializerUtil.Save <MRUList>(path, ConvertToModel(VM));
     }
     catch
     {
         throw;
     }
 }
Beispiel #2
0
        /// <summary>
        /// Load MRU list to XML file.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static IMRUListViewModel Load(string path)
        {
            try
            {
                var list = XmlSerializerUtil.Load <MRUList>(path);

                return(ConvertToViewModel(list));
            }
            catch
            {
                throw;
            }
        }
Beispiel #3
0
 /// <summary>
 /// Save MRU list to XML file in an awaitable fashion.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="VM"></param>
 /// <returns></returns>
 public static Task <bool> SaveAsync(string path, IMRUListViewModel VM)
 {
     return(Task.Run(() =>
     {
         try
         {
             XmlSerializerUtil.Save <MRUList>(path, ConvertToModel(VM));
             return true;
         }
         catch
         {
             throw;
         }
     }));
 }
Beispiel #4
0
        /// <summary>
        /// Load MRU list from XML file in an awaitable fashion.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static Task <IMRUListViewModel> LoadAsync(string path)
        {
            return(Task.Run(() =>
            {
                try
                {
                    var list = XmlSerializerUtil.Load <MRUList>(path);

                    return ConvertToViewModel(list);
                }
                catch
                {
                    throw;
                }
            }));
        }