示例#1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (!Directory.Exists(PathHelper.ProcessAppDir))
            {
                Directory.CreateDirectory(PathHelper.ProcessAppDir);
            }
            if (!Directory.Exists(Plugins.PluginFolderPath))
            {
                Directory.CreateDirectory(Plugins.PluginFolderPath);
            }

            var          userPrefPersister = new UserPreferencePersist();
            var          pref = userPrefPersister.LoadPreference();
            const string HelixLeisureExtensionPath = @"\\was29\Shared\ECSDBToolsExtensions";

            if (string.IsNullOrWhiteSpace(pref.PluginDownloadPath) && Directory.Exists(HelixLeisureExtensionPath))
            {
                pref.PluginDownloadPath = HelixLeisureExtensionPath;
                userPrefPersister.SavePreference(pref);
            }
            if (!string.IsNullOrWhiteSpace(pref.PluginDownloadPath))
            {
                try
                {
                    PluginDownloaderHelper.Download(pref.PluginDownloadPath);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            AppDomain.CurrentDomain.AssemblyResolve += LoadFromPluginFolder;
            DispatcherHelper.Initialize();
            base.OnStartup(e);
            Task.Run(() => SetAddRemoveProgramsIcon());
        }