Revit.SDK.Samples.TypeRegeneration.CS.MessageForm.AddMessage C# (CSharp) 메소드

AddMessage() 공개 메소드

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
리턴 void
        public void AddMessage(string message,bool enableTimer)
        {
            messageRichTextBox.AppendText(message);
            timer.Enabled = enableTimer;
        }

Usage Example

예제 #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();
            }
        }
All Usage Examples Of Revit.SDK.Samples.TypeRegeneration.CS.MessageForm::AddMessage