Check existence settings to load

2 posts, 0 answers
  1. Pawel
    Pawel avatar
    39 posts
    Member since:
    Apr 2014

    Posted 23 Apr 2015 Link to this post

    Is it possible to check if there are any settings to load for gridView before actual loading this settings? For example:

     

    PersistenceManager.SetStorageId(gridView, storageId);
     
    // how to check if there is some settings to load before actual loading settings happen?
     
    _isoProvider.LoadFromStorage(storageId);

  2. Milena
    Admin
    Milena avatar
    201 posts

    Posted 24 Apr 2015 Link to this post

    Hello Pawel,

    It is possible to check if there are any settings to load using FileExists(). In order to achieve this you should add a custom IsolatedStorageProvider which inherits IsolatedStorageProvider. In addition if you need to check the properties further, you can access the IsolatedStorageFileStream and write a custom logic: 
    public class CustomIsolatedStorageProvider : IsolatedStorageProvider
    {
        private static readonly string fileExtension = ".bin";
     
        public bool IsFileExist(string storageId)
        {
            var store = this.GetIsolatedStoreOverride();
            bool isExist = store.FileExists(storageId);
     
            //additional search
            if (!store.FileExists(storageId + CustomIsolatedStorageProvider.fileExtension))
                return isExist;
            using (IsolatedStorageFileStream fs = store.OpenFile(storageId + CustomIsolatedStorageProvider.fileExtension, FileMode.Open, FileAccess.Read))
            {
                // custom logic
            }
     
            return isExist;
        }

    Unfortunately, at the moment there is a bug and GetIsolatedStoreOverride returns a wrong Isolated storage. You can track the progress of this issue in our Feedback portal. So, if you follow the feedback item you will be notified by email when its status changes. We cannot bound to any time frame for fixing the issue, but we will increase its priority and do our best to resolve it soon.
     
    Thank you for your understanding.

    Regards,
    Milena
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top