Пример #1
0
        public Sticker CreateSticker(string stickerEmoji,
                                     string stickerFileId,
                                     long?photoId,
                                     int?stickerSetId            = null,
                                     StickerStatus stickerStatus = StickerStatus.Unpublished,
                                     string azureImageUrl        = "")
        {
            var sticker = new Sticker
            {
                VkImageId      = photoId,
                TelegramFileId = stickerFileId,
                CreatedDate    = DateTime.Now,
                StickerStatus  = stickerStatus,
                AzureImageUrl  = azureImageUrl
            };

            if (stickerSetId != null)
            {
                sticker.StickerSet = _context.StickerSets.FirstOrDefault(p => p.Id == stickerSetId);
            }

            var emoji = new StickerEmoji
            {
                Emoji   = _emojiService.GetBySymbol(stickerEmoji),
                Sticker = sticker
            };

            _context.Add(emoji);

            sticker = _context.Add(sticker).Entity;

            _context.SaveChanges();

            return(sticker);
        }
Пример #2
0
        public void SetStatus(StickerStatus state)
        {
            CurrentStatus = state;
            switch (state)
            {
            case StickerStatus.Idle:
                Color = "#E88801";
                HideAllStickers();
                break;

            case StickerStatus.WaitingForReading:
                Color = "#E88801";
                Msg   = "waiting for glucose reading";
                break;

            case StickerStatus.DownloadingReading:
                Color = "#FFC200";
                Msg   = "downloading reading";
                break;

            case StickerStatus.DisplayingReading:
                if (LastReadingValue < 10)
                {
                    Color = "#80BB11";
                }
                else
                {
                    Color = "#C93C00";
                }
                ShowButton = true;
                break;

            case StickerStatus.NoNewReading:
                // Fade to WaitingForReading if min time since last reading
                Timer1 = new Timer(UpdateState, null, 5000, 0);
                break;
            }
        }
Пример #3
0
 public void SetStatus(StickerStatus state)
 {
     CurrentStatus = state;
       switch (state)
       {
     case StickerStatus.Idle:
       Color = "#E88801";
       HideAllStickers();
       break;
     case StickerStatus.WaitingForReading:
       Color = "#E88801";
       Msg = "waiting for glucose reading";
       break;
     case StickerStatus.DownloadingReading:
       Color = "#FFC200";
       Msg = "downloading reading";
       break;
     case StickerStatus.DisplayingReading:
       if (LastReadingValue < 10)
       {
     Color = "#80BB11";
       }
       else
       {
     Color = "#C93C00";
       }
       ShowButton = true;
       break;
     case StickerStatus.NoNewReading:
       // Fade to WaitingForReading if min time since last reading
       Timer1 = new Timer(UpdateState, null, 5000, 0);
       break;
       }
 }