Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmConfig(AppDirs appDirs, int deviceNum)
     : this()
 {
     this.appDirs   = appDirs ?? throw new ArgumentNullException(nameof(appDirs));
     this.deviceNum = deviceNum;
     config         = new EmailDeviceConfig();
     configFileName = Path.Combine(appDirs.ConfigDir, EmailDeviceConfig.GetFileName(deviceNum));
     prevUsername   = "";
 }
Exemple #2
0
        private bool loggingFlag;                  // indicates that a ready message should be logged


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DevEmailLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
            : base(commContext, lineContext, deviceConfig)
        {
            CanSendCommands    = true;
            ConnectionRequired = false;

            config      = new EmailDeviceConfig();
            smtpClient  = new SmtpClient();
            addressBook = null;
            isReady     = false;
            loggingFlag = false;
        }
Exemple #3
0
        /// <summary>
        /// Performs actions when starting a communication line.
        /// </summary>
        public override void OnCommLineStart()
        {
            isReady     = false;
            loggingFlag = false;

            if (config.Load(Storage, EmailDeviceConfig.GetFileName(DeviceNum), out string errMsg))
            {
                InitSnmpClient();
                addressBook = AddressBookUtils.GetOrLoad(LineContext.SharedData, Storage, Log);
                isReady     = true;
                loggingFlag = true;
            }
            else
            {
                Log.WriteLine(errMsg);
            }
        }