Ejemplo n.º 1
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            Type[] types = typeof(DAERegister).Assembly.GetTypes();

            foreach (Type type in types)
            {
                // Node
                if (type.IsSubclassOf(typeof(InstructionNodeBase)))
                {
                    classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, Schema.Object.Unqualify(type.Name)), type.AssemblyQualifiedName));
                }

                // Conveyor
                if (type.IsSubclassOf(typeof(Conveyor)))
                {
                    classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, Schema.Object.Unqualify(type.Name)), type.AssemblyQualifiedName));
                }

                // DeviceOperator
                if (type.IsSubclassOf(typeof(Schema.DeviceOperator)))
                {
                    classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, Schema.Object.Unqualify(type.Name)), type.AssemblyQualifiedName));
                }

                // DeviceScalarType
                if (type.IsSubclassOf(typeof(Schema.DeviceScalarType)))
                {
                    classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, Schema.Object.Unqualify(type.Name)), type.AssemblyQualifiedName));
                }
            }

            return(classes);
        }
Ejemplo n.º 2
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, "CacheConnection"), typeof(CacheConnection).AssemblyQualifiedName));
            classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, "CacheConnectionStringBuilder"), typeof(CacheConnectionStringBuilder).AssemblyQualifiedName));

            return(classes);
        }
Ejemplo n.º 3
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, "DocOperator"), typeof(DocOperator).AssemblyQualifiedName));
            classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, "DocLibrary"), typeof(DocLibrary).AssemblyQualifiedName));
            // register ObjectMetaDataNode for testing/proof of concept, todo: move to System later
            classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, "ObjectMetaDataNode"), typeof(ObjectMetaDataNode).AssemblyQualifiedName));

            return(classes);
        }
Ejemplo n.º 4
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, "MSSQLConnection"), typeof(MSSQLConnection).AssemblyQualifiedName));
            classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, "OLEDBConnection"), typeof(OLEDBConnection).AssemblyQualifiedName));
            classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, "SQLCEConnection"), typeof(SQLCEConnection).AssemblyQualifiedName));
            classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, "ClearAllPoolsNode"), typeof(ClearAllPoolsNode).AssemblyQualifiedName));

            return(classes);
        }
