private UserControl CreateView(string className, string title) { UserControl view = null; try { view = Container.ResolveNamed <IDependency>(className) as UserControl; if (view == null) { Logger.Warn($"【{title}】初始化失败"); MessageWin.Warn($"【{title}】初始化失败"); return(null); } view.Unloaded += ChildView_Unloaded; } catch (Exception ex) { Logger.Error($"【{title}】初始化错误", ex); MessageWin.Error($"【{title}】初始化错误"); return(null); } return(view); }
public static void MessageWarn(string msg, string title = "警告") { DispatcherInvoke(() => { MessageWin.Warn(msg, title); }); }