Ejemplo n.º 1
0
 void ReadingExcelComplete(ControllerModel controller, string errorMessage)
 {
     EventMediator.NotifyColleagues("DisappearProgressBar", null);
     SCA.BusinessLib.ProjectManager.GetInstance.TheControllerViaImporting = controller;
     ToggleButtonStateForReadingExcel(false);
     DisplayContentSelectorPage(errorMessage);
 }
Ejemplo n.º 2
0
        //public static readonly RoutedEvent AllControllerInfoUploadedEvent = EventManager.RegisterRoutedEvent(
        //    "AllControllerInfoUploaded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(SummaryInfoView)
        //);


        //public event RoutedEventHandler AllControllerInfoUploaded
        //{
        //    add { AddHandler(AllControllerInfoUploadedEvent, value); }
        //    remove { RemoveHandler(AllControllerInfoUploadedEvent, value); }
        //}


        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            // if (TheController != null)
            // {
            // ControllerModel controller=new ControllerModel();
            // //controller.ID = TheController.ID;

            // ControllerModel controller = ((SCA.WPF.ViewModelsRoot.ViewModels.Query.SummaryInfoViewModel)this.DataContext).TheController;
            // TheController.Name = ControllerNameInputTextBox.Text;
            // TheController.MachineNumber = MachineNumberInputTextBox.Text;

            // TheController.BaudRate = Convert.ToInt32(BaudsRateComboBox.SelectedItem);

            // TheController.PortName = ComPortComboBox.SelectedItem.ToString();
            SCA.WPF.ViewModelsRoot.ViewModels.Query.SummaryInfoViewModel vm = (SCA.WPF.ViewModelsRoot.ViewModels.Query.SummaryInfoViewModel) this.DataContext;
            ControllerModel controller = vm.TheController;

            controller.Name          = ControllerNameInputTextBox.Text;
            controller.MachineNumber = MachineNumberInputTextBox.Text;
            controller.PortName      = ComPortComboBox.SelectedItem.ToString();
            controller.BaudRate      = Convert.ToInt32(BaudsRateComboBox.SelectedItem);
            vm.SaveExecute(controller);
            controller.IsDirty = true;

            EventMediator.NotifyColleagues("RefreshNavigator", controller);
            RaiseEvent(new RoutedEventArgs(AddButtonClickEvent, controller));
            // }
        }
Ejemplo n.º 3
0
 public void UpdateProgressBarUI(int currentValue)
 {
     object[] args = new object[2];
     args[0] = currentValue;
     args[1] = 100;
     EventMediator.NotifyColleagues("UpdateProgressBarStatusForExcelReading", args);//读取EXCEL时的进度条
 }
Ejemplo n.º 4
0
 private void UpdateProcessBarStatus(int currentValue, int totalValue, ControllerNodeType nodeType)
 {
     object[] status = new object[3];
     status[0] = currentValue;
     status[1] = totalValue;
     status[2] = nodeType;
     EventMediator.NotifyColleagues("UpdateProgressBarStatusEvent", status);
 }
Ejemplo n.º 5
0
 public void ReadingExcelErrorHandler(string errorMessage)
 {
     EventMediator.NotifyColleagues("DisappearProgressBar", null);
     ToggleButtonStateForReadingExcel(false);
     if (errorMessage != "" && errorMessage != null) //需要显示错误信息
     {
         DisplayContentSelectorPage(errorMessage);
     }
 }
Ejemplo n.º 6
0
 private void btnSetMasterController_Click(object sender, RoutedEventArgs e)
 {
     if (this.HierarchyTreeView.SelectedItem.GetType() == typeof(SCA.WPF.ViewModelsRoot.ViewModels.Navigator.NavigatorItemViewModel))
     {
         if (((SCA.WPF.ViewModelsRoot.ViewModels.Navigator.NavigatorItemViewModel) this.HierarchyTreeView.SelectedItem).DataItem.GetType() == typeof(SCA.Model.ControllerModel))
         {
             ProjectManager.GetInstance.SetPrimaryControllerByID(((SCA.Model.ControllerModel)((SCA.WPF.ViewModelsRoot.ViewModels.Navigator.NavigatorItemViewModel) this.HierarchyTreeView.SelectedItem).DataItem).ID);
             EventMediator.NotifyColleagues("RefreshNavigator", true);
         }
     }
 }
