Ejemplo n.º 1
0
        private void SetHeadingProperties()
        {
            if (SelectedShortPLCconnection != null)
            {
                int manufacturer = SelectedShortPLCconnection.CPUmanufacturer;
                if (manufacturer == 1)
                {
                    S7PlcConnectionDefinition definition = _originalListOfS7connections.Single(x => x.PLCconnectionID == SelectedShortPLCconnection.PLCconnectionID);
                    CurrentConnectionIP = $"{definition.FirstOctet}.{definition.SecondOctet}.{definition.ThirdOctet}.{definition.FourthOctet}";
                    ConnectionActivated = definition.ConnectionActivated;
                    S7CpuTypeConverter converter = new S7CpuTypeConverter();
                    CpuType = converter.GetS7TypeEnum(definition.CPUtype).ToString();

                    GetAlarmsForS7Connection(definition.PLCconnectionID);
                }

                MultipleAlarmsDeletionButtonEnabled = _canModifyAlarm;
                AddingNewAlarmsEnabled = _canModifyAlarm;
                EnableFiltering        = true;
            }
            else
            {
                CurrentConnectionIP = "_._._._";
                ConnectionActivated = false;
                CpuType             = "-----";

                AddingNewAlarmsEnabled = false;
                MultipleAlarmsDeletionButtonEnabled = false;
                EnableFiltering = false;

                AlarmsForSelectedS7Connection.Clear();
            }
        }
Ejemplo n.º 2
0
        public void ModifyS7AlarmAndTexts(int identity)
        {
            if (!_multipleDeletionEnabled && CheckModifyingOrAddingNewAlarmsConditions())
            {
                AlarmS7UImodel model = AlarmsForSelectedS7Connection.Where(x => x.Identity == identity).First();

                DefaultS7AlarmHendlerViewModel ds7ahvm = new DefaultS7AlarmHendlerViewModel(SelectedShortPLCconnection, true, model, _realmProvider, _runtimeData);
                _manager.ShowDialog(ds7ahvm);
                GetAlarmsForS7Connection(SelectedShortPLCconnection.PLCconnectionID);
            }
        }
Ejemplo n.º 3
0
        //method for reseting filters
        public void ResetFilters()
        {
            //reset filters
            AssignAlarmListStartupFilters();

            // clear current list
            AlarmsForSelectedS7Connection.Clear();

            //add all alarms to the list view control
            foreach (var item in _originalS7AlarmWithTexts)
            {
                AlarmsForSelectedS7Connection.Add(item);
            }
        }
Ejemplo n.º 4
0
        private void GetAlarmsForS7Connection(int connnectionID)
        {
            _logger.Info($"Algorithm of rreading all alarms for St connection with PLC connection ID: {connnectionID}, started.");

            //read values with texts
            AlarmS7Reader reader = new AlarmS7Reader(_realmProvider);

            _originalS7AlarmWithTexts = reader.GetAllAlarmsOffS7plcConnectionWithTexts(connnectionID);

            //assign names of alarm urgency profiles and sms recipients groups
            AssignSMSgroupAndAlarmProfile(ref _originalS7AlarmWithTexts);

            //clear current list
            AlarmsForSelectedS7Connection.Clear();

            //add all alarms to the list view control
            ApplyFIlters();

            //modify amount of alarms
            AlarmsAmount = _originalS7AlarmWithTexts.Count();
        }
Ejemplo n.º 5
0
        //apply filters when creating list of alarms
        public void ApplyFIlters()
        {
            //clear current list
            AlarmsForSelectedS7Connection.Clear();

            //add all alarms to the list view control
            foreach (var item in _originalS7AlarmWithTexts)
            {
                try
                {
                    if (item.AlarmTagName.Contains(_almTagNameFilter) && item.AckTagName.Contains(_ackTagNameFilter) && item.AlarmProfileName.Contains(_alarmProfileFIlter) &&
                        item.SMSrecipientsGroupName.Contains(_smsGroupFilter) && item.AlarmTagString.Contains(_almAddressFilter))
                    {
                        AlarmsForSelectedS7Connection.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    _logger.Error($"Error while filtering alarms. Exception: {ex.Message}. Item: {item.ToString()}.");
                }
            }
        }