Пример #1
0
    public void SelectEmail(int emailIndex)
    {
        if (emailIndex <= 0 || emailIndex > emailShowList.Count)
        {
            SwitchState(ScreenType.EmailMenu);
            return;
        }

        else if (emailIndex <= pageIndex)
        {
            pageIndex -= 10;
            CreateEmailText(pageIndex);
        }
        else if (pageIndex + 10 < emailIndex)
        {
            pageIndex += 10;
            CreateEmailText(pageIndex);
        }


        //emailIndex -= pageIndex;

        //currentEmail = emailsToDisplay[emailIndex-1];
        currentEmail           = emailShowList[emailIndex - 1];
        currentEmail.read      = true;
        emailDisplayText.text  = currentEmail.displayText;
        displaySenderText.text = CommonCompStrings.emailDict[CommonCompStrings.Email.SenderDisplay] +
                                 currentEmail.sender;
        displaySubjectText.text = CommonCompStrings.emailDict[CommonCompStrings.Email.SubjectDisplay] +
                                  currentEmail.subject;
        SwitchState(ScreenType.Email);
    }
Пример #2
0
        internal GameController(EmailCommand emailService,
                                TimeLeftCommand timerService,
                                InsertCodeCommand codeService,
                                CheckRadioCommand checkRadioCommand,
                                DefragCommand defragCommand,
                                StatusCommand statusCommand,
                                CleanCacheCommand cleanCacheCommand)
        {
            SetupEmailService(emailService);
            _timerService      = timerService;
            _codeService       = codeService;
            _radioService      = checkRadioCommand;
            _defragCommand     = defragCommand;
            _statusCommand     = statusCommand;
            _cleanCacheCommand = cleanCacheCommand;
            _codeService.OnSuccesfullDelayCode += StartTimer;
            DeadHandSettings = new DeadHandSettings()
            {
                MotherboardTemperature      = 80,
                MemoryCacheUsedPercentage   = 20,
                DiskFragmentationPercentage = 10
            };

            _deadHandMaintenanceTimer          = new Timer(_rng.Next(2, 4) * 60 * 1000);
            _deadHandMaintenanceTimer.Elapsed += _deadHandMaintenanceTimer_Elapsed;
            _deadHandMaintenanceTimer.Start();
            _defragCommand.CurrentSettings     = DeadHandSettings;
            _statusCommand.CurrentSettings     = DeadHandSettings;
            _cleanCacheCommand.CurrentSettings = DeadHandSettings;

            CreateTimeline();
        }
Пример #3
0
        private void SetupEmailService(EmailCommand emailService)
        {
            EmailService           = emailService;
            emailService.EmailList = new List <Email>()
            {
                new Email()
                {
                    ReceivedDate = DateTime.Now,
                    Subject      = "Order no. 583",
                    Sender       = "*****@*****.**",
                    Content      = @"To asset " + Environment.UserName + @", 
Since peace talks in Geneva have been cancelled, and hostile armed force has issued red alert to their strategic weapons division, Strategic Command has issued STANDBY alert.

1. " + Environment.UserName + " has been authorized to enter following Dead Hand activation code: 2DCJ-CA83-8A9H-A9HD" +
                                   "\n2. 10 minutes after activation Dead Hand will automatically launch retaliationary nuclear strike against enemy cities" +
                                   "\n3. In final 4 minutes before activation " + Environment.UserName + " will get the chance to enter following delay code: F7SA-USA7-JA98-CDSA. Entering that code will delay retaliation for 7 minutes" +
                                   "\n4. To help " + Environment.UserName + " make decision whether enter the code and wait another 10 minutes, or allow attack to commence, following checks may be performed:" +
                                   "\na) Check whether National Radio program 4 is still broadcasting" +
                                   "\nb) Check whether Naval Wether Service stil issues weather updates" +
                                   "\nIn addition, all National Civil Defense Service broadcasts will be redirected to " + Environment.UserName + " email inbox in text form" +
                                   "\n5. " + Environment.UserName + " is responsible for operation of computer controling Dead Hand system" +
                                   "\n6. Dead Hand may be shut down only by entering shutdown code, that will be issued in ALL CLEAR message from Strategic Command"
                }
            };
        }
Пример #4
0
 public ScenarioBase(EmailCommand emailService,
                     CheckRadioCommand radioService)
 {
     _rng          = new Random();
     _emailService = emailService;
     _triggers     = new List <System.Timers.Timer>();
     _radioService = radioService;
 }
Пример #5
0
        private static void AJula_OnMessage(object sender, Telegram.Bot.Args.MessageEventArgs e)
        {
            Console.WriteLine($"От {e.Message.Chat.Id}:{e.Message.Text}");
            ICommand command;

            switch (e.Message.Text.ToLower())
            {
            case null: return;

            case "привет":
                command = new HelloCommand();
                command.Execute(e.Message);
                break;

            case "время":
                command = new TimeCommand();
                command.Execute(e.Message);
                break;

            case "погода":
                command = new WeatherCommand();
                command.Execute(e.Message);
                break;

            case "курс":
                command = new CurrencyCommand();
                command.Execute(e.Message);
                break;

            case "создание напоминания":
                Bot.Flag = true;
                break;

            case "газета":
                command = new NewsCommand();
                command.Execute(e.Message);
                break;

            case "почта":
                command = new EmailCommand(e.Message.Chat.Id);
                command.Execute(e.Message);
                break;

            default:
                Bot.AssistantJula.SendTextMessageAsync
                (
                    chatId: e.Message.Chat,
                    text: "Я вас не поняла",
                    replyMarkup: KeyboardTemplates.mainKeyboard
                ).ConfigureAwait(false);
                break;
            }
            if (Bot.Flag)
            {
                command = new ReminderCommand();
                command.Execute(e.Message);
            }
        }
