Пример #1
0
        private void openAutomationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                //Get the path of specified file
                string filePath = openFileDialog1.FileName;
                Properties.Settings.Default.currentXMLTemplate = filePath;
                MessageBox.Show(Properties.Settings.Default.currentXMLTemplate);


                //Read the contents of the file into a stream
                var           fileStream = openFileDialog1.OpenFile();
                XmlSerializer ser        = new XmlSerializer(typeof(CustomFunctions), new Type[] { typeof(AbsoluteSearchFunction), typeof(StringOccurenceFunction) });
                try
                {
                    StreamReader rdr = new StreamReader(filePath);
                    customFunctions = (CustomFunctions)ser.Deserialize(rdr);


                    updateBindings();
                }
                catch (Exception er)
                {
                    er.ToString();
                }
            }
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Properties.Settings.Default.lastDirectory))
            {
                folderBrowserDialog1.SelectedPath = Properties.Settings.Default.lastDirectory;
            }
            if (!String.IsNullOrEmpty(Properties.Settings.Default.currentXMLTemplate))
            {
                string filePath = Properties.Settings.Default.currentXMLTemplate;

                //Read the contents of the file into a stream
                try
                {
                    var fileStream = openFileDialog1.OpenFile();
                }
                catch (Exception er)
                {
                    er.ToString();
                }
                XmlSerializer ser = new XmlSerializer(typeof(CustomFunctions), new Type[] { typeof(AbsoluteSearchFunction), typeof(StringOccurenceFunction) });
                try
                {
                    StreamReader rdr = new StreamReader(filePath);
                    customFunctions = (CustomFunctions)ser.Deserialize(rdr);
                    updateBindings();
                }

                catch (Exception er)
                {
                    MessageBox.Show(er.Message);
                }
            }

            dataset = "";
        }
Пример #3
0
 public Form1()
 {
     InitializeComponent();
     customFunctions          = new CustomFunctions();
     bindingSource            = new BindingSource();
     bindingSource.DataSource = customFunctions.FunctionList;
 }
Пример #4
0
        private void newAutomationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form6 form = new Form6(true);

            if (form.ShowDialog() == DialogResult.OK)
            {
                customFunctions = form.SessionTemplate;
                updateBindings();
            }
        }
Пример #5
0
        public void LoadTemplate()
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                //Get the path of specified file
                filePath = openFileDialog1.FileName;

                //Read the contents of the file into a stream
                var           fileStream = openFileDialog1.OpenFile();
                XmlSerializer ser        = new XmlSerializer(typeof(CustomFunctions), new Type[] { typeof(AbsoluteSearchFunction), typeof(StringOccurenceFunction) });

                StreamReader rdr = new StreamReader(filePath);

                SessionTemplate = (CustomFunctions)ser.Deserialize(rdr);
            }
        }