Ejemplo n.º 5
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            Type[] types = typeof(Authority).Assembly.GetTypes();

            foreach (Type type in types)
            {
                if (type.IsClass)
                {
                    classes.Add(new SettingsItem(type.FullName, type.AssemblyQualifiedName));
                }
            }

            classes.Add(new SettingsItem("PHINVADS.Core.GenerateTypesNode", typeof(GenerateTypesNode).AssemblyQualifiedName));


            //classes.Add(new SettingsItem("FHIR.Core.FHIRObjectConveyor", typeof(FHIRObjectConveyor).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.GenerateTypesNode", typeof(GenerateTypesNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.FHIRAsJSONSelectorNode", typeof(FHIRAsJSONSelectorNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.FHIRAsJSONReadAccessorNode", typeof(FHIRAsJSONReadAccessorNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.FHIRAsJSONWriteAccessorNode", typeof(FHIRAsJSONWriteAccessorNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.FHIRAsXMLSelectorNode", typeof(FHIRAsXMLSelectorNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.FHIRAsXMLReadAccessorNode", typeof(FHIRAsXMLReadAccessorNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.FHIRAsXMLWriteAccessorNode", typeof(FHIRAsXMLWriteAccessorNode).AssemblyQualifiedName));

            classes.Add(new SettingsItem("PHINVADS.Core.SatisfiesSearchParamNode", typeof(SatisfiesSearchParamNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("PHINVADS.Core.CurrentNode", typeof(NilaryCurrentNode).AssemblyQualifiedName));

            //classes.Add(new SettingsItem("Newtonsoft.Json.Linq.JObject", typeof(JObject).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.JSONObjectConveyor", typeof(JSONObjectConveyor).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicEqualNode", typeof(DynamicEqualNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicSelectorNode", typeof(DynamicSelectorNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicContentSelectorNode", typeof(DynamicContentSelectorNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicContentReadAccessorNode", typeof(DynamicContentReadAccessorNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicContentWriteAccessorNode", typeof(DynamicContentWriteAccessorNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicGetNode", typeof(DynamicGetNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicGetTypeNode", typeof(DynamicGetTypeNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicSetNode", typeof(DynamicSetNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToListNode", typeof(DynamicToListNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToBooleanNode", typeof(DynamicToBooleanNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToByteNode", typeof(DynamicToByteNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToShortNode", typeof(DynamicToShortNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToIntegerNode", typeof(DynamicToIntegerNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToLongNode", typeof(DynamicToLongNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToStringNode", typeof(DynamicToStringNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToDecimalNode", typeof(DynamicToDecimalNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToTimeSpanNode", typeof(DynamicToTimeSpanNode).AssemblyQualifiedName));
            //classes.Add(new SettingsItem("FHIR.Core.DynamicToDateTimeNode", typeof(DynamicToDateTimeNode).AssemblyQualifiedName));

            return(classes);
        }
Ejemplo n.º 6
0
        private string GenerateCsvConfig(string targetFilePath, GenerateConfigSettings newSettings)
        {
            if (!File.Exists(targetFilePath))
            {
                throw new FileNotFoundException("Target CSV file not exist.", targetFilePath);
            }

            var targetFileDir  = Path.GetDirectoryName(targetFilePath);
            var targetFileName = Path.GetFileNameWithoutExtension(targetFilePath);
            var configFilePath = Path.Combine(targetFileDir, targetFileName + ".config.csx");

            if (File.Exists(configFilePath))
            {
                throw new InvalidOperationException($"Config File \"{configFilePath}\" already exists.");
            }

            //Generate a CSV config template.
            var configText = GenerateCsvConfigText(targetFilePath, newSettings.TargetFileEncoding, newSettings.HasHeaderRecord);
            //Save to template file.
            var templateFilePath = Path.Combine(ConfigFileDirectory, newSettings.TemplateName + ".config.csx");

            File.WriteAllText(templateFilePath, configText);

            CurrentConfigFilePath = templateFilePath;
            SettingsList.Add(newSettings.TemplateName);
            return(configText);
        }
Ejemplo n.º 7
0
        public void AddSetting()
        {
            StringCollection scopes = new StringCollection();

            scopes.Add(Setting.Scopes.Base.ToString());
            scopes.Add(Setting.Scopes.DistributionSource.ToString());
            scopes.Add(Setting.Scopes.DistributionTarget.ToString());
            scopes.Add(Setting.Scopes.DistributionExe.ToString());
            foreach (var tab in Tabs)
            {
                scopes.Add(tab.TabName);
            }
            var dialog = new SettingCreationDialog()
            {
                Owner = Application.Current.MainWindow, Scopes = scopes
            };                                                                                                    // TODO #GUI access SettingsDialog

            if (dialog.ShowDialog() == true)
            {
                View.MainWindow mainWindow = (View.MainWindow)System.Windows.Application.Current.MainWindow;
                if (mainWindow != null)
                {
                    SettingsList.Add(new Setting()
                    {
                        Scope = dialog.Scope, Key = dialog.Key, Value = dialog.Value
                    });
                }
            }
        }
Ejemplo n.º 8
0
        public static Options.SettingsList LoadStatic()
        {
            if (!initialized)
            {
                Initialize(SettingsManager.UserSettingsFilename, SettingsManager.SystemSettingsFilename);
            }

            SettingsList list = new SettingsList();

            // We need to find the root (main) node.
            XmlNode mainNode = null;

            foreach (XmlNode mainNodeTemp in userSettings.ChildNodes)
            {
                if (mainNodeTemp.Name.ToLower() == "settings")
                {
                    mainNode = mainNodeTemp;
                }
            }

            // The main node could not be found.
            if (mainNode == null)
            {
                return(list);
            }

            foreach (XmlNode xmlGroup in mainNode.ChildNodes)
            {
                if (xmlGroup.Name.ToLower() == "group")
                {
                    string group = "";
                    foreach (XmlAttribute attr in xmlGroup.Attributes)
                    {
                        if (attr.Name == "name")
                        {
                            group = attr.Value;
                        }
                    }
                    foreach (XmlNode xmlSetting in xmlGroup.ChildNodes)
                    {
                        if (xmlSetting.Name.ToLower() == "setting")
                        {
                            string name = "";
                            foreach (XmlAttribute attr in xmlSetting.Attributes)
                            {
                                if (attr.Name == "name")
                                {
                                    name = attr.Value;
                                }
                            }
                            Setting setting = new Setting(group, name);
                            setting.Data = xmlSetting.InnerText;
                            list.Add(setting);
                        }
                    }
                }
            }

            return(list);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Add the main volume setting
 /// </summary>
 public AudioSettings()
 {
     ClassName = "Audio";
     SettingsList.Add(new Setting("Main Volume", "mainvol", 1f, typeof(float)));
     //SettingsList.Add(new Setting("Music Volume", "musicvol", "", typeof(float)));
     //SettingsList.Add(new Setting("Dialogue Volume", "dialvol", "", typeof(float)));
     //SettingsList.Add(new Setting("Effects Volume", "efxvol", "", typeof(float)));
 }
Ejemplo n.º 10
0
 public void SaveConfigFile(string configText, string templateName = null)
 {
     File.WriteAllText(CurrentConfigFilePath, configText);
     if (templateName != null && !SettingsList.Contains(templateName))
     {
         SettingsList.Add(templateName);
     }
 }
Ejemplo n.º 11
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            classes.Add(new SettingsItem("Alphora.Dataphor.DAE.Connection.DataDirect.Oracle.OracleConnection,Alphora.Dataphor.DAE.Connection.DataDirect.Oracle", typeof(OracleConnection).AssemblyQualifiedName));

            return(classes);
        }
Ejemplo n.º 12
0
        public SettingsViewModel()
        {
            SettingsList.Add(new ColorSettingsViewModel(GlobalSettings.GlobalSettings.ColorSettings));
            SettingsList.Add(new UnitSettingsViewModel(GlobalSettings.GlobalSettings.UnitSettings));
            SettingsList.Add(new FrameRateSettingsViewModel(GlobalSettings.GlobalSettings.FrameRateSettings));

            foreach (BaseSettingsViewModel viewModel in SettingsList)
            {
                viewModel.LoadSettings(null, null);
            }
        }
Ejemplo n.º 13
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            Type[] types = typeof(DAERegister).Assembly.GetTypes();

            foreach (Type type in types)
            {
                // Nodes
                if (type.IsSubclassOf(typeof(PlanNode)))
                {
                    classes.Add(new SettingsItem(String.Format("{0},{1}", type.FullName, AssemblyNameUtility.GetName(type.Assembly.FullName)), type.AssemblyQualifiedName));
                }

                // Devices
                if (type.IsSubclassOf(typeof(Schema.Device)))
                {
                    classes.Add(new SettingsItem(String.Format("{0},{1}", type.FullName, AssemblyNameUtility.GetName(type.Assembly.FullName)), type.AssemblyQualifiedName));
                }

                // Conveyors
                if (type.IsSubclassOf(typeof(Conveyor)))
                {
                    classes.Add(new SettingsItem(String.Format("{0},{1}", type.FullName, AssemblyNameUtility.GetName(type.Assembly.FullName)), type.AssemblyQualifiedName));
                }

                // DeviceOperator
                if (type.IsSubclassOf(typeof(Schema.DeviceOperator)))
                {
                    classes.Add(new SettingsItem(String.Format("{0},{1}", type.FullName, AssemblyNameUtility.GetName(type.Assembly.FullName)), type.AssemblyQualifiedName));
                }

                // DeviceScalarType
                if (type.IsSubclassOf(typeof(Schema.DeviceScalarType)))
                {
                    classes.Add(new SettingsItem(String.Format("{0},{1}", type.FullName, AssemblyNameUtility.GetName(type.Assembly.FullName)), type.AssemblyQualifiedName));
                }
            }

            return(classes);
        }
