using PdmSwPlugin.Common.Interface; using SolidWorks.Interop.sldworks; using SolidWorks.Interop.swconst; using System.Windows; namespace PdmSwPlugin.Common.Util { public static class MsgBoxHelper { public static void Show(this ISwAppSetter control, string msg) { SldWorks SwApp = control.SwApp; if (SwApp != null) { SwApp.SendMsgToUser(msg); } else { MessageBox.Show(msg, "提示"); } } public static void Info(this ISwAppSetter control, string msg) { SldWorks SwApp = control.SwApp; if (SwApp != null) { SwApp.SendMsgToUser2(msg, (int)swMessageBoxIcon_e.swMbInformation, (int)swMessageBoxBtn_e.swMbOk); } else { MessageBox.Show(msg, "提示"); } } public static void Warning(this ISwAppSetter control, string msg) { SldWorks SwApp = control.SwApp; if (SwApp != null) { SwApp.SendMsgToUser2(msg, (int)swMessageBoxIcon_e.swMbWarning, (int)swMessageBoxBtn_e.swMbOk); } else { MessageBox.Show(msg, "警告"); } } public static void Error(this ISwAppSetter control, string msg) { ISldWorks SwApp = control.SwApp; if (SwApp != null) { SwApp.SendMsgToUser2(msg, (int)swMessageBoxIcon_e.swMbStop, (int)swMessageBoxBtn_e.swMbOk); } else { MessageBox.Show(msg, "错误"); } } public static void Show(this ISwAppSetter control, string msg, bool sync) { if (sync) { Show(control, msg); } else { MessageBox.Show(msg, "提示"); } } } }