public Settings(IServiceProvider provider)
        {
            SettingsManager settingsManager = new ShellSettingsManager(provider);

            _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            if (!_settingsStore.CollectionExists("DebugAttachManagerProcesses"))
            {
                return;
            }
            IEnumerable <string> services = _settingsStore.GetSubCollectionNames("DebugAttachManagerProcesses");

            foreach (var s in services)
            {
                var p = new StoredProcessInfo
                {
                    ProcessName = _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "ProcessName"),
                    Title       = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "Title") ?
                                  _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "Title") : null,
                    RemoteServerName = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "RemoteServerName") ?
                                       _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "RemoteServerName") : null,
                    RemotePortNumber = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "RemotePortNumber") ?
                                       _settingsStore.GetInt64("DebugAttachManagerProcesses\\" + s, "RemotePortNumber") : (long?)null,
                    Selected  = _settingsStore.GetBoolean("DebugAttachManagerProcesses\\" + s, "Selected"),
                    DebugMode = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "DebugMode") ?
                                _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "DebugMode") : null
                };
                Processes.Add(p.Hash, p);
            }

            if (_settingsStore.PropertyExists("DebugAttachManagerProcesses", "RemoteServer"))
            {
                RemoteServer = _settingsStore.GetString("DebugAttachManagerProcesses", "RemoteServer");
            }
        }
Exemple #2
0
        public static string GetTemplate(TestFramework testFramework, MockFramework mockFramework, TemplateType templateType)
        {
            string templateSettingKey = GetTemplateSettingsKey(testFramework, mockFramework, templateType);

            if (Store.PropertyExists(CollectionPath, templateSettingKey))
            {
                return(Store.GetString(CollectionPath, templateSettingKey));
            }

            switch (templateType)
            {
            case TemplateType.File:
                var templateGenerator = new DefaultTemplateGenerator();
                return(templateGenerator.Get(testFramework, mockFramework));

            case TemplateType.MockFieldDeclaration:
                return(mockFramework.MockFieldDeclarationCode);

            case TemplateType.MockFieldInitialization:
                return(mockFramework.MockFieldInitializationCode);

            case TemplateType.MockObjectReference:
                return(mockFramework.MockObjectReferenceCode);

            default:
                throw new ArgumentOutOfRangeException(nameof(templateType), templateType, null);
            }
        }
Exemple #3
0
        private void UpdateSettings()
        {
            string configVersion = null;

            if (_settingsStore.PropertyExists(CollectionPath, SettingsVersionPropertyName))
            {
                configVersion = _settingsStore.GetString(CollectionPath, SettingsVersionPropertyName);
            }
            if (configVersion == null)
            {
                try
                {
                    var connections = new List <ConnectionDetail>();
                    var deprecatedConnectionsXml = _settingsStore.GetString(CollectionPath, ConnectionsPropertyName);
                    var deprecatedConnections    = (List <McTools.Xrm.Connection.Deprecated.ConnectionDetail>)XmlSerializerHelper.Deserialize(deprecatedConnectionsXml, typeof(List <McTools.Xrm.Connection.Deprecated.ConnectionDetail>));
                    foreach (var connection in deprecatedConnections)
                    {
                        connections.Add(UpdateConnection(connection));
                    }
                    var connectionsXml = XmlSerializerHelper.Serialize(connections);
                    _settingsStore.SetString(CollectionPath, ConnectionsPropertyName, connectionsXml);
                    _settingsStore.SetString(CollectionPath, SettingsVersionPropertyName, CurrentConfigurationVersion);
                }
                catch (Exception ex)
                {
                    Logger.Write("Failed to convert connections: " + ex.Message);
                }
            }
        }
Exemple #4
0
        public static string GetTemplate(MockFramework mockFramework, TemplateType templateType)
        {
            string templateSettingKey = GetTemplateSettingsKey(mockFramework, templateType);

            if (Store.PropertyExists(CollectionPath, templateSettingKey))
            {
                return(Store.GetString(CollectionPath, GetTemplateSettingsKey(mockFramework, templateType)));
            }

            return(GetDefaultTemplate(mockFramework, templateType));
        }
        private T GetEnum <T>(string settingName, T defaultValue)
        {
            if (!_userSettingsStore.PropertyExists(SettingsPropName, settingName))
            {
                return(defaultValue);
            }

            var setting = _userSettingsStore.GetString(SettingsPropName, settingName);
            var rval    = (T)Enum.Parse(typeof(T), setting);

            return(rval);
        }
