private void SorteIOOutputFilePathbutton_Click(object sender, RoutedEventArgs e) { string sFileStyle = "Excel(.csv) | *.csv"; string UIKey = "SorteIOOutputFilePathBox"; string UIKey1 = "OutPutDatasteBox"; string UIKey2 = "SorteIOInputFilePathBox"; string sOutFilePath = UIdictionary[UIKey].MyString; string sInFilePath = UIdictionary[UIKey2].MyString; bool bOpenEnable = Outputfile(ref sOutFilePath, sFileStyle); UIdictionary[UIKey1].MyString = ""; try { if (bOpenEnable & sInFilePath != "") { DataTable dt = XmlSerialiaztion.XmlDeserial <SignalMonitor>(sInFilePath).ToDataTable(); UIdictionary[UIKey].MyString = sOutFilePath; //ExcelFunction.ExcelWrite(sFilePath, dt); CsvFunction.CsvWirte(sOutFilePath, dt); UIdictionary[UIKey1].MyString = DataConvert.ToString(dt); } } catch (Exception ex) { MessageBox.Show("Build OPC Data Error: " + ex.Message); } GC.Collect(); }
private void OPCDataOutputbutton_Click(object sender, RoutedEventArgs e) { //string sFileStyle = "Excel(.xlsx) | *.xlsx|Excel(.xls) | *.xls"; string sFileStyle = "Excel(.csv) | *.csv"; string UIKey = "OPCDataOutPutFilePathteBox"; string UIKey1 = "OutPutDatasteBox"; string UIKey2 = "SinglecheckBox"; string UIKey3 = "CommandcheckBox"; string UIKey4 = "HourcheckBox"; string sFilePath = UIdictionary[UIKey].MyString; bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle); UIdictionary[UIKey1].MyString = ""; try { if (bOpenEnable) { BaseFactory factory = new BaseFactory(); factory.BaseParameter = CreateConvertParameter(); factory.bSingle = (bool)UIdictionary[UIKey2].Mybool; factory.bCommand = (bool)UIdictionary[UIKey3].Mybool; factory.bHours = (bool)UIdictionary[UIKey4].Mybool; OPCData opcData = (OPCData)factory.CreatDataClass("OPCData"); CreateDataMath <List <string>, ConveyorRow> createOPCMath = opcData.CreateOPCRows; var opcdataList = opcData.CreateList(createOPCMath); UIdictionary[UIKey].MyString = sFilePath; //ExcelFunction.ExcelWrite(sFilePath, dt); CsvFunction.CsvWirte(sFilePath, opcdataList); UIdictionary[UIKey1].MyString = DataConvert.ToString(opcdataList); } } catch (Exception ex) { MessageBox.Show("Build OPC Data Error: " + ex.Message); } GC.Collect(); }