public Task InitializeComponent() { return(Task.Factory.StartNew(() => { try { ScanPluginFromAssembly(); } catch (Exception ex) { _log.Error($"初始化插件:{ex}"); } })); }
protected override void Onload() { try { if (!Directory.Exists(BaseDirectory)) { return; } var assemblies = new List <Assembly>(); var files = Directory.GetFiles(BaseDirectory, "*.dll", SearchOption.AllDirectories).Where(o => o.Contains("Protocal")); var moduleAssemblies = files.Select(Assembly.LoadFile); assemblies.AddRange(moduleAssemblies); _container.AutoRegister(assemblies, DuplicateImplementationActions.RegisterMultiple); _mainViewModel = _container.Resolve <MainViewModel>(); _waitHandle.Set(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
public void ShowToast(string msg, Exception ex) { _mainVm.ToastText = $"{msg}\r\n{ex}"; _logDog.Error(msg, ex); }
public static void Error(string msg) { _log.Error(msg); }