Exemple #6
0
        /// <summary>
        /// Reads and parses Crm Connections from settings store
        /// </summary>
        /// <returns>Returns Crm Connetions</returns>
        private CrmConnections GetCrmConnections()
        {
            if (_settingsStore.PropertyExists(CollectionPath, ConnectionsPropertyName) == false)
            {
                return(null);
            }

            var connectionsXml = _settingsStore.GetString(CollectionPath, ConnectionsPropertyName);

            try
            {
                var connections    = XmlSerializerHelper.Deserialize <List <ConnectionDetail> >(connectionsXml);
                var crmConnections = new CrmConnections {
                    Connections = connections
                };
                var publisAfterUpload = true;
                if (_settingsStore.PropertyExists(CollectionPath, AutoPublishPropertyName))
                {
                    publisAfterUpload = _settingsStore.GetBoolean(CollectionPath, AutoPublishPropertyName);
                }
                crmConnections.PublishAfterUpload = publisAfterUpload;

                var ignoreExtensions = false;
                if (_settingsStore.PropertyExists(CollectionPath, IgnoreExtensionsProprtyName))
                {
                    ignoreExtensions = _settingsStore.GetBoolean(CollectionPath, IgnoreExtensionsProprtyName);
                }
                crmConnections.IgnoreExtensions = ignoreExtensions;


                var extendedLog = false;
                if (_settingsStore.PropertyExists(CollectionPath, ExtendedLogProprtyName))
                {
                    extendedLog = _settingsStore.GetBoolean(CollectionPath, ExtendedLogProprtyName);
                }
                crmConnections.ExtendedLog = extendedLog;

                foreach (var connection in crmConnections.Connections)
                {
                    if (!string.IsNullOrEmpty(connection.UserPassword))
                    {
                        connection.UserPassword = DecryptString(connection.UserPassword);
                    }
                }

                return(crmConnections);
            }
            catch (Exception)
            {
                Logger.WriteLine("Failed to parse connection settings");
                return(null);
            }
        }
