コード例 #1
0
        internal static void AdapterInitialize(List <Type> tasks)
        {
            var tmpTask = new List <Type>();

            if (tasks.Any())
            {
                tmpTask.AddRange(tasks.Where(task => !_commonTask.Contains(task)));
            }
            InitializeTaskFatory.Configurate(tmpTask.ToArray());
        }
コード例 #2
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();
            }
        }
コード例 #3
0
 internal static async Task <bool> InitializeCommonTask()
 {
     _commonTask = CommandInitialTaskTypes.CommandInitialTask;
     InitializeTaskFatory.Configurate(_commonTask.ToArray());
     return(await InitializeTaskFatory.ExcuteInitialize());
 }