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(); } } }
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 = ""; }
public Form1() { InitializeComponent(); customFunctions = new CustomFunctions(); bindingSource = new BindingSource(); bindingSource.DataSource = customFunctions.FunctionList; }
private void newAutomationToolStripMenuItem_Click(object sender, EventArgs e) { Form6 form = new Form6(true); if (form.ShowDialog() == DialogResult.OK) { customFunctions = form.SessionTemplate; updateBindings(); } }
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); } }