Ejemplo n.º 1
0
        private async Task AttempSeeding(SeederAction seederAction)
        {
            if (!await CanSeed())
                return;

            _browserRefreshTimer.Stop();

            ContextUpdatedHandler handler = null;
            handler = (tSender, tE) =>
            {
                _context.OnContextUpdate -= handler;
                _context.Session.CurrentServer = seederAction.ServerStatus;

                DialogResult result = MessageBoxEx.Show("Seeding in 5 seconds.", "Auto-Seeding", MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 5000);
                
                if (result == DialogResult.Cancel)
                    return;

                JoinServer();
            };
            _context.OnContextUpdate += handler;
            await LoadPage(seederAction.ServerStatus.Address);

            _browserRefreshTimer.Start();
        }
Ejemplo n.º 2
0
        private async Task SeederActionHandler(SeederAction seederAction)
        {
            if (seederAction.ActionType == SeederActionType.Noop)
                return;
            if (seederAction.ActionType == SeederActionType.Stop)
            {
                await _processController.StopGame(_context.IsSeeding());
                return;
            }
            if (seederAction.ActionType == SeederActionType.Seed)
            {
                await AttempSeeding(seederAction);
                return;
            }

            throw new ArgumentException("Unknow SeederAction ActionType.");
        }