示例#1
0
        public void RefreshDeviceCode(object param)
        {
            try
            {
                SCA.WPF.ManualBoardDeviceCode.ManualBoardDeviceCodeViewModel deviceCodeVM = param as SCA.WPF.ManualBoardDeviceCode.ManualBoardDeviceCodeViewModel;
                EditableManualControlBoard eMCB = ManualControlBoardInfoObservableCollection.Where((d) => d.ID == deviceCodeVM.MCB.ID).FirstOrDefault();
                if (deviceCodeVM != null)
                {
                    switch (deviceCodeVM.ID)
                    {
                    case 1:
                        eMCB.LocalDevice1             = deviceCodeVM.GetResultCode();
                        deviceCodeVM.MCB.LocalDevice1 = eMCB.LocalDevice1;
                        break;

                    case 2:
                        eMCB.LocalDevice2             = deviceCodeVM.GetResultCode();
                        deviceCodeVM.MCB.LocalDevice2 = eMCB.LocalDevice2;
                        break;

                    case 3:
                        eMCB.LocalDevice3             = deviceCodeVM.GetResultCode();
                        deviceCodeVM.MCB.LocalDevice3 = eMCB.LocalDevice3;
                        break;

                    case 4:
                        eMCB.LocalDevice4             = deviceCodeVM.GetResultCode();
                        deviceCodeVM.MCB.LocalDevice4 = eMCB.LocalDevice4;
                        break;

                    case 5:
                        eMCB.NetDevice1             = deviceCodeVM.GetResultCode();
                        deviceCodeVM.MCB.NetDevice1 = eMCB.NetDevice1;
                        break;

                    case 6:
                        eMCB.NetDevice2             = deviceCodeVM.GetResultCode();
                        deviceCodeVM.MCB.NetDevice2 = eMCB.NetDevice2;
                        break;

                    case 7:
                        eMCB.NetDevice3             = deviceCodeVM.GetResultCode();
                        deviceCodeVM.MCB.NetDevice3 = eMCB.NetDevice3;
                        break;

                    case 8:
                        eMCB.NetDevice4             = deviceCodeVM.GetResultCode();
                        deviceCodeVM.MCB.NetDevice4 = eMCB.NetDevice4;
                        break;
                    }
                }
                ManualControlBoardService mcbService = new ManualControlBoardService(TheController);
                mcbService.Update(deviceCodeVM.MCB);
                ManualDeviceCodeVisibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message, ex);
            }
        }
示例#2
0
 public void RefreshCollection(object param)
 {
     if (param != null)
     {
         ManualControlBoard         mcb  = (ManualControlBoard)param;
         EditableManualControlBoard eMCB = ManualControlBoardInfoObservableCollection.Where((d) => d.ID == mcb.ID).FirstOrDefault();
         eMCB.DeviceCode = mcb.DeviceCode;
     }
     DeviceItemSelectorVisibility = Visibility.Collapsed;
 }
        public void AddMoreLines(object param)
        {
            // ObservableCollection<ManualControlBoard> ocMCB = ManualControlBoardInfoObservableCollection;
            object[] values = (object[])param;
            #region 调业务逻辑
            _manualControlBoardService.TheController = this.TheController;
            SCA.Interface.IControllerConfig config = ControllerConfigManager.GetConfigObject(this.TheController.Type);
            int totalMaxKeyNo = config.GetMaxAmountForKeyNoInManualControlBoardConfig();
            for (int i = Convert.ToInt32(values[1]); i <= Convert.ToInt32(values[2]); i++)
            {
                int maxKeyNo = 1;
                //获取当前板卡及回路下的最大"手键号"
                if (ManualControlBoardInfoObservableCollection.Count == 0)
                {
                    maxKeyNo = 1;
                }
                else
                {
                    var result = ManualControlBoardInfoObservableCollection.Where(mcb => mcb.MaxSubBoardNo == i && mcb.BoardNo == Convert.ToInt32(values[0]));
                    if (result.Count() != 0)
                    {
                        maxKeyNo = ManualControlBoardInfoObservableCollection.Where(mcb => mcb.MaxSubBoardNo == i && mcb.BoardNo == Convert.ToInt32(values[0])).Max(mcb => mcb.KeyNo);
                    }
                }
                if (maxKeyNo < totalMaxKeyNo)
                {
                    List <ManualControlBoard> lstMCB = _manualControlBoardService.Create(Convert.ToInt32(values[0]), Convert.ToInt32(values[1]), Convert.ToInt32(values[2]), maxKeyNo, Convert.ToInt32(values[3]));
                    foreach (var v in lstMCB)
                    {
                        EditableManualControlBoard mcb = new EditableManualControlBoard();
                        mcb.Controller   = v.Controller;
                        mcb.ControllerID = v.ControllerID;
                        mcb.ID           = v.ID;
                        mcb.Code         = v.Code;
                        mcb.BoardNo      = v.BoardNo;
                        mcb.SubBoardNo   = v.SubBoardNo;
                        mcb.KeyNo        = v.KeyNo;
                        ManualControlBoardInfoObservableCollection.Add(mcb);
                    }
                }
            }
            #endregion 调业务逻辑


            //SCA.WPF.Infrastructure.EventMediator.NotifyColleagues("ManualControlBoardAddMoreLinesRefreshData",null);
            this.CreateManualControlBoardVisibility = Visibility.Collapsed;
        }
