Ejemplo n.º 1
0
        //public win_canister(DesignerCanvas a, bool isnew = false)
        //{
        //    hopperitem = new Dev_Hopper(a.GetPositionID(DesignerCanvas.DeviceType.DEV_HOPPER));
        //    InitializeComponent();
        //    isNew = isnew;
        //    this.DataContext = this.hopperitem;


        //    for (int i = 0; i < this.cb_type.Items.Count; i++)
        //    {
        //        int value = Convert.ToInt32((string)(this.cb_type.Items[i] as ComboBoxItem).Tag, 16);
        //        if (value == hopperitem.Powder_type)
        //        {
        //            this.cb_type.SelectedIndex = i;
        //            break;
        //        }
        //    }
        //    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 == hopperitem.Max_capability)
        //        {
        //            this.cb_max_cap.SelectedIndex = i;
        //            break;
        //        }
        //    }
        //}
        public win_canister(Dev_Canister hopperitem)
        {
            this.canisteritem = hopperitem;
            InitializeComponent();
            this.DataContext = this.canisteritem;
            for (int i = 0; i < this.cb_type.Items.Count; i++)
            {
                int value = Convert.ToInt32((string)(this.cb_type.Items[i] as ComboBoxItem).Tag, 16);
                if (value == hopperitem.Powder_type)
                {
                    this.cb_type.SelectedIndex = i;
                    break;
                }
            }
            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 == hopperitem.Max_capability)
                {
                    this.cb_max_cap.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < this.cb_canister.Items.Count; i++)
            {
                int value = Convert.ToInt32((string)(this.cb_canister.Items[i] as ComboBoxItem).Tag, 10);
                if (value == hopperitem.Compent_type)
                {
                    this.cb_canister.SelectedIndex = i;
                    break;
                }
            }
        }
Ejemplo 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);
     }
 }