Ejemplo n.º 7
0
 public void CanceledExcelImportHandler(ControllerModel controller, string errorMessage)
 {
     EventMediator.NotifyColleagues("DisappearProgressBar", null);
     ToggleButtonStateForReadingExcel(false);
     if (errorMessage != null)
     {
         if (errorMessage != "") //需要显示错误信息
         {
             DisplayContentSelectorPage(errorMessage);
         }
     }
 }
Ejemplo n.º 8
0
        public void OpenProjectFileExecute()
        {
            VistaOpenFileDialog dialog = new VistaOpenFileDialog();

            dialog.Filter = "工程文件 (*.nt)|*.nt";
            dialog.ShowDialog();
            if (dialog.FileName != "")
            {
                ProjectManager.GetInstance.OpenProject(dialog.FileName);
                EventMediator.NotifyColleagues("DisplayTheOpenedProject", null);
            }
        }
Ejemplo n.º 9
0
        private void UploadedFinished(ControllerModel controller)
        {
            ControllerModel c = SCA.BusinessLib.ProjectManager.GetInstance.GetControllerBySpecificID(TheController.ID);

            if (controller.Loops != null)
            {
                foreach (var loop in controller.Loops)
                {
                    //  loop.Code = loop.ID.ToString().PadLeft(c.LoopAddressLength, '0');
                    //  loop.Name = loop.Code;
                    loop.Controller = c;
                    c.Loops.Add(loop);
                }
            }
            if (controller.StandardConfig != null)
            {
                foreach (var linkage in controller.StandardConfig)
                {
                    c.StandardConfig.Add(linkage);
                }
            }
            if (controller.MixedConfig != null)
            {
                foreach (var linkage in controller.MixedConfig)
                {
                    c.MixedConfig.Add(linkage);
                }
            }
            if (controller.GeneralConfig != null)
            {
                foreach (var linkage in controller.GeneralConfig)
                {
                    c.GeneralConfig.Add(linkage);
                }
            }
            if (controller.ControlBoard != null)
            {
                foreach (var board in controller.ControlBoard)
                {
                    c.ControlBoard.Add(board);
                }
            }


            //p.Controllers.Add(controller);
            //List<SCA.Model.ProjectModel> lstProject = new List<SCA.Model.ProjectModel>();
            //lstProject.Add(p);


            EventMediator.NotifyColleagues("UploadedFinished", TheController);
        }
Ejemplo n.º 10
0
 public void ConfirmExecute()
 {
     object [] numbers = new object[5];
     numbers[0] = BoardNo;
     numbers[1] = SubBoardStartNo;
     numbers[2] = SubBoardEndNo;
     if (Key64)
     {
         numbers[3] = 64;
     }
     else
     {
         numbers[3] = KeyNoAmount;
     }
     EventMediator.NotifyColleagues("ManualControlBoardAddMoreLines", numbers);
 }
Ejemplo n.º 11
0
        public void AddMoreLineExecute()
        {
            object [] numbers = new object[5];
            numbers[0] = BoardNo;
            numbers[1] = SubBoardStartNo;
            numbers[2] = SubBoardEndNo;

            //EventMediator.Register("AddMoreLines", AddMoreLines);
            if (Key64)
            {
                numbers[3] = 64;
            }
            else
            {
                numbers[3] = KeyNoAmount;
            }
            EventMediator.NotifyColleagues("ManualControlBoardAddMoreLines", numbers);
            //SCA.WPF.Infrastructure.EventMediator.Register("", RefreshData);
            //List<SCA.Model.ProjectModel> lstProject = new List<SCA.Model.ProjectModel>();
            //lstProject.Add(SCA.BusinessLib.ProjectManager.GetInstance.Project);
            // NavigatingViewModel.UpdateControllerInfo((ControllerModel)((RoutedEventArgs)o).OriginalSource);
            // SetNavigatingViewModel(lstProject);
        }
