using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using TProduct.ProcessDrawing.Components; using TProduct.ProcessDrawing.Models; namespace TProduct.ProcessDrawing { /// /// /// public class DeviceItemHelper { public static String BuildThumbIconPath(string icon) { return "pack://application:,,,/TProduct.ProcessDrawing.Assets;component/Images/Thumbs/" + icon; } public static List GetAllThumb() { DeviceThumbCatalogModel catalog设备 = new DeviceThumbCatalogModel() { DispName = "设备" }; catalog设备.Children = new List(){ new DeviceThumbItemModel() { ID = 1, Icon = BuildThumbIconPath("Pump1.png"), ComponentName = "Pump1", DispName ="泵", }, new DeviceThumbItemModel() { ID = 2, Icon = BuildThumbIconPath("can2.png"), ComponentName = "GasTank", DispName = "压力罐", }, //new DeviceThumbItemModel() //{ // ID = 4, // Icon = BuildThumbIconPath("dryer2.png"), // ComponentName = "AdsorptionDryer", // DispName = "吸附式干燥机", //}, //new DeviceThumbItemModel() //{ // ID = 5, // Icon = BuildThumbIconPath("filter.png"), // ComponentName = "Filter", // DispName = "过滤器" //} , //new DeviceThumbItemModel() //{ // ID = 6, // Icon = BuildThumbIconPath("air_compressor.png"), // ComponentName = "AirCompressor", // DispName="空压机", //}, //new DeviceThumbItemModel() //{ // ID = 7, // Icon = BuildThumbIconPath("dryer.png"), // ComponentName = "FreezeDryer", // DispName = "干燥机" //} }; DeviceThumbCatalogModel catalog管路 = new DeviceThumbCatalogModel() { DispName = "管路" }; catalog管路.Children = new List(){new DeviceThumbItemModel() { ID = 111, Icon = BuildThumbIconPath("pipeline1.png"), ComponentName = "HorizontalPipeline", DispName="水平管道" } ,new DeviceThumbItemModel() { ID = 112, Icon = BuildThumbIconPath("pipeline2.png"), ComponentName = "VerticalPipeline", DispName="垂直管道" },new DeviceThumbItemModel() { ID = 113, Icon = BuildThumbIconPath("rt_joints.png"), ComponentName = "RAJoints", DispName="直角接头" }, new DeviceThumbItemModel() { ID = 114, Icon = BuildThumbIconPath("valve1.png"), ComponentName = "Valve1", DispName = "阀门" }, new DeviceThumbItemModel() { ID = 115, Icon = BuildThumbIconPath("tee_joints.png"), ComponentName= "TeeJoints", DispName="直角三通接头" }}; DeviceThumbCatalogModel catalog仪表 = new DeviceThumbCatalogModel() { DispName = "仪表" }; catalog仪表.Children = new List(){new DeviceThumbItemModel() { ID = 211, Icon = BuildThumbIconPath("meter.png"), ComponentName = "Temperature", DispName="温度" },new DeviceThumbItemModel() { ID = 212, Icon = BuildThumbIconPath("meter2.png"), ComponentName = "Humidity", DispName="湿度" },new DeviceThumbItemModel() { ID = 213, Icon = BuildThumbIconPath("meter.png"), ComponentName = "Pressure", DispName="压力" },new DeviceThumbItemModel() { ID = 214, Icon = BuildThumbIconPath("meter.png"), ComponentName = "Flow", DispName="流量" },new DeviceThumbItemModel() { ID = 215, Icon = BuildThumbIconPath("meter.png"), ComponentName = "Speed", DispName="转速" },new DeviceThumbItemModel() { ID = 216, Icon = BuildThumbIconPath("icon.png"), ComponentName = "CurrentI", DispName="电流" }, }; List all = new List(); all.Add(catalog设备); all.Add(catalog管路); all.Add(catalog仪表); return all; } public static ObservableCollection InitialDefaultProp(string ComponentType, Action onChangeed) { var defaultPrpList = new ObservableCollection(); //defaultPrpList.Add(new DevicePropModel() //{ // PropTag = "WorkBench", // PropName = "测试台位", // PropValue = "", // OnChangePropValue = onChangeed //}); //if (ComponentType == "VerticalPipeline" || ComponentType == "HorizontalPipeline") //{ // //defaultPrpList.Add(new DevicePropModel() // //{ // // PropTag = "Dia", // // PropName = "口径", // // PropValue = "", // // PropDispStyle = "combox", // //}); //} return defaultPrpList; } public static Dictionary GetPropOptions(string prop_tag) { switch (prop_tag) { case "WorkBench": { Dictionary values = new Dictionary(); values.Add("全部", "ALL"); values.Add("1号", "1"); values.Add("2号", "2"); values.Add("3号", "3"); values.Add("4号", "4"); values.Add("5号", "5"); return values; } default: break; } return null; } public static List GetPipeDiaList() { var DiaList = new List(); DiaList.Add(new DiaModel() { Text = "DN25", Value = 25 }); DiaList.Add(new DiaModel() { Text = "DN40", Value = 40 }); DiaList.Add(new DiaModel() { Text = "DN50", Value = 50 }); DiaList.Add(new DiaModel() { Text = "DN65", Value = 65 }); DiaList.Add(new DiaModel() { Text = "DN80", Value = 80 }); DiaList.Add(new DiaModel() { Text = "DN100", Value = 100 }); DiaList.Add(new DiaModel() { Text = "DN150", Value = 150 }); DiaList.Add(new DiaModel() { Text = "DN200", Value = 200 }); DiaList.Add(new DiaModel() { Text = "DN250", Value = 250 }); return DiaList; } } }