Exemple #1
0
        private void OpenControlSystemTab(QuickControlSystem controlSystem)
        {
            if (controlSystem == null)
                return;

            //Check whether we already have this open
            bool tabAlreadyOpen = false;
            foreach (RadTabItem tabItem in MainTabControl.Items)
            {
                var panel = tabItem.Content as ControlSystemView;

                if (panel != null && panel.ControlSystem!=null)
                {
                    if (panel.ControlSystem.Id == controlSystem.Id)
                    {
                        //already open so select it
                        tabItem.IsSelected = true;
                        tabAlreadyOpen = true;
                        break;
                    }
                }
            }

            if (tabAlreadyOpen == false)
            {
                var ti = new RadTabItem();
                var th = new TabHeader(ti, this);

                if (string.IsNullOrEmpty(controlSystem.Name))
                {
                    th.headerLabel.Content = String.Format("ControlSystem : {0}", controlSystem.Id);
                }
                else
                {
                    th.headerLabel.Content = String.Format("ControlSystem : {0}", controlSystem.Name);
                }

                ti.Header = th;
                ti.IsSelected = true;
                ti.DropDownContent = th.headerLabel.Content.ToString();
                ti.Content = new ControlSystemView(controlSystem.Id);
                MainTabControl.Items.Add(ti);

                if (CMS.EffectivePrivileges.ControlTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify)
                {
                    BuildTabLockEventHandler(th.headerLabel.Content.ToString());
                }
            }
        }
 private void ReinstateControlSystem(QuickControlSystem quickControlSystem)
 {
     CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
     cmsWebServiceClient.SaveIsActiveEquipmentStateCompleted += (s, e) =>
     {
         quickControlSystem.IsActive = true;
         EventAggregator.GetEvent<PrismEvents.CloseTabPrismEvent>().Publish(quickControlSystem);
     };
     cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.Control, quickControlSystem.Id, true, CMS.User.Id);
 }
        public void OpenEquipmentHandler(object parameter)
        {
            CommonDocumentEquipmentModel model = parameter as CommonDocumentEquipmentModel;
            if (model != null)
            {
                //Opens OpenTab in MainPage.xaml.cs

                object publish = null;

                if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.ELECT.ToString())
                {
                    publish = new QuickElectrical { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive};
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.MECH.ToString())
                {
                    publish = new QuickMechanical { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive };
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.MOB.ToString())
                {
                    publish = new QuickMobilePlant { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive };
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.INSTR.ToString())
                {
                    publish = new QuickInstrument { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive };
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.PIPE.ToString())
                {
                    publish = new QuickPipe { Id = model.EquipmentId, Name = model.Name, IsActive = model.IsActive };
                }
                else if (model.EquipmentType.Code == CommonUtils.EquipmentTypeCode.CONTR.ToString())
                {
                    publish = new QuickControlSystem() { Id = model.EquipmentId, Name = model.Name };
                }

                if (publish != null)
                {
                    EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(publish);
                }
            }
        }
 private void OpenTab(QuickControlSystem controlSystem)
 {
     EventAggregator.GetEvent<PrismEvents.OpenTabPrismEvent>().Publish(controlSystem);
 }
 public CommonDocumentEquipmentModel(QuickControlSystem quickObject, EquipmentType equipmentType, int documentId = 0)
 {
     EquipmentId = quickObject.Id;
     DocumentId = documentId;
     Name = quickObject.Name;
     Description = quickObject.Description;
     EquipmentType = equipmentType;
     //EquipmentSubTypeId = quickObject.ControlSystemTypeId;
     IsActive = quickObject.IsActive;
     //MaintSystemId = quickObject.MaintSystemId;
 }