Ejemplo n.º 12
0
        public void ComfirmExecute()
        {
            this.ErrorMessagePromptImportFilePath = "";
            this.ErrorMessagePromptName           = "";
            this.ErrorMessagePromptSaveFilePath   = "";
            bool          verifyFlag    = true;
            ProjectConfig projectConfig = new ProjectConfig();
            Dictionary <string, RuleAndErrorMessage> dictRule = projectConfig.GetProjectInfoRegularExpression();
            RuleAndErrorMessage rule = dictRule["Name"];
            Regex exminator          = new Regex(rule.Rule);

            if (!string.IsNullOrEmpty(ProjectName))
            {
                if (!exminator.IsMatch(ProjectName))
                {
                    ErrorMessagePromptName = rule.ErrorMessage;
                    verifyFlag             = false;
                }
            }
            else
            {
                ErrorMessagePromptName = "请输入工程名称";
                verifyFlag             = false;
            }
            if (string.IsNullOrEmpty(ImportedFilePath))
            {
                ErrorMessagePromptImportFilePath = "请选择有效导入文件路径";
                verifyFlag = false;
            }
            if (string.IsNullOrEmpty(SavedFilePath))
            {
                ErrorMessagePromptSaveFilePath = "请选择有效文件存储路径";
                verifyFlag = false;
            }
            if (verifyFlag)
            {
                IFileService         _fileService         = new FileService();
                ILogRecorder         _logRecorder         = null;
                string               strImportedFilePath  = this.ImportedFilePath;
                string               strExtentionName     = strImportedFilePath.Substring(strImportedFilePath.LastIndexOf(".") + 1);
                DBFileVersionManager dbFileVersionManager = new DBFileVersionManager(this.ImportedFilePath, _logRecorder, _fileService);
                //取得某一系列的数据文件操作服务(4,5,6 系列没有项目,7开始有项目信息,以文件扩展名作为划分依据)
                IDBFileVersionService dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByExtentionName(strExtentionName);
                //取得文件版本
                int fileVersion = dbFileVersionService.GetFileVersion();
                dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(fileVersion);
                //取得项目信息
                ProjectModel project = dbFileVersionService.GetProject(1);
                project.Name     = this.ProjectName;                                 //以当前设置的名称作为项目名
                project.SavePath = this.SavedFilePath + "\\" + project.Name + ".nt"; //以当前设置的路径作为项目的存储路径
                IControllerOperation controllerOperation = null;
                //取得项目下所有控制器信息
                List <ControllerModel> lstController = dbFileVersionService.GetControllersByProject(project);
                int             dataFileVersion      = 0;     //数据文件版本
                ControllerModel controller           = null;
                foreach (var controllerInfo in lstController) //取得控制器操作服务
                {
                    if (project.FileVersion == -1)            //4,5,6版本文件无项目信息
                    {
                        project.FileVersion = controllerInfo.FileVersion;
                    }
                    switch (controllerInfo.Type)
                    {
                    case ControllerType.FT8000:
                        controllerOperation = new ControllerOperation8000();
                        break;

                    case ControllerType.FT8003:
                        controllerOperation = new ControllerOperation8003();
                        break;

                    case ControllerType.NT8001:
                        controllerOperation = new ControllerOperation8001();
                        break;

                    case ControllerType.NT8007:
                        controllerOperation = new ControllerOperation8007();
                        break;

                    case ControllerType.NT8021:
                        controllerOperation = new ControllerOperation8021();
                        break;

                    case ControllerType.NT8036:
                        controllerOperation = new ControllerOperation8036();
                        break;
                    }
                    if (controllerOperation != null)                                                                                             //合法控制器类型
                    {
                        dataFileVersion      = Convert.ToInt32(project.FileVersion);                                                             //取得当前项目文件版本号
                        dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(dataFileVersion);                         //取得当前文件的数据文件服务
                        //controllerInfo = controllerOperation.OrganizeControllerInfoFromOldVersionSoftwareDataFile(oldVersionService);
                        controller = controllerOperation.OrganizeControllerInfoFromSpecifiedDBFileVersion(dbFileVersionService, controllerInfo); //取得组织完成的控制器信息
                    }
                    if (controller != null)                                                                                                      //将组织完成的信息增加至项目中
                    {
                        project.Controllers.Add(controllerInfo);
                    }
                }
                if (dataFileVersion != 0)//将所有数据转换为当前软件应用的数据版本
                {
                    project = dbFileVersionManager.VersionConverter(dataFileVersion, DBFileVersionManager.CurrentDBFileVersion, project);
                }
                SCA.BusinessLib.ProjectManager.GetInstance.CreateProject(project);
                EventMediator.NotifyColleagues("DisplayTheOpenedProject", null);
            }
        }
