예제 #1
0
        protected override async Task ExitAsync(object o, EventArgs args)
        {
            await base.ExitAsync(o, args).ConfigureAwait(false);

            // TODO: The task.Run is afaik to not end up blocking the calling thread and ending in dead-lock
            // Probably better to deal with that in the startupmanager itself, localized at the relevant spot?
            if (_startupManager != null)
            {
                await Task.Run(() => StartupSequence.Exit(_startupManager)).ConfigureAwait(false);
            }
            else
            {
                MainLog.Logger.Error("StartupManager was null on exit!");
            }
        }
예제 #2
0
        protected override void PreStart()
        {
            // TODO: How to deal with other mappers?
            var c = new MapperConfiguration(cfg => {
                cfg.SetupConverters();
                cfg.CreateMap <Collection, CollectionInfo>()
                .Include <CustomCollection, CollectionInfo>()
                .ForMember(x => x.ShortId, opt => opt.MapFrom(src => new ShortGuid(src.Id)));
                cfg.CreateMap <CustomCollection, CollectionInfo>();
                cfg.CreateMap <CustomCollection, CollectionImageDataModel>();
            });

            MappingExtensions.Mapper = c.CreateMapper();
            _startupManager          = Container.GetInstance <IPlayStartupManager>();
            StartupSequence.Start(_startupManager);
            //SetupCookies(Container.GetInstance<IInstalledGamesService>());
            SetupThemes();
            // WARNING - DO NOT SHOW NON-FATAL DIALOGS HERE
        }
예제 #3
0
        static void Initialize()
        {
            CommonBase.AssemblyLoader = new AssemblyLoader(Assembly.GetEntryAssembly());
            HandleSquirrel();

            if (
                !SingleInstance <PlayApp> .TryInitializeAsFirstInstance <PlayApp>(AppName, null, "withSIX-Play",
                                                                                  "Play withSIX", "Play"))
            {
                return;
            }

            // TODO
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
            StartupSequence.PreInit(AppName);
            PlayApp.Launch();

            SingleInstance <PlayApp> .Cleanup();
        }