//public Dev_Fan _fan { get; set; } public win_mixer(Dev_Mixer_L a, ObservableCollection <Device> b) { _mixer = a; _attach_dev = new ObservableCollection <Dev_Fan>(); if (b.Count > 0) { foreach (Device item in b) { _attach_dev.Add((Dev_Fan)item); } } InitializeComponent(); this.DataContext = a; if (b.Count == 1) { this.gd_fan.DataContext = b[0]; this.ckb_fan.IsChecked = true; } else { this.gd_fan.Visibility = Visibility.Hidden; } for (int i = 0; i < this.cb_max_cap.Items.Count; i++) { int value = Convert.ToInt32((string)(this.cb_max_cap.Items[i] as ComboBoxItem).Tag, 10); if (value == _mixer.Max_capability) { this.cb_max_cap.SelectedIndex = i; break; } } }
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); } }