Ejemplo n.º 13
0
        //public static readonly RoutedEvent AllControllerInfoUploadedEvent = EventManager.RegisterRoutedEvent(
        //    "AllControllerInfoUploaded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(SummaryInfoView)
        //);


        //public event RoutedEventHandler AllControllerInfoUploaded
        //{
        //    add { AddHandler(AllControllerInfoUploadedEvent, value); }
        //    remove { RemoveHandler(AllControllerInfoUploadedEvent, value); }
        //}


        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            this.ErrorMessage.Text = "";
            // if (TheController != null)
            // {
            // ControllerModel controller=new ControllerModel();
            // //controller.ID = TheController.ID;

            // ControllerModel controller = ((SCA.WPF.ViewModelsRoot.ViewModels.Query.SummaryInfoViewModel)this.DataContext).TheController;
            // TheController.Name = ControllerNameInputTextBox.Text;
            // TheController.MachineNumber = MachineNumberInputTextBox.Text;

            // TheController.BaudRate = Convert.ToInt32(BaudsRateComboBox.SelectedItem);

            // TheController.PortName = ComPortComboBox.SelectedItem.ToString();
            SCA.WPF.ViewModelsRoot.ViewModels.Query.SummaryInfoViewModel vm = (SCA.WPF.ViewModelsRoot.ViewModels.Query.SummaryInfoViewModel) this.DataContext;
            ControllerModel controller = vm.TheController;

            IControllerConfig config = ControllerConfigManager.GetConfigObject(controller.Type);
            int maxMachineNumber     = config.GetMaxMachineAmountValue(controller.DeviceAddressLength);
            Dictionary <string, RuleAndErrorMessage> dictRule = config.GetControllerInfoRegularExpression(controller.DeviceAddressLength);

            RuleAndErrorMessage rule = dictRule["Name"];

            Regex  exminator    = new Regex(rule.Rule);
            string errorMessage = "";
            bool   verifyFlag   = true;

            if (!exminator.IsMatch(ControllerNameInputTextBox.Text))
            {
                errorMessage += "控制器名称:" + rule.ErrorMessage + "; ";
                //errorMessage += rule.ErrorMessage+";";
                verifyFlag = false;
            }
            rule      = dictRule["MachineNumber"];
            exminator = new Regex(rule.Rule);
            if (!exminator.IsMatch(MachineNumberInputTextBox.Text))
            {
                //errorMessage += rule.ErrorMessage+";";
                errorMessage += "控制器机号:" + rule.ErrorMessage + "; ";
                verifyFlag    = false;
            }

            if (verifyFlag)
            {
                if (Convert.ToInt16(MachineNumberInputTextBox.Text) > maxMachineNumber)
                {
                    errorMessage += "控制器机号:机号超出范围,最大机号为" + maxMachineNumber.ToString() + "; ";
                    //errorMessage += "机号超出范围,最大机号为" + maxMachineNumber.ToString();
                    verifyFlag = false;
                }
            }
            if (verifyFlag)
            {
                controller.Name          = ControllerNameInputTextBox.Text;
                controller.MachineNumber = MachineNumberInputTextBox.Text;

                controller.PortName = ComPortComboBox.SelectedItem.ToString();
                controller.BaudRate = Convert.ToInt32(BaudsRateComboBox.SelectedItem);
                vm.SaveExecute(controller);
                controller.IsDirty = true;

                EventMediator.NotifyColleagues("RefreshNavigator", controller);
                RaiseEvent(new RoutedEventArgs(AddButtonClickEvent, controller));
            }
            else
            {
                this.ErrorMessage.Text       = errorMessage;
                this.ErrorMessage.Visibility = Visibility.Visible;
            }
            // }
        }
Ejemplo n.º 14
0
 public void CloseExecute()
 {
     EventMediator.NotifyColleagues("ManualControlBoardAddMoreLines", null);
 }
