Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
 internal static async Task <bool> InitializeCommonTask()
 {
     _commonTask = CommandInitialTaskTypes.CommandInitialTask;
     InitializeTaskFatory.Configurate(_commonTask.ToArray());
     return(await InitializeTaskFatory.ExcuteInitialize());
 }