예제 #1
0
 public Task InitializeComponent()
 {
     return(Task.Factory.StartNew(() =>
     {
         try
         {
             ScanPluginFromAssembly();
         }
         catch (Exception ex)
         {
             _log.Error($"初始化插件:{ex}");
         }
     }));
 }
예제 #2
0
 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());
     }
 }
예제 #3
0
 public void ShowToast(string msg, Exception ex)
 {
     _mainVm.ToastText = $"{msg}\r\n{ex}";
     _logDog.Error(msg, ex);
 }
예제 #4
0
 public static void Error(string msg)
 {
     _log.Error(msg);
 }