Пример #6
0
        public static SmtpEmailBuilder SmtpEmail(this CommandSet set, string id)
        {
            var setting = new SmtpEmailSetting {Id = id};

            var command = new EmailCommand(setting);

            set.Add(command);
            var result = new SmtpEmailBuilder(setting);
            return result;
        }
Пример #7
0
        public IActionResult GetBalance([FromBody] EmailCommand command)
        {
            AccountViewModel accountViewModel = _userService.GetAccountDetailByEmail(command.Email);

            if (accountViewModel == null)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new { Message = "Error" }));
            }
            return(Ok(accountViewModel));
        }
Пример #8
0
 /// <summary>
 /// Checks if every command is executable.
 /// </summary>
 private void CheckCommands()
 {
     SelectRootPathFolderCommand.RaiseCanExecuteChanged();
     LoadFileCommand.RaiseCanExecuteChanged();
     AddPenaltyCommand.RaiseCanExecuteChanged();
     RemovePenaltyCommand.RaiseCanExecuteChanged();
     ActivateCroissantCommand.RaiseCanExecuteChanged();
     SelectLineCommand.RaiseCanExecuteChanged();
     EmailCommand.RaiseCanExecuteChanged();
     SaveCommand.RaiseCanExecuteChanged();
 }
Пример #9
0
        private static void AssistantJula_OnCallbackQuery(object sender, Telegram.Bot.Args.CallbackQueryEventArgs e)
        {
            switch (e.CallbackQuery.Data)
            {
            case "next":
                Bot.AssistantJula.EditMessageTextAsync
                (
                    chatId: e.CallbackQuery.From.Id,
                    messageId: e.CallbackQuery.Message.MessageId,
                    text: NewsCommand.NavigationNewspaper(NewsCommand.NextPages),
                    replyMarkup: KeyboardTemplates.inlineNewsKeyboard
                ).ConfigureAwait(false);
                break;

            case "back":
                Bot.AssistantJula.EditMessageTextAsync
                (
                    chatId: e.CallbackQuery.From.Id,
                    messageId: e.CallbackQuery.Message.MessageId,
                    text: NewsCommand.NavigationNewspaper(NewsCommand.BackPages),
                    replyMarkup: KeyboardTemplates.inlineNewsKeyboard
                ).ConfigureAwait(false);
                break;

            case "nextE":
                Bot.AssistantJula.EditMessageTextAsync
                (
                    chatId: e.CallbackQuery.From.Id,
                    messageId: e.CallbackQuery.Message.MessageId,
                    text: EmailCommand.NavigationEmail(EmailCommand.NextEmail),
                    replyMarkup: KeyboardTemplates.inlineEmailKeyboard
                ).ConfigureAwait(false);
                break;

            case "backE":
                Bot.AssistantJula.EditMessageTextAsync
                (
                    chatId: e.CallbackQuery.From.Id,
                    messageId: e.CallbackQuery.Message.MessageId,
                    text: EmailCommand.NavigationEmail(EmailCommand.BackEmail),
                    replyMarkup: KeyboardTemplates.inlineEmailKeyboard
                ).ConfigureAwait(false);
                break;
            }
        }
Пример #10
0
        private void CreateCommands()
        {
            RestoreCommand = ReactiveCommand.Create();
            RestoreCommand.Subscribe(arg => RestoreCommandHandler());

            ExportCommand = ReactiveCommand.Create();
            ExportCommand.Subscribe(arg => ExportCommandCommandHandler());

            LoadSoundsCommand = ReactiveCommand.Create();
            LoadSoundsCommand.Subscribe(arg => LoadSoundsCommandHandler());

            ResetSoundsCommand = ReactiveCommand.Create();
            ResetSoundsCommand.Subscribe(arg => ResetSoundsCommandHandler());

            ClearPlayersCommand = ReactiveCommand.Create();
            ClearPlayersCommand.Subscribe(arg => ClearPlayersCommandHandler());

            EmailCommand = ReactiveCommand.Create();
            EmailCommand.Subscribe(async arg => await EmailCommandCommandHandler());
        }
Пример #11
0
        public IHttpActionResult Logout([FromBody] EmailCommand email)
        {
            if (string.IsNullOrWhiteSpace(email?.Email))
            {
                return(Content(HttpStatusCode.Unauthorized, "Email inválido"));
            }

            try
            {
                if (_profissionalAcessoService.Logout(email.Email))
                {
                    return(Ok());
                }

                return(BadRequest());
            }
            catch (Exception e)
            {
                return(Content(HttpStatusCode.Unauthorized, e.Message));
            }
        }
Пример #12
0
 public FalseWarningScenario(EmailCommand emailService, CheckRadioCommand radioService) : base(emailService, radioService)
 {
 }
Пример #13
0
 public void Send(EmailCommand command)
 {
 }