Ejemplo n.º 1
0
        private void setDefaults()
        {
            defaultSettings = new SIEEDefaultValues();

            if (!string.IsNullOrEmpty(Properties.Settings.Default.DefaultSettings))
            {
                try
                {
                    defaultSettings.Initialize(Properties.Settings.Default.DefaultSettings);
                }
                catch (Exception e)
                {
                    MessageBox.Show("Could not load default settings from "
                                    + Properties.Settings.Default.DefaultSettings + ":\n" + e.Message);
                    defaultSettings = null;
                }
            }

            defaultFieldValues = new SIEEDefaultValues();

            if (!string.IsNullOrEmpty(Properties.Settings.Default.DefaultValues))
            {
                try { defaultFieldValues.Initialize(Properties.Settings.Default.DefaultValues); }
                catch (Exception e)
                {
                    MessageBox.Show("Could not load default values from "
                                    + Properties.Settings.Default.DefaultValues + ":\n" + e.Message);
                    defaultFieldValues = null;
                }
            }
            defaultDocument = Properties.Settings.Default.DefaultDocument;
        }
Ejemplo n.º 2
0
        public void SetDefaults(Type settingsType, SIEEViewModel vm)
        {
            foreach (KeyValuePair <string, string> propSetting in defaultSettings.GetPropertiesDict(settingsType.Name))
            {
                string propName  = propSetting.Key;
                string propValue = propSetting.Value;

                SIEEDefaultValues.ObjectAndPropertyInfo opi = SIEEDefaultValues.FindProperty(vm, propName.Split('.'));
                if (opi.PropertyInfo == null)
                {
                    continue;
                }

                var newValue = Convert.ChangeType(propValue, opi.PropertyInfo.PropertyType);
                opi.PropertyInfo.SetValue(opi.Object, newValue, null);
            }
        }
Ejemplo n.º 3
0
        private void initializeDefaultSetting()
        {
            defaultSettings = new SIEEDefaultValues();
            var ds = Properties.Settings.Default.DefaultSettings;

            if (!string.IsNullOrEmpty(ds))
            {
                try { defaultSettings.Initialize(ds); }
                catch (Exception e)
                {
                    SIEEMessageBox.Show(
                        "Could not load default settings from " + ds + ":\n" + e.Message,
                        "Default settings",
                        System.Windows.MessageBoxImage.Error);
                }
            }
        }
Ejemplo n.º 4
0
        public static void setDefaults(string type, SIEEFieldlist fieldlist, SIEEDefaultValues defaultFieldValues)
        {
            foreach (SIEEField field in fieldlist)
            {
                if (!defaultFieldValues.Exists(type, field.Name))
                {
                    continue;
                }

                field.Value = defaultFieldValues.Get(type, field.Name);
                if (field is SIEETableField)
                {
                    ((SIEETableField)field).Set_tabValue(field.Value);
                    continue;
                }
            }
        }