Esempio n. 1
0
 public win_water_pump(DEV_Waterpump a, ObservableCollection <Device> b)
 {
     InitializeComponent();
     if (a == null)
     {
         _data_pump = new DEV_Waterpump(1, 1);
     }
     else
     {
         _data_pump = a;
     }
     if (b == null)
     {
         _data_flow = new DEV_Flowmeter(1, 1);
     }
     else
     {
         if (b.Count >= 1)
         {
             _data_flow = (DEV_Flowmeter)b[0];
         }
         else
         {
             _data_flow = new DEV_Flowmeter(1, 1);
         }
     }
     this.sp_flowmeter.DataContext = _data_flow;
     this.sp_pump.DataContext      = _data_pump;
     for (int i = 0; i < this.pump_type.Items.Count; i++)
     {
         int value = Convert.ToInt32((string)(this.pump_type.Items[i] as ComboBoxItem).Tag, 10);
         if (value == _data_pump.Compent_type)
         {
             this.pump_type.SelectedIndex = i;
             break;
         }
     }
     for (int i = 0; i < this.cb_flow.Items.Count; i++)
     {
         int value = Convert.ToInt32((string)(this.cb_flow.Items[i] as ComboBoxItem).Tag, 10);
         if (value == _data_flow.Compent_type)
         {
             this.cb_flow.SelectedIndex = i;
             break;
         }
     }
 }
Esempio n. 2
0
 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);
     }
 }