Ejemplo n.º 15
0
 public void CloseExecute()
 {
     ClearAllErrorMessage();
     EventMediator.NotifyColleagues("ShowDetailPane", null);
 }
        public void ImportExecute()
        {
            //得到需要导入的控制器的信息
            ControllerModel controller = ProjectManager.GetInstance.TheControllerViaImporting;

            ControllerOperationCommon    controllerBase         = new ControllerOperationCommon();
            LinkageConfigStandardService standardLinkageService = new LinkageConfigStandardService(TheController);
            LinkageConfigMixedService    mixedLinkageService    = new LinkageConfigMixedService(TheController);
            LinkageConfigGeneralService  gerneralLinkageService = new LinkageConfigGeneralService(TheController);
            int maxLoopID = controllerBase.GetMaxLoopID();
            List <CheckItem> selectedLoops = LoopNameCollection.Where((d) => d.IsChecked == true).ToList <CheckItem>();

            //比对回路信息是否已经存在:提示,是否覆盖
            foreach (var loop in controller.Loops)
            {
                int selectedLoopCount = selectedLoops.Count((d) => d.Value == loop.Code);
                if (selectedLoopCount <= 0) //未勾选的回路,放弃导入
                {
                    continue;
                }
                LoopModel existLoop = TheController.Loops.Where((d) => d.Code == loop.Code).FirstOrDefault();
                int       amount    = TheController.Loops.Count((d) => d.Code == loop.Code);
                if (amount > 0)
                {
                    string strPromptInfo = "控制器" + TheController.Name + ":已经存在" + loop.Code + ",覆盖吗?";
                    if (MessageBox.Show(strPromptInfo, "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        TheController.Loops.RemoveAll((d) => d.Code == loop.Code);
                        loop.Controller   = TheController;
                        loop.ControllerID = TheController.ID;
                        loop.ID           = existLoop.ID;
                        TheController.Loops.Add(loop);
                    }
                }
                else
                {
                    maxLoopID++;
                    loop.Controller   = TheController;
                    loop.ControllerID = TheController.ID;
                    loop.ID           = maxLoopID;
                    TheController.Loops.Add(loop);
                }
            }

            List <CheckItem> lstOtherSetting = OtherSettingsCollection.Where((d) => d.IsChecked == true).ToList <CheckItem>();
            int selectedStandardCount        = lstOtherSetting.Count((d) => d.Value == "标准组态");

            int maxStandardLinkageConfigID = standardLinkageService.GetMaxID();

            if (selectedStandardCount > 0) //未勾选,放弃导入
            {
                //比对组态信息,按编号比对
                foreach (var importConfig in controller.StandardConfig)
                {
                    LinkageConfigStandard existConfig = TheController.StandardConfig.Where((d) => d.Code == importConfig.Code).FirstOrDefault();
                    int amount = TheController.StandardConfig.Count((d) => d.Code == importConfig.Code);
                    if (amount > 0)
                    {
                        string strPromptInfo = "控制器" + TheController.Name + ":已经存在标准组态" + importConfig.Code + ",覆盖吗?";
                        if (MessageBox.Show(strPromptInfo, "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            TheController.StandardConfig.RemoveAll((d) => d.Code == importConfig.Code);
                            importConfig.Controller   = TheController;
                            importConfig.ControllerID = TheController.ID;
                            importConfig.ID           = existConfig.ID;
                            TheController.StandardConfig.Add(importConfig);
                        }
                    }
                    else
                    {
                        maxStandardLinkageConfigID++;
                        importConfig.Controller   = TheController;
                        importConfig.ControllerID = TheController.ID;
                        importConfig.ID           = maxStandardLinkageConfigID;
                        TheController.StandardConfig.Add(importConfig);
                    }
                }
            }
            int selectedMixedCount = lstOtherSetting.Count((d) => d.Value == "混合组态");

            if (selectedMixedCount > 0) //未勾选,放弃导入
            {
                //比对组态信息,按编号比对
                foreach (var importConfig in controller.MixedConfig)
                {
                    int amount = TheController.MixedConfig.Count((d) => d.Code == importConfig.Code);
                    if (amount > 0)
                    {
                        string strPromptInfo = "控制器" + TheController.Name + ":已经存在混合组态" + importConfig.Code + ",覆盖吗?";
                        if (MessageBox.Show(strPromptInfo, "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            TheController.MixedConfig.RemoveAll((d) => d.Code == importConfig.Code);
                            TheController.MixedConfig.Add(importConfig);
                        }
                    }
                    else
                    {
                        TheController.MixedConfig.Add(importConfig);
                    }
                }
            }

            int selectedGeneralCount = lstOtherSetting.Count((d) => d.Value == "通用组态");

            if (selectedGeneralCount > 0) //未勾选,放弃导入
            {
                //比对组态信息,按编号比对
                foreach (var importConfig in controller.GeneralConfig)
                {
                    int amount = TheController.GeneralConfig.Count((d) => d.Code == importConfig.Code);
                    if (amount > 0)
                    {
                        string strPromptInfo = "控制器" + TheController.Name + ":已经存在通用组态" + importConfig.Code + ",覆盖吗?";
                        if (MessageBox.Show(strPromptInfo, "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            TheController.GeneralConfig.RemoveAll((d) => d.Code == importConfig.Code);
                            TheController.GeneralConfig.Add(importConfig);
                        }
                    }
                    else
                    {
                        TheController.GeneralConfig.Add(importConfig);
                    }
                }
            }

            int selectedMCBCount = lstOtherSetting.Count((d) => d.Value == "网络手动盘");

            if (selectedMCBCount > 0) //未勾选,放弃导入            {
            {
                foreach (var importConfig in controller.ControlBoard)
                {
                    int amount = TheController.ControlBoard.Count((d) => d.Code == importConfig.Code);
                    if (amount > 0)
                    {
                        string strPromptInfo = "控制器" + TheController.Name + ":已经存在网络手动盘" + importConfig.Code + ",覆盖吗?";
                        if (MessageBox.Show(strPromptInfo, "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            TheController.ControlBoard.RemoveAll((d) => d.Code == importConfig.Code);
                            TheController.ControlBoard.Add(importConfig);
                        }
                    }
                    else
                    {
                        TheController.ControlBoard.Add(importConfig);
                    }
                }
            }

            CloseExecute();
            ProjectManager.GetInstance.TheControllerViaImporting = null;
            //导入完成,导入信息清除
            EventMediator.NotifyColleagues("RefreshNavigator", TheController);
        }
 public void CloseExecute()
 {
     SelfVisibility = Visibility.Collapsed;
     EventMediator.NotifyColleagues("ImportControllerViewClose", null);
     // CloseEvent();
 }
Ejemplo n.º 18
0
 //上传当前控制器下的所有信息
 public void UploadExecute()
 {
     //if(this.TheController.Type == ControllerType.NT8053)
     {
         ControllerModel model = ProjectManager.GetInstance.NTConnection.GetMachineSetup(this.TheController.Type);
         if (model != null)
         {
             TheController.StandardConfig.Clear();
             foreach (var config in model.StandardConfig)
             {
                 config.Controller = TheController;
                 this.TheController.StandardConfig.Add(config);
             }
             TheController.MixedConfig.Clear();
             foreach (var config in model.MixedConfig)
             {
                 config.Controller = TheController;
                 this.TheController.MixedConfig.Add(config);
             }
             TheController.GeneralConfig.Clear();
             foreach (var config in model.GeneralConfig)
             {
                 config.Controller = TheController;
                 this.TheController.GeneralConfig.Add(config);
             }
             TheController.ControlBoard.Clear();
             foreach (var config in model.ControlBoard)
             {
                 config.Controller = TheController;
                 this.TheController.ControlBoard.Add(config);
             }
             TheController.Loops.Clear();
             foreach (var loop in model.Loops)
             {
                 loop.Controller = TheController;
                 this.TheController.Loops.Add(loop);
             }
         }
         EventMediator.NotifyColleagues("UploadedFinished", TheController);
     }
     //else
     //{
     //    InvokeControllerCom iCC = InvokeControllerCom.Instance;
     //    if (iCC.GetPortStatus())
     //    {
     //        if (iCC.TheControllerType.GetType().ToString() != "SCA.BusinessLib.Controller.ControllerTypeUnknown")
     //        {
     //            if (iCC.TheControllerType != null && iCC.TheControllerType.ControllerType != ControllerType.NONE) //如果已经取得当前的控制器类型
     //            {
     //                #region 8036
     //                if (iCC.TheControllerType.ControllerType == ControllerType.NT8036) //如果控制器类型不相符,则不执行操作
     //                {
     //                    List<DeviceInfo8036> lstDevicesInfo = new List<DeviceInfo8036>();
     //                    List<LinkageConfigStandard> lstStandardLinkageConfig = new List<LinkageConfigStandard>();
     //                    ((ControllerType8036)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo;
     //                    ((ControllerType8036)iCC.TheControllerType).StandardLinkageConfigList = lstStandardLinkageConfig;
     //                    iCC.TheController = TheController;
     //                    iCC.TheControllerType.Status = ControllerStatus.DataReceiving;
     //                    iCC.AllDataUploadedEvent += UploadedFinished;
     //                }
     //                #endregion
     //                #region 8007
     //                if (iCC.TheControllerType.ControllerType == ControllerType.NT8007) //如果控制器类型不相符,则不执行操作
     //                {
     //                    List<DeviceInfo8007> lstDevicesInfo = new List<DeviceInfo8007>();
     //                    List<LinkageConfigStandard> lstStandardLinkageConfig = new List<LinkageConfigStandard>();
     //                    ((ControllerType8007)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo;
     //                    ((ControllerType8007)iCC.TheControllerType).StandardLinkageConfigList = lstStandardLinkageConfig;
     //                    iCC.TheController = TheController;
     //                    iCC.TheControllerType.Status = ControllerStatus.DataReceiving;
     //                    iCC.AllDataUploadedEvent += UploadedFinished;
     //                    iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus;
     //                }
     //                #endregion
     //                #region 8003
     //                if (iCC.TheControllerType.ControllerType == ControllerType.FT8003) //如果控制器类型不相符,则不执行操作
     //                {
     //                    List<DeviceInfo8003> lstDevicesInfo = new List<DeviceInfo8003>();
     //                    List<LinkageConfigStandard> lstStandardLinkageConfig = new List<LinkageConfigStandard>();
     //                    ((ControllerType8003)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo;
     //                    ((ControllerType8003)iCC.TheControllerType).StandardLinkageConfigList = lstStandardLinkageConfig;
     //                    iCC.TheController = TheController;
     //                    iCC.TheControllerType.Status = ControllerStatus.DataReceiving;
     //                    iCC.AllDataUploadedEvent += UploadedFinished;
     //                    iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus;
     //                }
     //                #endregion
     //                #region 8000
     //                if (iCC.TheControllerType.ControllerType == ControllerType.FT8000) //如果控制器类型不相符,则不执行操作
     //                {
     //                    List<DeviceInfo8000> lstDevicesInfo = new List<DeviceInfo8000>();
     //                    List<LinkageConfigStandard> lstStandardLinkageConfig = new List<LinkageConfigStandard>();
     //                    ((ControllerType8000)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo;
     //                    ((ControllerType8000)iCC.TheControllerType).StandardLinkageConfigList = lstStandardLinkageConfig;
     //                    iCC.TheController = TheController;
     //                    iCC.TheControllerType.Status = ControllerStatus.DataReceiving;
     //                    iCC.AllDataUploadedEvent += UploadedFinished;
     //                    iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus;
     //                }
     //                #endregion
     //                #region 8021
     //                if (iCC.TheControllerType.ControllerType == ControllerType.NT8021) //如果控制器类型不相符,则不执行操作
     //                {
     //                    List<DeviceInfo8021> lstDevicesInfo = new List<DeviceInfo8021>();
     //                    ((ControllerType8021)iCC.TheControllerType).DeviceInfoList = lstDevicesInfo;
     //                    iCC.TheController = TheController;
     //                    iCC.TheControllerType.Status = ControllerStatus.DataReceiving;
     //                    iCC.AllDataUploadedEvent += UploadedFinished;
     //                    iCC.TheControllerType.UpdateProgressBarEvent += UpdateProcessBarStatus;
     //                }
     //                #endregion
     //            }
     //        }
     //    }
     //}
 }