Ejemplo n.º 14
0
        private void SelectedIndexChangedEvent(ComboBox combo,
                                               SettingsList <StaticMod> listSettingsMods, IList <ExplicitMod> listExplicitMods,
                                               IList <ComboBox> listCombo, IList <int> listSelectedIndex, int indexAA,
                                               bool selectEither)
        {
            int selectedIndexLast = listSelectedIndex[indexAA];

            if (AddItemSelected(combo))
            {
                StaticMod itemNew = listSettingsMods.NewItem(this, null, null);
                if (!Equals(itemNew, null))
                {
                    listSettingsMods.Add(itemNew);
                    string itemAdd = (string)combo.SelectedItem;
                    LoadLists(listSettingsMods, listExplicitMods, listCombo, indexAA, itemNew.GetKey(),
                              selectEither);
                    // If the selection was not successfully set to the new modification,
                    // return to the previous selection.
                    if (Equals(combo.SelectedItem, itemAdd))
                    {
                        combo.SelectedIndex = selectedIndexLast;
                    }
                }
                else
                {
                    // Reset the selected index before edit was chosen.
                    combo.SelectedIndex = selectedIndexLast;
                }
            }
            else if (EditListSelected(combo))
            {
                IEnumerable <StaticMod> listNew = listSettingsMods.EditList(this, null);
                if (listNew != null)
                {
                    listSettingsMods.Clear();
                    listSettingsMods.AddRange(listNew);

                    string selectedItemLast = null;
                    if (selectedIndexLast != -1)
                    {
                        selectedItemLast = combo.Items[selectedIndexLast].ToString();
                    }
                    LoadLists(listSettingsMods, listExplicitMods, listCombo, indexAA, selectedItemLast,
                              selectEither);
                }
                else
                {
                    // Reset the selected index before edit was chosen.
                    combo.SelectedIndex = selectedIndexLast;
                }
            }
            listSelectedIndex[indexAA] = combo.SelectedIndex;
        }
