Example #1
0
        /// <summary>
        /// Method to save a string Control property value.
        /// </summary>
        /// <param name="ctrl">The Control.</param>
        /// <param name="propertyName">The property name to store in settings.</param>
        /// <param name="propertyValue">The property value to store in settings.</param>
        /// <returns>The property value stored in settings.</returns>
        public static string SaveString(Control ctrl, string propertyName, string propertyValue = default(string))
        {
            string s = SetString(ctrl, propertyName, propertyValue);

            ApplicationBase.SaveUi();

            return(s);
        }
Example #2
0
        /// <summary>
        /// Method to save a long Control property value.
        /// </summary>
        /// <param name="ctrl">The Control.</param>
        /// <param name="propertyName">The property name to store in settings.</param>
        /// <param name="propertyValue">The property value to store in settings.</param>
        /// <returns>The property value stored in settings.</returns>
        public static long SaveLong(Control ctrl, string propertyName, long propertyValue = default(long))
        {
            long l = SetLong(ctrl, propertyName, propertyValue);

            ApplicationBase.SaveUi();

            return(l);
        }
Example #3
0
        /// <summary>
        /// Method to save an int Control property value.
        /// </summary>
        /// <param name="ctrl">The Control.</param>
        /// <param name="propertyName">The property name to store in settings.</param>
        /// <param name="propertyValue">The property value to store in settings.</param>
        /// <returns>The property value stored in settings.</returns>
        public static int SaveInt(Control ctrl, string propertyName, int propertyValue = default(int))
        {
            int val = SetInt(ctrl, propertyName, propertyValue);

            ApplicationBase.SaveUi();

            return(val);
        }
Example #4
0
        /// <summary>
        /// Method to save a boolean Control property value.
        /// </summary>
        /// <param name="ctrl">The Control.</param>
        /// <param name="propertyName">The property name to store in settings.</param>
        /// <param name="propertyValue">The property value to store in settings.</param>
        /// <returns>The property value stored in settings.</returns>
        public static bool?SaveBool(Control ctrl, string propertyName, bool?propertyValue = default(bool))
        {
            bool?val = SetBool(ctrl, propertyName, propertyValue);

            ApplicationBase.SaveUi();

            return(val);
        }
Example #5
0
        /// <summary>
        /// Method to save an object Control property value.
        /// </summary>
        /// <typeparam name="V">The object Type to store.</typeparam>
        /// <param name="ctrl">The Control.</param>
        /// <param name="propertyName">The property name to store in settings.</param>
        /// <param name="propertyValue">The property value to store in settings.</param>
        /// <returns>The property value stored in settings.</returns>
        public static V SaveValue <V>(Control ctrl, string propertyName, V propertyValue = default(V)) where V : class
        {
            V b = SetValue <V>(ctrl, propertyName, propertyValue);

            ApplicationBase.SaveUi();

            return(b as V);
        }
Example #6
0
        /// <summary>
        /// Method called on theme changed event click.
        /// </summary>
        /// <param name="sender">The <see cref="object"/> sender of the event.</param>
        /// <param name="e">The routed event arguments <see cref="RoutedEventArgs"/>.</param>
        private void ThemeChanged_Click(object sender, RoutedEventArgs e)
        {
            // Ask for user confirmation.
            var result = MessageBoxs.YesNo(Layouts.Dialogs.Properties.Translations.ApplicationRestartRequired, Local.Properties.Translations.Theme);

            if (result != MessageBoxResult.Yes)
            {
                return;
            }

            // Get the Theme name from the event sender.
            string theme = (string)((FrameworkElement)sender).Tag;

            // Add Theme to Application UI Parmeters.
            ApplicationBase.UI.AddParameter("ApplicationTheme", theme);
            ApplicationBase.SaveUi();

            // Restart the application.
            System.Windows.Forms.Application.Restart();
            Application.Current.Shutdown();
        }