public void SaveSettingsObject(object settingsObject, Type settingsType = null)
        {
            //this bit of a hack but the XrmConnections module tries to save a settings object
            //we dont want because we use the package settings
            //instead so lets just ignore it
            if (settingsObject is SavedXrmConnections)
            {
                return;
            }
            var type = settingsType ?? settingsObject.GetType();

            if (settingsObject is XrmRecordConfiguration)
            {
                type = typeof(XrmRecordConfiguration);
            }
            var savedFileSetting = GetSavedSolutionFileSetting(type);

            if (savedFileSetting != null)
            {
                VisualStudioService.AddVsixSetting(savedFileSetting.UsePersonalisedFile ? savedFileSetting.PersonalisedFileName : savedFileSetting.FileName, settingsObject);
            }
            else
            {
                DesktopSettingsManager.SaveSettingsObject(settingsObject, settingsType: settingsType);
            }
        }
Esempio n. 2
0
        public void SaveSettingsObject(object settingsObject, Type settingsType = null)
        {
            //this bit of a hack but the XrmConnections module tries to save a settings object
            //we dont want because we use the package settings
            //instead so lets just ignore it
            if (settingsObject is SavedXrmConnections)
            {
                return;
            }
            var type = settingsType ?? settingsObject.GetType();

            if (SolutionSettingTypes.ContainsKey(type))
            {
                VisualStudioService.AddSolutionItem(MapTypeToFileName(type), settingsObject);
            }
            else
            {
                DesktopSettingsManager.SaveSettingsObject(settingsObject, settingsType: settingsType);
            }
        }
Esempio n. 3
0
        public void DesktopSettingsManagerTest()
        {
            var fakeApplicationController = new FakeApplicationController();

            FileUtility.DeleteFiles(fakeApplicationController.SettingsPath);
            FileUtility.DeleteSubFolders(fakeApplicationController.SettingsPath);

            var settingsManager = new DesktopSettingsManager(fakeApplicationController);

            var resolveNotYetCreated = settingsManager.Resolve <TestResolveType>();

            Assert.IsNotNull(resolveNotYetCreated);
            Assert.AreEqual(0, resolveNotYetCreated.Int);

            resolveNotYetCreated.Int = 50;
            settingsManager.SaveSettingsObject(resolveNotYetCreated);

            var resolveAfterCreation = settingsManager.Resolve <TestResolveType>();

            Assert.AreEqual(resolveNotYetCreated.Int, resolveAfterCreation.Int);
        }