public static void ExcuteCommandWithoutDispatcher <T>(this IRegistorCommand <T> command, object param) { try { if (command.CanExecute(param)) { command.Execute(param); } } catch (Exception ex) { LogExtensions.Critical(null, ex); } }
internal static async void Initialize(string[] args) { try { var appentry = ActivatorWrapper.SolveInstance <T>(); AdapterInitialize(appentry.InitializeTask); var isSucc = false; if (appentry.SplashEnabled) { var splashWindow = (Window)ActivatorWrapper.SolveInstance(appentry.SplashWindowType); splashWindow.Show(); isSucc = await Task.Run(() => InitializeTaskFatory.ExcuteInitialize()); splashWindow.Close(); } else { isSucc = await Task.Run(() => InitializeTaskFatory.ExcuteInitialize()); } if (isSucc) { var mainWindow = (BootstrapWindow)ActivatorWrapper.SolveInstance(appentry.MainWindowtype); mainWindow.Closed += MainWindow_Closed; Application.Current.MainWindow = mainWindow; mainWindow.Show(); } else { MessageBox.Show("系统任务初始化错误,程序关闭", "错误提示"); Application.Current.Shutdown(); } } catch (Exception ex) { MessageBox.Show("系统初始化错误:" + ex.Message, "错误提示"); LogExtensions.Critical(null, ex); Application.Current.Shutdown(); } }