Ejemplo n.º 1
0
        /// <summary>
        /// Sets the default polling options of the added device.
        /// </summary>
        private void SetPollingOptions()
        {
            if (!string.IsNullOrEmpty(DeviceConfig.Driver))
            {
                if (ExtensionUtils.GetDriverView(adminContext, Instance.CommApp, DeviceConfig.Driver,
                                                 out DriverView driverView, out string message))
                {
                    if (driverView.CanCreateDevice)
                    {
                        DeviceView     deviceView     = driverView.CreateDeviceView(LineConfig, DeviceConfig);
                        PollingOptions pollingOptions = deviceView?.GetPollingOptions();

                        if (pollingOptions != null)
                        {
                            pollingOptions.CopyTo(DeviceConfig.PollingOptions);
                        }
                    }
                }
                else
                {
                    ScadaUiUtils.ShowError(message);
                }
            }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the default polling options for the specified device.
        /// </summary>
        private void SetPollingOptions(DeviceConfig deviceConfig)
        {
            if (!string.IsNullOrEmpty(deviceConfig.Driver))
            {
                if (ExtensionUtils.GetDriverView(adminContext, commApp, deviceConfig.Driver,
                                                 out DriverView driverView, out string message))
                {
                    if (driverView.CanCreateDevice)
                    {
                        DeviceView     deviceView     = driverView.CreateDeviceView(deviceConfig.ParentLine, deviceConfig);
                        PollingOptions pollingOptions = deviceView?.GetPollingOptions();

                        if (pollingOptions != null)
                        {
                            pollingOptions.CopyTo(deviceConfig.PollingOptions);
                        }
                    }
                }
                else
                {
                    lastErrorMessage = message;
                }
            }