Exemple #7
0
        public static void LoadSettings(ISettings settings)
        {
            try
            {
                if (store.CollectionExists(settings.Key) != true)
                {
                    return;
                }

                var type = settings.GetType();

                foreach (var prop in type.GetProperties().Where(p => Attribute.IsDefined(p, typeof(SettingAttribute))))
                {
                    if (prop.PropertyType == typeof(bool))
                    {
                        if (store.PropertyExists(settings.Key, prop.Name))
                        {
                            prop.SetValue(settings, store.GetBoolean(settings.Key, prop.Name));
                        }
                    }
                    else if (prop.PropertyType == typeof(int))
                    {
                        if (store.PropertyExists(settings.Key, prop.Name))
                        {
                            prop.SetValue(settings, store.GetInt32(settings.Key, prop.Name));
                        }
                    }
                    else if (prop.PropertyType == typeof(double))
                    {
                        if (store.PropertyExists(settings.Key, prop.Name))
                        {
                            double.TryParse(store.GetString(settings.Key, prop.Name), out double value);
                            prop.SetValue(settings, value);
                        }
                    }
                    else if (prop.PropertyType == typeof(string))
                    {
                        if (store.PropertyExists(settings.Key, prop.Name))
                        {
                            prop.SetValue(settings, store.GetString(settings.Key, prop.Name));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.Message);
            }
        }
Exemple #8
0
        private void LoadSettings()
        {
            // IsDesignerEnabled, either read from the store or initialize to true.
            IsDesignerEnabled = !_store.PropertyExists(COLLECTION_PATH, IS_DESIGNER_ENABLED_PROPERTY) || _store.GetBoolean(COLLECTION_PATH, IS_DESIGNER_ENABLED_PROPERTY);

            SplitOrientation = _store.PropertyExists(COLLECTION_PATH, SPLIT_ORIENTATION_PROPERTY)
                ? (SplitOrientation)_store.GetInt32(COLLECTION_PATH, SPLIT_ORIENTATION_PROPERTY)
                : SplitOrientation.Default;

            DocumentView = _store.PropertyExists(COLLECTION_PATH, DOCUMENT_VIEW_PROPERTY)
                ? (DocumentView)_store.GetInt32(COLLECTION_PATH, DOCUMENT_VIEW_PROPERTY)
                : DocumentView.SplitView;

            IsReversed = _store.PropertyExists(COLLECTION_PATH, IS_REVERSED_PROPERTY) && _store.GetBoolean(COLLECTION_PATH, IS_REVERSED_PROPERTY);
        }
Exemple #9
0
        public bool WriteStringData(string key, string value)
        {
            try
            {
                if (!_writableSettingsStore.CollectionExists(tasCollectionPath))
                {
                    _writableSettingsStore.CreateCollection(tasCollectionPath);
                }

                _writableSettingsStore.SetString(tasCollectionPath, key, value);

                if (_writableSettingsStore.PropertyExists(tasCollectionPath, key))
                {
                    return(true);
                }
                else
                {
                    throw new Exception($"Tried to write value \"{value}\" to user settings store property \"{key}\" but no such property existed after writing.");
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);

                return(false);
            }
        }
Exemple #10
0
        public bool GetBoolean(string propertyName)
        {
            try
            {
                if (_settingsStore.PropertyExists(CollectionPath, propertyName))
                {
                    return(_settingsStore.GetBoolean(CollectionPath, propertyName));
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            return(false);
        }
 private static void CreatePropertyIfDoesNotExist <T>(string propertyName)
 {
     if (!_userSettingsStore.PropertyExists(CollectionName, propertyName))
     {
         WriteSetting(propertyName, default(T));
     }
 }
        private static void LoadSettingsFromStore(ISettings settings)
        {
            var properties = GetProperties(settings);

            foreach (var prop in properties)
            {
                if (store.PropertyExists(settings.Key, prop.Name))
                {
                    switch (prop.GetValue(settings))
                    {
                    case bool b:
                        prop.SetValue(settings, store.GetBoolean(settings.Key, prop.Name));
                        break;

                    case int i:
                        prop.SetValue(settings, store.GetInt32(settings.Key, prop.Name));
                        break;

                    case double d when double.TryParse(store.GetString(settings.Key, prop.Name), out double value):
                        prop.SetValue(settings, value);

                        break;

                    case string s:
                        prop.SetValue(settings, store.GetString(settings.Key, prop.Name));
                        break;
                    }
                }
            }
        }
Exemple #13
0
        public FormsPlayerViewModel([Import(typeof(SVsServiceProvider))] IServiceProvider services)
        {
            ConnectCommand        = new DelegateCommand(Connect, () => !isConnected);
            DisconnectCommand     = new DelegateCommand(Disconnect, () => isConnected);
            events                = services.GetService <DTE>().Events.DocumentEvents;
            events.DocumentSaved += document => Publish(document.FullName);

            var manager = new ShellSettingsManager(services);

            settings = manager.GetWritableSettingsStore(SettingsScope.UserSettings);
            if (!settings.CollectionExists(SettingsPath))
            {
                settings.CreateCollection(SettingsPath);
            }
            if (settings.PropertyExists(SettingsPath, SettingsKey))
            {
                SessionId = settings.GetString(SettingsPath, SettingsKey, "");
            }

            if (string.IsNullOrEmpty(SessionId))
            {
                // Initialize SessionId from MAC address.
                var mac = NetworkInterface.GetAllNetworkInterfaces()
                          .Where(nic => nic.NetworkInterfaceType != NetworkInterfaceType.Loopback)
                          .Select(nic => nic.GetPhysicalAddress().ToString())
                          .First();

                SessionId = NaiveBijective.Encode(NaiveBijective.Decode(mac));
            }

            TaskScheduler.UnobservedTaskException += OnTaskException;
        }
Exemple #14
0
        static StaticBoilerplateSettings()
        {
            SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);

            Store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            Store.CreateCollection(CollectionPath);

            if (Store.PropertyExists(CollectionPath, TestProjectsKey))
            {
                string dictionaryString = Store.GetString(CollectionPath, TestProjectsKey);

                if (string.IsNullOrEmpty(dictionaryString))
                {
                    TestProjectsDictionary = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                }
                else
                {
                    TestProjectsDictionary = new Dictionary <string, string>(JsonConvert.DeserializeObject <Dictionary <string, string> >(dictionaryString), StringComparer.OrdinalIgnoreCase);
                }
            }
            else
            {
                TestProjectsDictionary = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            }
        }
Exemple #15
0
        public Task <SettingsModel> GetSettingsAsync()
        {
            return(System.Threading.Tasks.Task.Run(() =>
            {
                try
                {
                    if (_writableSettingsStore.PropertyExists(CollectionPath, PropertyName))
                    {
                        var settingsString = _writableSettingsStore.GetString(CollectionPath, PropertyName);
                        return JsonConvert.DeserializeObject <SettingsModel>(settingsString);
                    }
                }
                catch (Exception ex)
                {
                    Debug.Fail(ex.Message);
                }

                return new SettingsModel()
                {
                    WorkItemTypes = new List <SettingItemModel>(),
                    WorkItemStatuses = new List <SettingItemModel>(),
                    Columns = new List <SettingItemModel>(),
                    DaysBackToQuery = 10,
                    MaxWorkItems = 8
                };
            }));
        }
Exemple #16
0
 /// <summary>
 /// Deletes property from settings store if it exists within specified collection
 /// </summary>
 /// <param name="store">Extending class</param>
 /// <param name="collectionPath">Path of the collection of the property</param>
 /// <param name="propertyName">Name of the property</param>
 public static void DeletePropertyIfExists(this WritableSettingsStore store, string collectionPath, string propertyName)
 {
     if (store.PropertyExists(collectionPath, propertyName))
     {
         store.DeleteProperty(collectionPath, propertyName);
     }
 }
        private static void EnsureSettingsStore(WritableSettingsStore settingsStore)
        {
            if (!settingsStore.CollectionExists(SettingsCollection))
            {
                settingsStore.CreateCollection(SettingsCollection);
            }

            if (!settingsStore.PropertyExists(SettingsCollection, ToolchainProperty))
            {
                settingsStore.SetString(SettingsCollection, ToolchainProperty, ToolchainDefault);
            }

            if (!settingsStore.PropertyExists(SettingsCollection, RustupPathProperty))
            {
                settingsStore.SetString(SettingsCollection, RustupPathProperty, RustupPathDefault);
            }
        }
        private object Get(string key, Type targetType = null, object defaultValue = null, SerializationMode serializationMode = SerializationMode.Xml)
        {
            try
            {
                if (targetType == null)
                {
                    targetType = ConvertSettingsType(Check.TryCatch <SettingsType, Exception>(() => settingsStore.GetPropertyType(collectionPath, key)));
                }

                object result = null;

                if (targetType.IsEnum)
                {
                    targetType = typeof(int);
                }
                if (targetType == typeof(bool))
                {
                    result = settingsStore.GetBoolean(collectionPath, key, Convert.ToBoolean(defaultValue));
                }
                else if (targetType == typeof(string))
                {
                    result = settingsStore.GetString(collectionPath, key, defaultValue as string);
                }
                else if (targetType == typeof(int))
                {
                    result = settingsStore.GetInt32(collectionPath, key, Convert.ToInt32(defaultValue));
                }
                else
                {
                    if (settingsStore.PropertyExists(collectionPath, key))
                    {
                        if (serializationMode == SerializationMode.Xml)
                        {
                            string       xmlContent = settingsStore.GetString(collectionPath, key);
                            var          serializer = new XmlSerializer(targetType);
                            MemoryStream ms         = new MemoryStream(Encoding.UTF8.GetBytes(xmlContent));
                            var          res        = serializer.Deserialize(ms);
                            return(res);
                        }
                        else
                        {
                            var ms = settingsStore.GetMemoryStream(collectionPath, key);
                            if (ms != null)
                            {
                                var serializer = new BinaryFormatter();
                                result = serializer.Deserialize(ms);
                            }
                        }
                    }
                }
                return(result ?? defaultValue);
            }
            catch (Exception)
            {
                return(defaultValue);
            }
        }
Exemple #19
0
        public string ReadOption(string key)
        {
            if (_settingsStore.PropertyExists(SettingsRoot, key))
            {
                return(_settingsStore.GetString(SettingsRoot, key));
            }

            return(null);
        }
        internal bool GetBoolean(string propertyName, bool defaultValue)
        {
            EnsureCollectionExists();
            try
            {
                if (!_settingsStore.PropertyExists(CollectionPath, propertyName))
                {
                    return(defaultValue);
                }

                return(_settingsStore.GetBoolean(CollectionPath, propertyName));
            }
            catch (Exception e)
            {
                Report(String.Format(ErrorGetFormat, propertyName), e);
                return(defaultValue);
            }
        }
Exemple #21
0
        private static void RemoveExtensionFromPendingDeletions(WritableSettingsStore settingsStore, IExtensionHeader extensionHeader)
        {
            const string PendingDeletionsCollectionPath = ExtensionManagerCollectionPath + @"\PendingDeletions";
            var          vsixToDeleteProperty           = $"{extensionHeader.Identifier},{extensionHeader.Version}";

            if (settingsStore.CollectionExists(PendingDeletionsCollectionPath) &&
                settingsStore.PropertyExists(PendingDeletionsCollectionPath, vsixToDeleteProperty))
            {
                settingsStore.DeleteProperty(PendingDeletionsCollectionPath, vsixToDeleteProperty);
            }
        }
 public string LoadString(string name, string category)
 {
     var path = GetCollectionPath(category);
     if (!_settingsStore.CollectionExists(path)) {
         return null;
     }
     if (!_settingsStore.PropertyExists(path, name)) {
         return null;
     }
     return _settingsStore.GetString(path, name, "");
 }
        internal VersionProvider(IServiceProvider serviceProvider)
        {
            var settingsManager = new ShellSettingsManager(serviceProvider);
            _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            if (!_settingsStore.CollectionExists(CollectionName))
                _settingsStore.CreateCollection(CollectionName);

            if (_settingsStore.PropertyExists(CollectionName, OldVersionPropertyName))
                _settingsStore.DeleteProperty(CollectionName, OldVersionPropertyName);
        }
Exemple #24
0
 /// <summary>
 /// Returns the value of the requested property whose data type is System.Uri
 /// </summary>
 /// <param name="store">Extending class</param>
 /// <param name="collectionPath">Path of the collection of the property</param>
 /// <param name="propertyName">Name of the property</param>
 /// <returns>Uri or null if not set or not valid uri</returns>
 public static Uri GetUri(this WritableSettingsStore store, string collectionPath, string propertyName)
 {
     if (store.PropertyExists(collectionPath, propertyName))
     {
         Uri    uri   = null;
         string value = store.GetString(collectionPath, propertyName);
         Uri.TryCreate(value, UriKind.Absolute, out uri);
         return(uri);
     }
     return(null);
 }
Exemple #25
0
 /// <summary>
 /// Loads the indent size from the settings store.
 /// </summary>
 /// <param name="store">The writable settings store</param>
 /// <returns>The indent size saved or if not found, the default indent size</returns>
 public static int LoadIndentSize(this WritableSettingsStore store)
 {
     if (!store.PropertyExists(collectionName, indentSizePropertyName))
     {
         store.SaveIndentSize(DefaultRainbowIndentOptions.defaultIndentSize);
         return(DefaultRainbowIndentOptions.defaultIndentSize);
     }
     else
     {
         return(store.GetInt32(collectionName, indentSizePropertyName));
     }
 }
Exemple #26
0
        public static void InitWritableSettings(this WritableSettingsStore settingsStore)
        {
            if (!settingsStore.CollectionExists(PackageSettingsCategory))
            {
                settingsStore.CreateCollection(PackageSettingsCategory);
            }

            if (!settingsStore.PropertyExists(PackageSettingsCategory, PackageReadyPropertyName))
            {
                settingsStore.SetBoolean(PackageSettingsCategory, PackageReadyPropertyName, false);
            }
        }
Exemple #27
0
 /// <summary>
 /// Loads the color string from the settings store
 /// </summary>
 /// <param name="store">The writable settings store</param>
 /// <returns>´The colors string or if not found, the default colors</returns>
 public static string LoadColors(this WritableSettingsStore store)
 {
     if (!store.PropertyExists(collectionName, colorsPropertyName))
     {
         store.SaveColors(DefaultRainbowIndentOptions.defaultColors);
         return(DefaultRainbowIndentOptions.defaultColors);
     }
     else
     {
         return(store.GetString(collectionName, colorsPropertyName));
     }
 }
Exemple #28
0
        public static void LoadCurrent()
        {
            try
            {
                if (!settingsStore.CollectionExists(COLLECTION_PATH))
                {
                    return;
                }

                if (settingsStore.PropertyExists(COLLECTION_PATH, nameof(FontSettings.Font)))
                {
                    CurrentSettings.Font = settingsStore.GetString(COLLECTION_PATH, nameof(FontSettings.Font));
                }

                if (settingsStore.PropertyExists(COLLECTION_PATH, nameof(FontSettings.Size)))
                {
                    var    str = settingsStore.GetString(COLLECTION_PATH, nameof(FontSettings.Size));
                    double size;
                    double.TryParse(str, out size);
                    CurrentSettings.Size = size;
                }

                if (settingsStore.PropertyExists(COLLECTION_PATH, nameof(FontSettings.Italic)))
                {
                    CurrentSettings.Italic = settingsStore.GetBoolean(COLLECTION_PATH, nameof(FontSettings.Italic));
                }

                if (settingsStore.PropertyExists(COLLECTION_PATH, nameof(FontSettings.Opacity)))
                {
                    var    str = settingsStore.GetString(COLLECTION_PATH, nameof(FontSettings.Opacity));
                    double opacity;
                    double.TryParse(str, out opacity);
                    CurrentSettings.Opacity = opacity;
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.Message);
            }
        }
        public Task <SettingsModel> GetSettingsAsync()
        {
            return(Task.Run(() =>
            {
                try
                {
                    // migrate classic storage to newer TeamProjectCollection-based storage
                    if (_writableSettingsStore.PropertyExists(CollectionPath, ClassicPropertyName))
                    {
                        var settingsString = _writableSettingsStore.GetString(CollectionPath, ClassicPropertyName);
                        SaveSetingsString(settingsString);
                        _writableSettingsStore.DeleteProperty(CollectionPath, ClassicPropertyName);
                    }
                }
                catch (Exception ex)
                {
                    Debug.Fail(ex.Message);
                }

                return GetSettingsModel();
            }));
        }
		public BoilerplateSettingsFactory()
		{
			this.dte = (DTE2)ServiceProvider.GlobalProvider.GetService(typeof(DTE));
			this.personalSettings = new BoilerplateSettings(this.personalStore);

			SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);
			WritableSettingsStore store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
			store.CreateCollection(PersonalBoilerplateSettingsStore.CollectionPath);
			if (store.PropertyExists(PersonalBoilerplateSettingsStore.CollectionPath, UserBoilerplateSettings))
			{
				UserCreatedSettingsPath = store.GetString(PersonalBoilerplateSettingsStore.CollectionPath, UserBoilerplateSettings);
			}
		}
Exemple #31
0
 /// <summary>
 /// Returns the value of the requested property whose data type is System.Guid
 /// </summary>
 /// <param name="store">Extending class</param>
 /// <param name="collectionPath">Path of the collection of the property</param>
 /// <param name="propertyName">Name of the property</param>
 /// <returns>Guid or null if not set or not valid uri</returns>
 public static Guid?GetGuid(this WritableSettingsStore store, string collectionPath, string propertyName)
 {
     if (store.PropertyExists(collectionPath, propertyName))
     {
         var guid  = Guid.Empty;
         var value = store.GetString(collectionPath, propertyName);
         if (Guid.TryParse(value, out guid))
         {
             return(guid);
         }
     }
     return(null);
 }