public win_grinder(Dev_Grinder grinder, ObservableCollection <Device> a) { _grinder = grinder; _attach_dev = new ObservableCollection <Dev_Hopper>(); if (a != null && a.Count > 0) { foreach (Device item in a) { _attach_dev.Add((Dev_Hopper)item); } } InitializeComponent(); this.DataContext = _grinder; this.part_list.ItemsSource = _attach_dev; }
public DesignerItem(String Uid, DesignerCanvas parent) : this(Guid.NewGuid(), parent) { this.Uid = Uid; // _DesignerCanvas = parent; // attach_Device_list = new ObservableCollection<Device>(); if (Uid.StartsWith("0001-01")) //ES brewer { main_Device = new Dev_ES(parent.GetPositionID(DesignerCanvas.DeviceType.DEV_BREWER)); } else if (Uid.StartsWith("0002")) //grinder { main_Device = new Dev_Grinder(parent.GetPositionID(DesignerCanvas.DeviceType.DEV_GRINDER)); } else if (Uid.StartsWith("0003")) //canister { main_Device = new Dev_Canister(0x01, parent.GetPositionID(DesignerCanvas.DeviceType.DEV_CANISTER)); } else if (Uid.StartsWith("0004")) //mixer { main_Device = new Dev_Mixer_L(parent.GetPositionID(DesignerCanvas.DeviceType.DEV_MIXER)); } else if (Uid.StartsWith("000f-02")) //gravity { main_Device = new Dev_Boiler_G(parent.GetPositionID(DesignerCanvas.DeviceType.DEV_BOILER)); } else if (Uid.StartsWith("000f-03")) //es { main_Device = new Dev_Boiler_ES(parent.GetPositionID(DesignerCanvas.DeviceType.DEV_BOILER)); } else if (Uid.StartsWith("0000-02")) //waiwei { main_Device = new DEV_virMachine(parent.GetPositionID(DesignerCanvas.DeviceType.DEV_VIRMACHINE)); } else if (Uid.StartsWith("000a-01")) //pump { main_Device = new DEV_Waterpump(1, 1); } }