private void ElementSearchOutputFilePathbutton_Click(object sender, RoutedEventArgs e) { string sFileStyle = "XML | *.xml"; string UIKey = "ElementSearchOutputFilePathBox"; string UIKey1 = "OutPutDatasteBox"; string sOutFilePath = UIdictionary[UIKey].MyString; bool bOpenEnable = Outputfile(ref sOutFilePath, sFileStyle); UIdictionary[UIKey1].MyString = ""; try { if (bOpenEnable) { BaseFactory factory = new BaseFactory(CreateConvertParameter()); ElementSearchData elmentSearchData = (ElementSearchData)factory.CreatDataClass("ElementSearchData"); CreateDataMath <ElementSeacrhStruct, ConveyorRow> elmentSearchMath = elmentSearchData.CreateElements; List <ElementSeacrhStruct> lelmentSearchData = elmentSearchData.CreateList(elmentSearchMath); ElementSearchXml elementSearchXml = new ElementSearchXml(); elementSearchXml.Elements = lelmentSearchData; UIdictionary[UIKey1].MyString = DataConvert.ToString(lelmentSearchData); UIdictionary[UIKey].MyString = sOutFilePath; XmlSerialiaztion.XmlSerial(sOutFilePath, elementSearchXml); } } catch (Exception ex) { MessageBox.Show("Build Element Search Data Error: " + ex.Message); } GC.Collect(); }
/// <summary> /// Merge the config files,such as :ALarm_TextList,OPCinfo. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MergeOutputFilePathbutton_Click(object sender, RoutedEventArgs e) { string sFileStyle = "XML | *.xml"; string UIKey = "MergeOutputFilePathBox"; string UIKey1 = "OutPutDatasteBox"; string UIKey2 = "WorkraButton"; string UIKey3 = "ElementSearchraButton"; string sFilePath = UIdictionary[UIKey].MyString; bool? btypeWorkbook = UIdictionary[UIKey2].Mybool; bool? btypeElementSearch = UIdictionary[UIKey3].Mybool; bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle); UIdictionary[UIKey1].MyString = ""; try { if (bOpenEnable) { UIdictionary[UIKey1].MyString = "Merge Datas Successful"; UIdictionary[UIKey].MyString = sFilePath; if (btypeWorkbook == true) { XmlSerialiaztion.XmlSerial(sFilePath, Merge <Workbook>(sPaths)); } else if (btypeElementSearch == true) { XmlSerialiaztion.XmlSerial(sFilePath, Merge <ElementSearchXml>(sPaths)); } } } catch (Exception ex) { MessageBox.Show("Merge files Error: " + ex.Message); } }
/// <summary> /// WPF XAML数据输出 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void XMLOutputbutton_Click(object sender, RoutedEventArgs e) { string sFileStyle = "WPF (.Xaml)|*.Xaml"; string UIKey = "XMLOutPutFilePathteBox"; string UIKey1 = "OutPutDatasteBox"; string UIKey2 = "L1raButton"; string UIKey3 = "L2raButton"; string UIKey4 = "TeBlackraButton"; string UIKey5 = "ElementradioButton"; string UIKey6 = "ViewNameteBox"; string sFilePath = UIdictionary[UIKey].MyString; UIdictionary[UIKey1].MyString = ""; try { bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle); if (bOpenEnable == true) { BaseFactory factory = new BaseFactory(); factory.BaseParameter = CreateConvertParameter(); XamlData Data = (XamlData)factory.CreatDataClass("XamlData"); CreateDataMath <BgElementCommonXaml, ConveyorRow> bgXmalMath; CreateDataMath <BgTextBlock, ConveyorRow> blockTextMath; List <BgElementCommonXaml> bgXamlGroup = new List <BgElementCommonXaml>(); List <BgTextBlock> textBlockGroup = new List <BgTextBlock>(); if (UIdictionary[UIKey2].Mybool == true) { bgXmalMath = Data.CreatL1CommonXaml12307; bgXamlGroup = Data.CreateList(bgXmalMath); } else if (UIdictionary[UIKey3].Mybool == true) { if (UIdictionary[UIKey5].Mybool == true) { bgXmalMath = Data.CreatL2CommonXaml; bgXamlGroup = Data.CreateList(bgXmalMath); } else if (UIdictionary[UIKey4].Mybool == true) { blockTextMath = Data.CreatTextBlock; textBlockGroup = Data.CreateList(blockTextMath); } } ElementXaml elementXaml = new ElementXaml(bgXamlGroup, textBlockGroup, UIdictionary[UIKey6].MyString); XmlSerialiaztion.XmlSerial(@sFilePath, elementXaml); UIdictionary[UIKey].MyString = sFilePath; UIdictionary[UIKey1].MyString = "Build Xaml Successful!"; //System.IO.File.WriteAllText(@sFilePath, UIdictionary[UIKey1].MyString, Encoding.UTF8); } } catch (Exception ex) { MessageBox.Show("Build XML Data Error: " + ex.Message); } GC.Collect(); }
private void ConfOutputbutton_Click(object sender, RoutedEventArgs e) { string sFileStyle = "Excel(.xml) | *.xml"; string UIKey = "ConfOutPutFilePathteBox"; string UIKey1 = "OutPutDatasteBox"; string UIKey2 = "OPCInforaButton"; string UIKey3 = "AlarmListradioButton"; 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.bOPCIfo = (bool)UIdictionary[UIKey2].Mybool; factory.bConvAlarm = (bool)UIdictionary[UIKey3].Mybool; CreateDataMath <List <string>, ConveyorRow> createMath; ConfigData dConfigData; List <List <string> > lls = new List <List <string> >(); //ConfigData dConfigData = (ConfigData)factory.CreatDataClass("ConfigData"); if (UIdictionary[UIKey2].Mybool == true) { string[] sListColName = { "Tag Name", "Type", "Channel", "Device", "DataType" }; factory.sListColName = sListColName.ToList(); dConfigData = (ConfigData)factory.CreatDataClass("ConfigData"); createMath = dConfigData.CreateOPCInfoRows; lls = dConfigData.CreateList(createMath); } if (UIdictionary[UIKey3].Mybool == true) { string[] sListColName = { "SignalName", "AckType", "AlarmTag", "PartName", "Alarm Description", "AlarmGroup", "AlarmType", "AlarmCategory", "Delayed", "ConditionName", "Priority", "GeneralComment","Level1View", "Level2View", "Resetable", "ResetBit", "ALNumber", "CCTVRecording", "ElementID", "ResetSignal", "ExtraTagList", "CISData", "Technical" }; factory.sListColName = sListColName.ToList(); dConfigData = (ConfigData)factory.CreatDataClass("ConfigData"); createMath = dConfigData.CreateAlarmListRows; lls = dConfigData.CreateList(createMath); } UIdictionary[UIKey].MyString = sFilePath; //ExcelFunction.ExcelWrite(sFilePath, dt); //XmlFuction xmlFuction = new XmlFuction(); //xmlFuction.XmlWrite(sFilePath, dt); XmlSerialiaztion.XmlSerial(sFilePath, new Workbook(lls)); UIdictionary[UIKey1].MyString = "Build Datas Successful"; } } catch (Exception ex) { MessageBox.Show("Build OPC Data Error: " + ex.Message); } GC.Collect(); }