public AdvancedSBSettings ReadAdvancedSBSettings()
        {
            AdvancedSBSettings advancedSBSettings = new AdvancedSBSettings();

            advancedSBSettings.candidates = Int16.Parse(tbCandidates.Text);
            return(advancedSBSettings);
        }
Ejemplo n.º 2
0
        public static AdvancedSBSettings LoadAdvancedSBSettings(string folderPath)
        {
            AdvancedSBSettings adsbSettings = new
                                              AdvancedSBSettings();

            XmlReaderSettings xmlSettings = new XmlReaderSettings();

            xmlSettings.ValidationType = ValidationType.None;

            XmlReader settingsReader = XmlReader.Create(folderPath + AdvancedSBSettingsFileName, xmlSettings);

            while (settingsReader.Read())
            {
                if (settingsReader.NodeType == XmlNodeType.Element &&
                    settingsReader.Name == "Candidates")
                {
                    settingsReader.Read();
                    adsbSettings.candidates =
                        Int16.Parse(settingsReader.Value);
                    settingsReader.Read();
                }
            }
            settingsReader.Close();
            return(adsbSettings);
        }
Ejemplo n.º 3
0
 public SLTestWorkspace(String workspaceName)
     : base(workspaceName, FunctionTypeEnum.State_Based_Controller)
 {
     if (SettingFilesManager.SBSettingsExists(SettingFilesManager.SettingsFolderPath))
     {
         slSettings         = SettingFilesManager.LoadSBSettings(SettingFilesManager.SettingsFolderPath);
         advancedSBSettings = SettingFilesManager.LoadAdvancedSBSettings(SettingFilesManager.SettingsFolderPath);
     }
     else
     {
         slSettings         = new SLSettings(true);
         advancedSBSettings = new AdvancedSBSettings();
     }
 }
Ejemplo n.º 4
0
        public AdvancedSBSettingsForm()
        {
            InitializeComponent();
            AdvancedSBSettings advancedSBSettings;

            if (SettingFilesManager.AdvancedSBSettingsExists(SettingFilesManager.SettingsFolderPath))
            {
                advancedSBSettings = SettingFilesManager.LoadAdvancedSBSettings(
                    SettingFilesManager.SettingsFolderPath);
            }
            else
            {
                advancedSBSettings = new AdvancedSBSettings();
            }

            parentAdvancedSBSettingsForm = new ParentAdvancedSBSettingsForm();
            parentAdvancedSBSettingsForm.LoadAdvancedSBSettings(advancedSBSettings);
            this.Controls.Add(parentAdvancedSBSettingsForm);
        }
Ejemplo n.º 5
0
        public static void SaveAdvancedSBSettings(string folderPath, AdvancedSBSettings adSBSettings)
        {
            XmlWriterSettings xmlSettings = new XmlWriterSettings();

            xmlSettings.Indent = true;

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }
            XmlWriter settingsWriter = XmlWriter.Create(folderPath + AdvancedSBSettingsFileName, xmlSettings);

            settingsWriter.WriteStartElement("body");

            settingsWriter.WriteStartElement("Candidates");
            settingsWriter.WriteValue(adSBSettings.candidates.ToString());
            settingsWriter.WriteEndElement();

            settingsWriter.WriteEndElement();
            settingsWriter.Close();
        }
 public void LoadAdvancedSBSettings(AdvancedSBSettings advancedSBSettings)
 {
     tbCandidates.Text = advancedSBSettings.candidates.ToString();
 }