AddMessage() public method

add text to the richtextbox and set time enable is true, then timer starts timing
public AddMessage ( string message, bool enableTimer ) : void
message string message from the regeneration
enableTimer bool enable or disable the timer elapsed event
return void
コード例 #1
0
        /// <summary>
        ///  After setting CurrentType property, the CurrentType has changed to the new one,the Revit model will change along with the current type
        /// </summary>
        /// <param name="msgForm">the form is used to show the regeneration result</param>
        public void CheckTypeRegeneration(MessageForm msgForm)
        {
            //the list to record the error messages
            List <string> errorInfo = new List <string>();

            try
            {
                foreach (FamilyType type in m_familyManager.Types)
                {
                    if (!(type.Name.ToString().Trim() == ""))
                    {
                        try
                        {
                            m_familyManager.CurrentType = type;
                            msgForm.AddMessage(type.Name + " Successful\n", true);
                            WriteLog(type.Name + "      Successful");
                        }
                        catch
                        {
                            errorInfo.Add(type.Name);
                            msgForm.AddMessage(type.Name + " Failed \n", true);
                            WriteLog(type.Name + "      Failed");
                        }
                        msgForm.ShowDialog();
                    }
                }

                //add a conclusion regeneration result
                string resMsg;
                if (errorInfo.Count > 0)
                {
                    resMsg = "\nResult: " + errorInfo.Count + " family types regeneration failed!";
                    foreach (string error in errorInfo)
                    {
                        resMsg += "\n " + error;
                    }
                }
                else
                {
                    resMsg = "\nResult: All types in the family can regenerate successfully.";
                }
                WriteLog(resMsg.ToString());
                resMsg += "\nIf you want to know the detail regeneration result please get log file at " + m_logFileName;
                msgForm.AddMessage(resMsg, false);
                msgForm.ShowDialog();
            }
            catch (Exception ex)
            {
                WriteLog("There is some problem when regeneration:" + ex.ToString());
                msgForm.AddMessage("There is some problem when regeneration:" + ex.ToString(), true);
                msgForm.ShowDialog();
            }
        }
コード例 #2
0
ファイル: Command.cs プロジェクト: AMEE/revit
        /// <summary>
        ///  After setting CurrentType property, the CurrentType has changed to the new one,the Revit model will change along with the current type
        /// </summary>
        /// <param name="msgForm">the form is used to show the regeneration result</param>        
        public void CheckTypeRegeneration(MessageForm msgForm)
        {
            //the list to record the error messages
            List<string> errorInfo = new List<string>();
            try
            {
                foreach (FamilyType type in m_familyManager.Types)
                {
                    if (!(type.Name.ToString().Trim()==""))
                    {
                        try
                        {
                            m_familyManager.CurrentType = type;
                            msgForm.AddMessage(type.Name+" Successful\n",true);
                            WriteLog(type.Name + "      Successful");
                        }
                        catch
                        {
                            errorInfo.Add(type.Name);
                            msgForm.AddMessage(type.Name+" Failed \n",true);
                            WriteLog(type.Name + "      Failed");
                        }
                        msgForm.ShowDialog();
                    }
                }

                //add a conclusion regeneration result
                string resMsg;
                if (errorInfo.Count > 0)
                {
                    resMsg = "\nResult: " + errorInfo.Count + " family types regeneration failed!";
                    foreach (string error in errorInfo)
                    {
                        resMsg += "\n " + error;
                    }
                }
                else
                {
                    resMsg = "\nResult: All types in the family can regenerate successfully.";
                }
                WriteLog(resMsg.ToString());
                resMsg += "\nIf you want to know the detail regeneration result please get log file at "+m_logFileName;
                msgForm.AddMessage(resMsg,false);
                msgForm.ShowDialog();
            }
            catch(Exception ex)
            {
                WriteLog("There is some problem when regeneration:" + ex.ToString());
                msgForm.AddMessage("There is some problem when regeneration:"+ex.ToString(),true);
                msgForm.ShowDialog();
            }
        }