예제 #1
0
        /// <summary>
        /// Keep track if we have sent an error popup notification, if so use this value to supress future popups, under the assumption that the first one is the most important and probably the originator of the future popups.
        /// </summary>
        public MainForm()
        {
            // Machine number
            m_strMachineNumber = System.Configuration.ConfigurationManager.AppSettings["machineNumber"];

            //Setup the Logging system
            m_logAndErr = new LogAndErrorsUtils(AutoDialIcon, ToolTipIcon.Error);
            m_imgManUtils = new ImageManipulationUtils(m_logAndErr);
            m_logger = m_logAndErr.getLogger();

            // Give the admins a chance to change the path of tessdata
            string TESSERACT_DATA_PATH = System.Configuration.ConfigurationManager.AppSettings["tessdataPath"];
            if (TESSERACT_DATA_PATH == null)
            {

                TESSERACT_DATA_PATH = @"C:\\Autodial\\Dialing\\tessdata";
                m_logger.Error("No Config Tesseract path. Setting to: {0}", TESSERACT_DATA_PATH);
            }

            // Initilialise event for timer tick
            m_timer.Tick += new EventHandler(timerTick);

            //Initialise the Form
            InitializeComponent();

            m_logger.Info("###################################################################");
            m_logger.Info("Starting Program");

            // Checking for tesseract data path
            if (!System.IO.Directory.Exists(TESSERACT_DATA_PATH))
            {
                string strError = "Couldn't find tesseract in " + TESSERACT_DATA_PATH;
                m_logger.Error(strError);
                m_logger.Info(MailUtils.MailUtils.sendit("*****@*****.**", m_strMachineNumber, strError, m_strDailyLogFilename));
            }

            // Set the Talk Log Monitor Util
            Regex regEx = new Regex("answered|disconnected");
            string strTalkLogPath = System.Configuration.ConfigurationManager.AppSettings["talkLogPath"];
            m_logger.Info("Talk Log path: " + strTalkLogPath);
            string strLogFilePath = TalkLogMonitorUtil.getTalkLogFileNameFromTalkLogDirectory(DateTime.Today, strTalkLogPath);
            m_logger.Info("Talk File Log path: " + strLogFilePath);
            m_talkLogMonitor = new TalkLogMonitorUtil(strLogFilePath, stopAlertTimer, regEx);

            string strYear = DateTime.Today.Year.ToString();
            string strMonth = (DateTime.Today.Month < 10) ? ("0" + DateTime.Today.Month.ToString()) : DateTime.Today.Month.ToString();
            string strDay = (DateTime.Today.Day < 10) ? ("0" + DateTime.Today.Day.ToString()) : DateTime.Today.Day.ToString();

            m_strDailyLogFilename = @"C:\AutoDial\Log\AutoDial_" +
                                    strYear + "-" +
                                    strMonth + "-" +
                                    strDay + "_trace.log"; // AutoDial_2015-10-28_trace.log

            registerHotkey();
            customHide();
        }
예제 #2
0
 public GeneralUtils(LogAndErrorsUtils logAndErr)
 {
     m_logAndErr = logAndErr;
     m_logger = logAndErr.getLogger();
 }
 public ImageManipulationUtils(LogAndErrorsUtils logAndErrors, bool m_bSaveImage = true)
 {
     m_logger = logAndErrors.getLogger();
     m_genUtils = new GeneralUtils(logAndErrors);
 }