/// <summary>
 /// Get customized handler error message from specified text document and use to overwrite
 /// default handler error message to user defined handler error message.
 /// </summary>
 private static void GetCustomizedHandlerErrorMessage()
 {
     if (File.Exists(CustomizedHandlerErrorMessageSource))
     {
         try
         {
             using (StreamReader sr = new StreamReader(CustomizedHandlerErrorMessageSource))
             {
                 while (!sr.EndOfStream)
                 {
                     string str = sr.ReadLine();
                     if (str.StartsWith("//") == false && str != "" && str.Contains(":") && str.Contains("-"))
                     {
                         string code   = str.Remove(str.IndexOf(":"));
                         string errMes = str.Replace(code + ":", "").Trim();
                         if (_customizedHandlerErrMsgList.ContainsKey(code) == false)
                         {
                             _customizedHandlerErrMsgList.Add(code, errMes);
                         }
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             ParselMessageBox.Show("Failed to load customized handler error message from file "
                                   + CustomizedHandlerErrorMessageSource + "\r\n" +
                                   ". Please ensure contents of the file is in correct format.",
                                   ex, MessageBoxIcon.Error, ErrorButton.NoButton, ErrorButton.NoButton, ErrorButton.OK);
         }
     }
 }
Esempio n. 2
0
 private void buttonReset_Click(object sender, EventArgs e)
 {
     if (ParselMessageBox.Show("Counter", "Do you want to reset the counter?", MessageBoxIcon.Question, ErrorButton.NoButton, ErrorButton.Yes, ErrorButton.No) == ErrorButton.Yes)
     {
         HSTMachine.Workcell.HSTSettings.getConfigPerformance().StopTracking();
         HSTMachine.Workcell.HSTSettings.getConfigPerformance().StartTracking();
     }
 }
Esempio n. 3
0
 void _powerDownTimerTick_Elapsed(object sender, ElapsedEventArgs e)
 {
     _powerDownTimerTick.Enabled = false;
     try
     {
         int logCode = (int)LoggerCategory.PowerDownTime;
         using (StreamWriter writer = new StreamWriter(_powerDownTimeLogFile, false))
         {
             writer.WriteLine(logCode.ToString() + "," + DateTime.Now);
         }
     }
     catch (Exception ex)
     {
         ParselMessageBox.Show("Error occurred when trying to write " + _powerDownTimeLogFile, ex, MessageBoxIcon.Error,
                               ErrorButton.NoButton, ErrorButton.NoButton, ErrorButton.OK);
     }
     _powerDownTimerTick.Enabled = true;
 }
        /// <summary>
        /// Show chm help file and directly goto specific topic according to specified error code
        /// in brief format. Error code in brief format means error code without device error code,
        /// for example: D002-B012-001 becomes D002-B012.
        /// </summary>
        /// <param name="helpFilePath"></param>
        /// <param name="errorCodeBrief"></param>
        public static void ShowErrorMessageHelp(string helpFilePath, string errorCodeBrief)
        {
            if (File.Exists(helpFilePath) == false)
            {
                ParselMessageBox.Show("CHM help file does not exist.", helpFilePath, MessageBoxIcon.Error, ErrorButton.NoButton, ErrorButton.NoButton, ErrorButton.OK);
                return;
            }
            int indexID = 0;

            if (_helpLinkList.ContainsKey(errorCodeBrief))
            {
                indexID = _helpLinkList[errorCodeBrief]; // look for topic id in the collection with respect to supplied brief error code.
                Help.ShowHelp(null, helpFilePath, HelpNavigator.TopicId, indexID.ToString());
            }
            else
            {
                Help.ShowHelp(null, helpFilePath);
            }
        }