Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            _controlInformation = new ControlInformation();

            PrepareForm();
        }
        /// <summary>
        /// Loads the control information from the given file.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static ControlInformation Load(string fileName)
        {
            ControlInformation ci = new ControlInformation();

            XDocument doc = XDocument.Load(fileName);
            ci.FaxName = doc.Root.TryGetAttributeValue("Name", null);

            // Parse the sections...
            foreach (XElement sectionE in doc.Root.Elements("Section"))
            {
                ci.Sections.Add(new SectionDefinition(sectionE));
            }

            return ci;
        }
        /// <summary>
        /// Loads the control information from the given file.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static ControlInformation Load(string fileName)
        {
            ControlInformation ci = new ControlInformation();

            XDocument doc = XDocument.Load(fileName);

            ci.FaxName = doc.Root.TryGetAttributeValue("Name", null);

            // Parse the sections...
            foreach (XElement sectionE in doc.Root.Elements("Section"))
            {
                ci.Sections.Add(new SectionDefinition(sectionE));
            }

            return(ci);
        }
Esempio n. 4
0
        private void LoadControlInformationFile()
        {
            string fileName = SettingsManager.Instance.GetSetting("GenericParser", "ControlFile").GetString();
            if (string.IsNullOrWhiteSpace(fileName))
            {
                return;
            }

            if (!Path.IsPathRooted(fileName))
            {
                fileName = Path.Combine(Utilities.GetWorkingDirectory(), fileName);
            }

            _controlInformation = ControlInformation.Load(fileName);
        }
Esempio n. 5
0
 private void tsmOpen_Click(object sender, System.EventArgs e)
 {
     OpenFileDialog ofd = new OpenFileDialog();
     ofd.Filter = Properties.Resources.Controlfile_FilterText;
     ofd.InitialDirectory = Application.StartupPath;
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         _controlInformation = ControlInformation.Load(ofd.FileName);
         UpdateFromControlInformation();
     }
 }