Ejemplo n.º 15
0
        public bool LoadSettings()
        {
            SettingsList.Clear();

            // Loads in the config in XML format
            try
            {
                _configFile = XElement.Load(Settings.Default.ChromaConfigPath);

                if (_configFile == null)
                {
                    SettingsLoaded = false;
                    return(SettingsLoaded);
                }
            }
            catch (Exception ex)
            {
                LastError = ex.ToString();
                Hs.Instance._log.LogException("Error Loading Chroma Config", ex);
                SettingsLoaded = false;
                return(SettingsLoaded);
            }

            // Parses out the XML doc into settings
            try
            {
                foreach (var setting in _configFile.Descendants("setting"))
                {
                    if (setting.Attribute("name") == null)
                    {
                        continue;
                    }

                    var name = setting.Attribute("name")?.Value;
                    var val  = setting.Value;

                    SettingsList.Add(new ChromaSetting()
                    {
                        SettingName = name, SettingValue = val
                    });
                }

                SettingsLoaded = true;
            }
            catch (Exception ex)
            {
                LastError = ex.ToString();
                Hs.Instance._log.LogException("Error Parsing Chroma Config", ex);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 16
0
        public void LoadSettings()
        {
            try
            {
                Proxies.AppClient AppClient = new Proxies.AppClient();

                var query = AppClient.LoadSettings();

                SettingsType SettingXML = new SettingsType();
                SettingXML.Code  = "APP";
                SettingXML.Value = query;
                string UnparsedXML = (string)SettingXML.Value;

                if (UnparsedXML != "<>")
                {
                    XDocument SettingsXML = XDocument.Parse(UnparsedXML);
                    Type      T           = this.GetType();

                    var settings = from rs in SettingsXML.Descendants()
                                   select new
                    {
                        objectvalue = rs.Value,
                        code        = rs.Name
                    };

                    foreach (var item in settings)
                    {
                        SettingsList.Add(new SettingsType {
                            Code = item.code.ToString(), Value = item.objectvalue
                        });

                        PropertyInfo PropToAssign = T.GetProperty(item.code.ToString());

                        if (PropToAssign != null)
                        {
                            PropToAssign.SetValue(this, item.objectvalue);
                        }
                    }
                }
                else
                {
                    var firsttime = new Stocky.Views.FirstTimeView();
                    firsttime.ShowDialog();
                }
            }


            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// add the default settings
 /// </summary>
 public ControlsSettings()
 {
     ClassName = "Controls";
     SettingsList.Add(new Setting("Move Forward", "mforw", KeyCode.W, typeof(KeyCode)));
     SettingsList.Add(new Setting("Move Left", "mleft", KeyCode.A, typeof(KeyCode)));
     SettingsList.Add(new Setting("Move Backwards", "mback", KeyCode.S, typeof(KeyCode)));
     SettingsList.Add(new Setting("Move Right", "mright", KeyCode.D, typeof(KeyCode)));
     SettingsList.Add(new Setting("Jump", "jump", KeyCode.Space, typeof(KeyCode)));
     SettingsList.Add(new Setting("Crouch", "crouch", KeyCode.LeftControl, typeof(KeyCode)));
     SettingsList.Add(new Setting("Sprint", "sprint", KeyCode.LeftShift, typeof(KeyCode)));
     SettingsList.Add(new Setting("W-Dimension Up", "wup", KeyCode.I, typeof(KeyCode)));
     SettingsList.Add(new Setting("W-Dimension Down", "wdown", KeyCode.J, typeof(KeyCode)));
     SettingsList.Add(new Setting("Open Inventory", "oinv", KeyCode.E, typeof(KeyCode)));
 }
        protected ISettingsList LoadSectionSettings(XElement sectionElement)
        {
            SettingsList settings = new SettingsList();

            XNamespace sectionNamespace = sectionElement.GetDefaultNamespace();
            var        settingsList     = from settingNode in sectionElement.Descendants(sectionNamespace + "setting")
                                          select CreateSetting(settingNode);

            foreach (var setting in settingsList)
            {
                settings.Add(setting);
            }

            return(settings);
        }
Ejemplo n.º 19
0
        public void GetConfigFiles()
        {
            Directory.CreateDirectory(ConfigFileDirectory);
            var files = Directory.GetFiles(ConfigFileDirectory, "*.config.csx");

            SettingsList.Clear();

            var items = new[] { AutoGenerateTemplateName }
            .Concat(files.Select(x => Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(x))));

            foreach (var item in items)
            {
                SettingsList.Add(item);
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// adds the given Setting to the SettingsCollection
        /// </summary>
        /// <typeparam name="TSetting">the generic type of the Setting</typeparam>
        /// <param name="setting">the Setting to be added to the SettingsCollection</param>
        public SettingsCollection Add <TSetting>(TSetting setting)
            where TSetting : ISetting
        {
            if (setting == null)
            {
                throw new ArgumentNullException("setting");
            }
            if (Contains(setting))
            {
                throw new ArgumentException(string.Format("The SettingsCollection already contains a type of {0}.", setting.GetType().Name), "setting");
            }
            if (!Validate.IsSettingFor(setting, Type))
            {
                throw new ArgumentException(string.Format("The SettingsCollection is restricted only to {0} settings.", Type), "setting");
            }

            SettingsList.Add(setting);
            return(this);
        }
Ejemplo n.º 21
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            Type[] types = typeof(GenerateTypesNode).Assembly.GetTypes();

            foreach (Type type in types)
            {
                if (GenerateTypesNode.ShouldGenerateType(type))
                {
                    classes.Add(new SettingsItem(type.FullName, type.AssemblyQualifiedName));
                }
            }

            classes.Add(new SettingsItem("CQF.Model.ModelObjectConveyor", typeof(ModelObjectConveyor).AssemblyQualifiedName));
            classes.Add(new SettingsItem("CQF.Model.GenerateTypesNode", typeof(GenerateTypesNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("CQF.Model.ModelAsXMLSelectorNode", typeof(ModelAsXMLSelectorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("CQF.Model.ModelAsXMLReadAccessorNode", typeof(ModelAsXMLReadAccessorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("CQF.Model.ModelAsXMLWriteAccessorNode", typeof(ModelAsXMLWriteAccessorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("CQF.Model.ModelEqualNode", typeof(ModelEqualNode).AssemblyQualifiedName));

            return(classes);
        }
        protected ISettingsList LoadSectionSettings(XElement sectionElement)
        {
            SettingsList settings = new SettingsList();

            XNamespace sectionNamespace = sectionElement.GetDefaultNamespace();
            var settingsList = from settingNode in sectionElement.Descendants(sectionNamespace + "setting")
                               select CreateSetting(settingNode);

            foreach (var setting in settingsList)
            {
                settings.Add(setting);
            }

            return settings;
        }
Ejemplo n.º 23
0
        private void SelectedIndexChangedEvent(ComboBox combo,
                                               SettingsList <StaticMod> listSettingsMods, IList <ExplicitMod> listExplicitMods,
                                               IList <ComboBox> listCombo, IList <int> listSelectedIndex, int indexAA,
                                               bool selectEither)
        {
            int selectedIndexLast = listSelectedIndex[indexAA];

            if (AddItemSelected(combo))
            {
                StaticMod itemNew = listSettingsMods.NewItem(this, null, null);
                if (!Equals(itemNew, null))
                {
                    listSettingsMods.Add(itemNew);
                    string itemAdd = (string)combo.SelectedItem;
                    LoadLists(listSettingsMods, listExplicitMods, listCombo, indexAA, itemNew.GetKey(),
                              selectEither);
                    // If the selection was not successfully set to the new modification,
                    // return to the previous selection.
                    if (Equals(combo.SelectedItem, itemAdd))
                    {
                        combo.SelectedIndex = selectedIndexLast;
                    }
                }
                else
                {
                    // Reset the selected index before edit was chosen.
                    combo.SelectedIndex = selectedIndexLast;
                }
            }
            else if (EditCurrentSelected(combo))
            {
                StaticMod itemEdit;
                if (listSettingsMods.TryGetValue((string)combo.Items[selectedIndexLast], out itemEdit))
                {
                    StaticMod itemNew = listSettingsMods.EditItem(this, itemEdit, listSettingsMods, null);
                    if (!Equals(itemNew, null))
                    {
                        int i = listSettingsMods.IndexOf(itemEdit);
                        listSettingsMods[i] = itemNew;
                        LoadLists(listSettingsMods, listExplicitMods, listCombo, indexAA, itemNew.GetKey(),
                                  selectEither);
                    }
                }
                combo.SelectedIndex = selectedIndexLast;
            }
            else if (EditListSelected(combo))
            {
                IEnumerable <StaticMod> listNew = listSettingsMods.EditList(this, null);
                if (listNew != null)
                {
                    listSettingsMods.Clear();
                    listSettingsMods.AddRange(listNew);

                    string selectedItemLast = null;
                    if (selectedIndexLast != -1)
                    {
                        selectedItemLast = combo.Items[selectedIndexLast].ToString();
                    }
                    LoadLists(listSettingsMods, listExplicitMods, listCombo, indexAA, selectedItemLast,
                              selectEither);
                }
                else
                {
                    // Reset the selected index before edit was chosen.
                    combo.SelectedIndex = selectedIndexLast;
                }
            }
            else
            {
                string    modName = (string)combo.SelectedItem;
                StaticMod staticMod;
                if (!string.IsNullOrEmpty(modName) && listSettingsMods.TryGetValue(modName, out staticMod))
                {
                    if (!EnsureLinkedPeptide(staticMod, indexAA))
                    {
                        combo.SelectedIndex = selectedIndexLast;
                    }
                }
            }
            listSelectedIndex[indexAA] = combo.SelectedIndex;
        }
Ejemplo n.º 24
0
        private void SelectedIndexChangedEvent(ComboBox combo,
            SettingsList<StaticMod> listSettingsMods, IList<ExplicitMod> listExplicitMods,
            IList<ComboBox> listCombo, IList<int> listSelectedIndex, int indexAA,
            bool selectEither)
        {
            int selectedIndexLast = listSelectedIndex[indexAA];
            if (AddItemSelected(combo))
            {
                StaticMod itemNew = listSettingsMods.NewItem(this, null, null);
                if (!Equals(itemNew, null))
                {
                    listSettingsMods.Add(itemNew);
                    string itemAdd = (string) combo.SelectedItem;
                    LoadLists(listSettingsMods, listExplicitMods, listCombo, indexAA, itemNew.GetKey(),
                        selectEither);
                    // If the selection was not successfully set to the new modification,
                    // return to the previous selection.
                    if (Equals(combo.SelectedItem, itemAdd))
                        combo.SelectedIndex = selectedIndexLast;
                }
                else
                {
                    // Reset the selected index before edit was chosen.
                    combo.SelectedIndex = selectedIndexLast;
                }
            }
            else if (EditListSelected(combo))
            {
                IEnumerable<StaticMod> listNew = listSettingsMods.EditList(this, null);
                if (listNew != null)
                {
                    listSettingsMods.Clear();
                    listSettingsMods.AddRange(listNew);

                    string selectedItemLast = null;
                    if (selectedIndexLast != -1)
                        selectedItemLast = combo.Items[selectedIndexLast].ToString();
                    LoadLists(listSettingsMods, listExplicitMods, listCombo, indexAA, selectedItemLast,
                        selectEither);
                }
                else
                {
                    // Reset the selected index before edit was chosen.
                    combo.SelectedIndex = selectedIndexLast;
                }
            }
            listSelectedIndex[indexAA] = combo.SelectedIndex;
        }
Ejemplo n.º 25
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            Type[] types = typeof(Base).Assembly.GetTypes();

            foreach (Type type in types)
            {
                if (type.Equals(typeof(Base)) || type.IsSubclassOf(typeof(Base)))
                {
                    classes.Add(new SettingsItem(type.FullName, type.AssemblyQualifiedName));
                }
            }

            classes.Add(new SettingsItem("FHIR.Core.FHIRObjectConveyor", typeof(FHIRObjectConveyor).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.GenerateTypesNode", typeof(GenerateTypesNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.FHIRAsJSONSelectorNode", typeof(FHIRAsJSONSelectorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.FHIRAsJSONReadAccessorNode", typeof(FHIRAsJSONReadAccessorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.FHIRAsJSONWriteAccessorNode", typeof(FHIRAsJSONWriteAccessorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.FHIRAsXMLSelectorNode", typeof(FHIRAsXMLSelectorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.FHIRAsXMLReadAccessorNode", typeof(FHIRAsXMLReadAccessorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.FHIRAsXMLWriteAccessorNode", typeof(FHIRAsXMLWriteAccessorNode).AssemblyQualifiedName));

            classes.Add(new SettingsItem("FHIR.Core.SatisfiesSearchParamNode", typeof(SatisfiesSearchParamNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.CurrentNode", typeof(NilaryCurrentNode).AssemblyQualifiedName));

            return(classes);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Add fps setting
 /// </summary>
 public GeneralSettings()
 {
     ClassName = "General";
     SettingsList.Add(new Setting("Show fps", "showfps", false, typeof(bool)));
 }
Ejemplo n.º 27
0
        public static SettingsList GetClasses()
        {
            SettingsList classes = new SettingsList();

            Type[] types = typeof(DAERegister).Assembly.GetTypes();

            foreach (Type type in types)
            {
                // Nodes
                if (type.IsSubclassOf(typeof(PlanNode)))
                {
                    classes.Add(new SettingsItem(String.Format("{0}.{1}", D4ClassDefinitionNameSpace, Schema.Object.Unqualify(type.Name)), type.AssemblyQualifiedName));
                }

                // Devices
//				if (LType.IsSubclassOf(typeof(Schema.Device)))
//					LClasses.Add(new SettingsItem(String.Format("{0}.{1}", CD4ClassDefinitionNameSpace, Schema.Object.Unqualify(LType.Name)), LType.AssemblyQualifiedName));
//
//				// Conveyors
//				if (LType.IsSubclassOf(typeof(Conveyor)))
//					LClasses.Add(new SettingsItem(String.Format("{0}.{1}", CD4ClassDefinitionNameSpace, Schema.Object.Unqualify(LType.Name)), LType.AssemblyQualifiedName));
//
//				// DeviceOperator
//				if (LType.IsSubclassOf(typeof(Schema.DeviceOperator)))
//					LClasses.Add(new SettingsItem(String.Format("{0}.{1}", CD4ClassDefinitionNameSpace, Schema.Object.Unqualify(LType.Name)), LType.AssemblyQualifiedName));
//
//				// DeviceScalarType
//				if (LType.IsSubclassOf(typeof(Schema.DeviceScalarType)))
//					LClasses.Add(new SettingsItem(String.Format("{0}.{1}", CD4ClassDefinitionNameSpace, Schema.Object.Unqualify(LType.Name)), LType.AssemblyQualifiedName));
            }

            classes.Add(new SettingsItem("Newtonsoft.Json.Linq.JObject", typeof(JObject).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.JSONObjectConveyor", typeof(JSONObjectConveyor).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicEqualNode", typeof(DynamicEqualNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicSelectorNode", typeof(DynamicSelectorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicContentSelectorNode", typeof(DynamicContentSelectorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicContentReadAccessorNode", typeof(DynamicContentReadAccessorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicContentWriteAccessorNode", typeof(DynamicContentWriteAccessorNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicGetNode", typeof(DynamicGetNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicGetTypeNode", typeof(DynamicGetTypeNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicSetNode", typeof(DynamicSetNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToListNode", typeof(DynamicToListNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToBooleanNode", typeof(DynamicToBooleanNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToByteNode", typeof(DynamicToByteNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToShortNode", typeof(DynamicToShortNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToIntegerNode", typeof(DynamicToIntegerNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToLongNode", typeof(DynamicToLongNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToStringNode", typeof(DynamicToStringNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToDecimalNode", typeof(DynamicToDecimalNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToTimeSpanNode", typeof(DynamicToTimeSpanNode).AssemblyQualifiedName));
            classes.Add(new SettingsItem("FHIR.Core.DynamicToDateTimeNode", typeof(DynamicToDateTimeNode).AssemblyQualifiedName));

            return(classes);
        }
        /// SettingsViewModel (Constructor)- Jacob Monger
        /// <summary>
        /// Sets up commands, add settings and alert limits to respective lists
        /// </summary>
        public SettingsViewModel()
        {
            UpdateSettingsCommand = new RelayCommand(UpdateSettings);
            UpdateAlertCommand    = new RelayCommand(UpdateAlert);

            App.Current.Dispatcher.Invoke((Action) delegate //delegate to UI thread
            {
                SettingsList.Add(new SettingsListItemModel("ECULeftTorqueDemandXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("ECULeftTorqueDemandXLagMax"));
                SettingsList.Add(new SettingsListItemModel("ECULeftTorqueDemandXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("ECURightTorqueDemandXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("ECURightTorqueDemandXLagMax"));
                SettingsList.Add(new SettingsListItemModel("ECURightTorqueDemandXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("ECUAcclerationDemandXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("ECUAcclerationDemandXLagMax"));
                SettingsList.Add(new SettingsListItemModel("ECUAcclerationDemandXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("ECUFrontBrakeDemandXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("ECUFrontBrakeDemandXLagMax"));
                SettingsList.Add(new SettingsListItemModel("ECUFrontBrakeDemandXNofDataPoint"));

                SettingsList.Add(new SettingsListItemModel("KistlerVelXXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("KistlerVelXXLagMax"));
                SettingsList.Add(new SettingsListItemModel("KistlerVelXXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("KistlerVelYXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("KistlerVelYXLagMax"));
                SettingsList.Add(new SettingsListItemModel("KistlerVelYXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("KistlerAcclerationXXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("KistlerAcclerationXXLagMax"));
                SettingsList.Add(new SettingsListItemModel("KistlerAcclerationXXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("KistlerAcclerationYXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("KistlerAcclerationYXLagMax"));
                SettingsList.Add(new SettingsListItemModel("KistlerAcclerationYXNofDataPoint"));

                SettingsList.Add(new SettingsListItemModel("RightInverterSpeedXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("RightInverterSpeedXLagMax"));
                SettingsList.Add(new SettingsListItemModel("RightInverterSpeedXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("RightInverterMechanicalPowerXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("RightInverterMechanicalPowerXLagMax"));
                SettingsList.Add(new SettingsListItemModel("RightInverterMechanicalPowerXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("RightInverterAbsolutePhaseCurrentXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("RightInverterAbsolutePhaseCurrentXLagMax"));
                SettingsList.Add(new SettingsListItemModel("RightInverterAbsolutePhaseCurrentXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("RightInverterLinkVoltageDCXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("RightInverterLinkVoltageDCXLagMax"));
                SettingsList.Add(new SettingsListItemModel("RightInverterLinkVoltageDCXNofDataPoint"));

                SettingsList.Add(new SettingsListItemModel("LeftInverterSpeedXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterSpeedXLagMax"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterSpeedXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterMechanicalPowerXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterMechanicalPowerXLagMax"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterMechanicalPowerXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterAbsolutePhaseCurrentXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterAbsolutePhaseCurrentXLagMax"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterAbsolutePhaseCurrentXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterLinkVoltageDCXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterLinkVoltageDCXLagMax"));
                SettingsList.Add(new SettingsListItemModel("LeftInverterLinkVoltageDCXNofDataPoint"));

                SettingsList.Add(new SettingsListItemModel("RightPCBTempXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("RightPCBTempXLagMax"));
                SettingsList.Add(new SettingsListItemModel("RightPCBTempXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("LeftPCBTempXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("LeftPCBTempXLagMax"));
                SettingsList.Add(new SettingsListItemModel("LeftPCBTempXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("TotalAverageBatteryTempXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("TotalAverageBatteryTempXLagMax"));
                SettingsList.Add(new SettingsListItemModel("TotalAverageBatteryTempXNofDataPoint"));
                SettingsList.Add(new SettingsListItemModel("GearBoxTempXLagSpacing"));
                SettingsList.Add(new SettingsListItemModel("GearBoxTempXLagMax"));
                SettingsList.Add(new SettingsListItemModel("GearBoxTempXNofDataPoint"));

                SettingsList.Add(new SettingsListItemModel("GaugeLeftInverterSpeedMin"));
                SettingsList.Add(new SettingsListItemModel("GaugeLeftInverterSpeedMax"));
                SettingsList.Add(new SettingsListItemModel("GaugeRightInverterSpeedMin"));
                SettingsList.Add(new SettingsListItemModel("GaugeRightInverterSpeedMax"));
                SettingsList.Add(new SettingsListItemModel("GaugeLeftMechanicalPowerMin"));
                SettingsList.Add(new SettingsListItemModel("GaugeLeftMechanicalPowerMax"));
                SettingsList.Add(new SettingsListItemModel("GaugeRightMechanicalPowerMin"));
                SettingsList.Add(new SettingsListItemModel("GaugeRightMechanicalPowerMax"));
                SettingsList.Add(new SettingsListItemModel("GaugeVelocityXMin"));
                SettingsList.Add(new SettingsListItemModel("GaugeVelocityXMax"));
                SettingsList.Add(new SettingsListItemModel("GaugeVelocityYMin"));
                SettingsList.Add(new SettingsListItemModel("GaugeVelocityYMax"));

                SettingsList.Add(new SettingsListItemModel("LenghtOfAlertList")); // number of items in alert list
                SettingsList.Add(new SettingsListItemModel("WriteToDataLog"));    // enable data logging
            });

            App.Current.Dispatcher.Invoke((Action) delegate
            {
                AlertList.Add(new AlertListItemModel("ECULeftTorqueDemandMax"));
                AlertList.Add(new AlertListItemModel("ECULeftTorqueDemandMin"));
                AlertList.Add(new AlertListItemModel("ECURightTorqueDemandMax"));
                AlertList.Add(new AlertListItemModel("ECURightTorqueDemandMin"));
                AlertList.Add(new AlertListItemModel("ECUAcclerationDemandMax"));
                AlertList.Add(new AlertListItemModel("ECUAcclerationDemandMin"));
                AlertList.Add(new AlertListItemModel("ECUFrontBrakeDemandMax"));
                AlertList.Add(new AlertListItemModel("ECUFrontBrakeDemandMin"));

                AlertList.Add(new AlertListItemModel("KistlerVelXMax"));
                AlertList.Add(new AlertListItemModel("KistlerVelXMin"));
                AlertList.Add(new AlertListItemModel("KistlerVelYMax"));
                AlertList.Add(new AlertListItemModel("KistlerVelYMin"));
                AlertList.Add(new AlertListItemModel("KistlerAcclerationXMax"));
                AlertList.Add(new AlertListItemModel("KistlerAcclerationXMin"));
                AlertList.Add(new AlertListItemModel("KistlerAcclerationYMax"));
                AlertList.Add(new AlertListItemModel("KistlerAcclerationYMin"));

                AlertList.Add(new AlertListItemModel("RightInverterSpeedMax"));
                AlertList.Add(new AlertListItemModel("RightInverterSpeedMin"));
                AlertList.Add(new AlertListItemModel("RightInverterMechanicalPowerMax"));
                AlertList.Add(new AlertListItemModel("RightInverterMechanicalPowerMin"));
                AlertList.Add(new AlertListItemModel("RightInverterAbsolutePhaseCurrentMax"));
                AlertList.Add(new AlertListItemModel("RightInverterAbsolutePhaseCurrentMin"));
                AlertList.Add(new AlertListItemModel("RightInverterLinkVoltageDCMax"));
                AlertList.Add(new AlertListItemModel("RightInverterLinkVoltageDCMin"));

                AlertList.Add(new AlertListItemModel("LeftInverterSpeedMax"));
                AlertList.Add(new AlertListItemModel("LeftInverterSpeedMin"));
                AlertList.Add(new AlertListItemModel("LeftInverterMechanicalPowerMax"));
                AlertList.Add(new AlertListItemModel("LeftInverterMechanicalPowerMin"));
                AlertList.Add(new AlertListItemModel("LeftInverterAbsolutePhaseCurrentMax"));
                AlertList.Add(new AlertListItemModel("LeftInverterAbsolutePhaseCurrentMin"));
                AlertList.Add(new AlertListItemModel("LeftInverterLinkVoltageDCMax"));
                AlertList.Add(new AlertListItemModel("LeftInverterLinkVoltageDCMin"));

                AlertList.Add(new AlertListItemModel("RightPCBTempMax"));
                AlertList.Add(new AlertListItemModel("RightPCBTempMin"));
                AlertList.Add(new AlertListItemModel("LeftPCBTempMax"));
                AlertList.Add(new AlertListItemModel("LeftPCBTempMin"));
                AlertList.Add(new AlertListItemModel("TotalAverageBatteryTempMax"));
                AlertList.Add(new AlertListItemModel("TotalAverageBatteryTempMin"));
                AlertList.Add(new AlertListItemModel("GearBoxTempMax"));
                AlertList.Add(new AlertListItemModel("GearBoxTempMin"));
            });

            SelectAlertValue      = "ECULeftTorqueDemandMax";
            SelectIndexValue      = "ECULeftTorqueDemandXLagSpacing";
            SelectedAlertsIndex   = 0;
            SelectedSettingsIndex = 0;
        }