示例#4
0
        public void AddMoreLines(object param)
        {
            if (param != null)
            {
                // ObservableCollection<ManualControlBoard> ocMCB = ManualControlBoardInfoObservableCollection;
                object[] values = (object[])param;
                #region 调业务逻辑
                _manualControlBoardService.TheController = this.TheController;
                //SCA.Interface.IControllerConfig config =ControllerConfigManager.GetConfigObject(this.TheController.Type);
                //int totalMaxKeyNo=config.GetMaxAmountForKeyNoInManualControlBoardConfig();
                //for (int i = Convert.ToInt32(values[1]); i <= Convert.ToInt32(values[2]); i++)
                //{
                //    int maxKeyNo=1;
                //    //获取当前板卡及回路下的最大"手键号"
                //    if (ManualControlBoardInfoObservableCollection.Count == 0)
                //    {
                //        maxKeyNo = 1;
                //    }
                //    else
                //    {
                //        var result = ManualControlBoardInfoObservableCollection.Where(mcb => mcb.MaxSubBoardNo == Convert.ToInt32(values[1]) && mcb.BoardNo == Convert.ToInt32(values[0]));
                //        if(result.Count() != 0)
                //            maxKeyNo = ManualControlBoardInfoObservableCollection.Where(mcb => mcb.MaxSubBoardNo == Convert.ToInt32(values[1]) && mcb.BoardNo == Convert.ToInt32(values[0])).Max(mcb => mcb.KeyNo);
                //    }
                //   if (maxKeyNo < totalMaxKeyNo)
                //   {

                List <ManualControlBoard> lstMCB = _manualControlBoardService.Create(Convert.ToInt32(values[0]), Convert.ToInt32(values[1]), Convert.ToInt32(values[2]), Convert.ToInt32(values[3]));
                foreach (var v in lstMCB)
                {
                    EditableManualControlBoard mcb = new EditableManualControlBoard();
                    mcb.Controller   = v.Controller;
                    mcb.ControllerID = v.ControllerID;
                    mcb.ID           = v.ID;
                    mcb.Code         = v.Code;
                    mcb.BoardNo      = v.BoardNo;
                    mcb.SubBoardNo   = v.SubBoardNo;
                    mcb.KeyNo        = v.KeyNo;
                    ManualControlBoardInfoObservableCollection.Add(mcb);
                }
                //   }
                //}
                #endregion 调业务逻辑
            }
            this.CreateManualControlBoardVisibility = Visibility.Collapsed;
        }
示例#5
0
 public void SelectDeviceExecute(int id, object args)
 {
     if (args != null)
     {
         EditableManualControlBoard eMCB = args as EditableManualControlBoard;
         if (eMCB != null)
         {
             ManualControlBoard mcb = eMCB.ToManualControlBoard();
             CreateManualControlBoardVisibility = Visibility.Collapsed;
             DeviceItemSelectorVisibility       = Visibility.Collapsed;
             ManualDeviceCodeVisibility         = Visibility.Visible;
             ManualBoardDeviceCode.ManualBoardDeviceCodeViewModel deviceCodeVM = new ManualBoardDeviceCode.ManualBoardDeviceCodeViewModel();
             deviceCodeVM.ID    = id;
             deviceCodeVM.MCB   = mcb;
             ManualDeviceCodeVM = deviceCodeVM;
         }
     }
 }
示例#6
0
 public void AddNewRecordExecute(int rowsAmount)
 {
     #region 调业务逻辑
     _manualControlBoardService.TheController = this.TheController;
     //List<ManualControlBoard> lstMCB = _manualControlBoardService.Create(rowsAmount);
     List <ManualControlBoard> lstMCB = _manualControlBoardService.Create(0, 1, 1, rowsAmount);
     #endregion 调业务逻辑
     foreach (var v in lstMCB)
     {
         EditableManualControlBoard mcb = new EditableManualControlBoard();
         mcb.Controller   = v.Controller;
         mcb.ControllerID = v.ControllerID;
         mcb.ID           = v.ID;
         mcb.Code         = v.Code;
         mcb.BoardNo      = v.BoardNo;
         mcb.SubBoardNo   = v.SubBoardNo;
         mcb.KeyNo        = v.KeyNo;
         ManualControlBoardInfoObservableCollection.Add(mcb);
     }
 }
        public void AddNewRecordExecute(int rowsAmount)
        {
            //原对象
            // ObservableCollection<ManualControlBoard> ocMCB = ManualControlBoardInfoObservableCollection;
            #region 调业务逻辑
            _manualControlBoardService.TheController = this.TheController;
            List <ManualControlBoard> lstMCB = _manualControlBoardService.Create(rowsAmount);
            #endregion 调业务逻辑


            foreach (var v in lstMCB)
            {
                EditableManualControlBoard mcb = new EditableManualControlBoard();
                mcb.Controller   = v.Controller;
                mcb.ControllerID = v.ControllerID;
                mcb.ID           = v.ID;
                mcb.Code         = v.Code;
                ManualControlBoardInfoObservableCollection.Add(mcb);
            }
        }