public MainForm() { InitializeComponent(); m_hmiDataFile_default = new HmiData(); tbValveName.MaxLength = 15; //VALVE_NAME_MAX_LENTH SetConnectStateDisplay(); m_spPort.ReceivedDataHandle = m_atc.ReceivedFunc; SourceFile = System.Windows.Forms.Application.StartupPath + "\\configfile" + "\\hmidata.dat"; TargetFile = "/hmi/disk/hmidata.dat"; }
private void Openfile(string fileName) { m_hmiDataFile = new HmiData(fileName); if (m_hmiDataFile.m_loaded) { UTF8Encoding temp = new UTF8Encoding(true); PasswordForm dlg = new PasswordForm(temp.GetString(m_hmiDataFile.password)); if (dlg.ShowDialog() == DialogResult.OK) { if (tvPortInfo.Nodes.Count > 0) { tvPortInfo.Nodes.Clear(); } SetPortConfigDisplay(); } } }
private void tsNew_Click(object sender, EventArgs e) { SaveFileDialog SaveFileDialog1 = new SaveFileDialog(); SaveFileDialog1.InitialDirectory = System.Windows.Forms.Application.StartupPath + "\\configfile"; SaveFileDialog1.Filter = "CFG files (*.dat)|*.dat"; SaveFileDialog1.FilterIndex = 1; SaveFileDialog1.RestoreDirectory = true; if (SaveFileDialog1.ShowDialog() == DialogResult.OK) { m_hmiDataFile = new HmiData(); m_hmiDataFile.SaveFile(SaveFileDialog1.FileName); if (tvPortInfo.Nodes.Count > 0) { tvPortInfo.Nodes.Clear(); } SetPortConfigDisplay(); } }