Exemple #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);
            }
        }
 public void ConfirmExecute()
 {
     //MCB.DeviceCode=
     if (SelectedItem != null)
     {
         ManualControlBoardService mcbService = new ManualControlBoardService(TheController);
         MCB.DeviceCode = SelectedItem.Code;
         mcbService.Update(MCB);
     }
     //SelfVisibility = Visibility.Collapsed;
     SCA.WPF.Infrastructure.EventMediator.NotifyColleagues("RefreshCollection", MCB);
     //SCA.WPF.Infrastructure.EventMediator.NotifyColleagues("RefreshNavigator", TheController);
 }