Exemple #1
0
        /// <summary>
        /// Activate the caption settings UI
        /// </summary>
        partial void Activate()
        {
            bool isCustomCaptionSettings = false;

            object value;

            if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.TryGetValue(CaptionSettingsPage.OverrideDefaultKey, out value))
            {
                isCustomCaptionSettings = (bool)value;
            }

            if (isCustomCaptionSettings)
            {
                if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.TryGetValue(LocalSettingsKey, out value))
                {
                    var xml = value.ToString();

                    this.Settings = CustomCaptionSettings.FromString(xml);
                }
                else
                {
                    this.Settings = new CustomCaptionSettings();
                }

                this.IsDefault = false;
            }
            else
            {
                this.Settings = new CustomCaptionSettings();

                this.IsDefault = true;
            }
        }
Exemple #2
0
        /// <summary>
        /// Initialize the settings
        /// </summary>
        private void InitializeSettings()
        {
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            object value;

            bool overrideDefaults = false;

            if (localSettings.Values.TryGetValue(CaptionSettingsControl.OverrideDefaultKey, out value))
            {
                overrideDefaults = (bool)value;
            }

            if (overrideDefaults)
            {
                this.IsDefault = false;

                if (localSettings.Values.TryGetValue(LocalSettingsKey, out value))
                {
                    var settingsString = value.ToString();

                    this.Settings = CustomCaptionSettings.FromString(settingsString);
                }
                else
                {
                    this.Settings = new CustomCaptionSettings();
                }
            }
            else
            {
                this.Settings = new CustomCaptionSettings();

                this.IsDefault = true;
            }
        }
        /// <summary>
        /// Activate the plug-in
        /// </summary>
        partial void Activate()
        {
            SettingsPane.GetForCurrentView().CommandsRequested += this.CaptionsSettingsPlugin_CommandsRequested;

            object value;

            if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.TryGetValue(LocalSettingsKey, out value))
            {
                var settingsString = value.ToString();

                this.Settings = CustomCaptionSettings.FromString(settingsString);

                this.IsDefault = false;
            }
            else
            {
                this.Settings = new CustomCaptionSettings();

                this.IsDefault = true;
            }

            this.Settings.PropertyChanged += this.Settings_PropertyChanged;
        }