public void Execute(PictureCommand command)
    {
        switch (command)
        {
        case PictureCommand.EDIT:
            BeginEdit();
            break;

        case PictureCommand.DONE:
            DoneEdit();
            break;

        case PictureCommand.CANCEL:
            CancelEdit();
            break;

        case PictureCommand.FRAME:
            OpenFrameMenu();
            break;

        case PictureCommand.IMAGE:
            OpenImageMenu();
            break;

        case PictureCommand.ADD:
            AddPicture();
            break;

        case PictureCommand.DELETE:
            DeletePicture();
            break;
        }
    }
        public void TestPictureWithDefaultValues()
        {
            Action         action  = Action.Parse("create picture ab1.jpg");
            PictureCommand picture = action.Create.GetCommandOfType <PictureCommand>();

            Assert.IsNotNull(picture);
            Assert.AreEqual("ab1.jpg", picture.Picture);
        }
        public void TestPictureWithCustomValues()
        {
            Action         action  = Action.Parse("create picture www.activeworlds.com/images/webcam.jpg update=10");
            PictureCommand picture = action.Create.GetCommandOfType <PictureCommand>();

            Assert.IsNotNull(picture);
            Assert.AreEqual("www.activeworlds.com/images/webcam.jpg", picture.Picture);
            Assert.AreEqual(10, picture.Update);
        }
Example #4
0
        protected void SavePicture(PictureCommand command, string path)
        {
            if (command == null)
            {
                return;
            }
            var finalPath = Path.Combine(Server.MapPath(path), command.Name);

            command.HttpPostedFileBase.SaveAs(finalPath);
            ImageProcessing.CreateThumbnail(finalPath, Server.MapPath(path + "Thumb/"), ImageThumbnailSize, ImageThumbnailSize);
        }
Example #5
0
        public async Task TestReplyCommand()
        {
            PictureCommand command   = new PictureCommand();
            var            botClient = await WebAppBot.Models.Bot.GetBotClientAsync();

            try
            {
                await command.Execute(Mes, botClient);
            }
            catch (Exception ex)
            {
                Assert.IsNull(ex);
            }
        }
Example #6
0
        /// <summary>
        /// allowed extensions: ".gif", ".jpg", ".jpeg", ".png", ".bmp"
        /// </summary>
        /// <param name="httpPostedFileBase"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        protected PictureCommand PreparePicture(HttpPostedFileBase httpPostedFileBase, string path)
        {
            var picture = new PictureCommand();

            {
                var file = Path.GetExtension(httpPostedFileBase.FileName);
                if (file == null)
                {
                    return(picture);
                }
                var extension = file.ToLower();
                var fileName  = Guid.NewGuid() + extension;
                picture = new PictureCommand {
                    Name = fileName, Address = path, HttpPostedFileBase = httpPostedFileBase
                };
            }

            return(picture);
        }
Example #7
0
        static void Main(string[] args)
        {
            botClient = new TelegramBotClient("760620360:AAGq9KIBMccVIGo0Rbggq3Hn88ehgLVNq38");
            var me = botClient.GetMeAsync().Result;

            _stickerCommand = new StickerCommand(botClient);
            _textCommand    = new TextCommand(botClient);
            _videoCommand   = new VideoCommand(botClient);
            _pictureCommand = new PictureCommand(botClient);
            _rebootCommand  = new RebootCommand(botClient);
            _audioCommand   = new AudioCommand(botClient);


            botClient.OnMessage += BotOnMessage;
            botClient.StartReceiving();


            Console.WriteLine($"Hello World I'm the:  ID:{me.Id} / FirstName:{me.FirstName} / Username:{me.Username}!");
            Console.WriteLine("Press any key to continue..");
            Console.ReadKey();
            Console.Clear();
            Console.WriteLine("Bye..");
            System.Threading.Thread.Sleep(1000);
        }
Example #8
0
        public void DashPicture(string id, string filename, string x, string y, string xscale, string yscale, string opacity, string ro)
        {
            IHalationCommand cmd = new PictureCommand(Halation.CurrentSelectedLine, this.GetIndent(Halation.CurrentSelectedLine), Halation.currentCodePackage, id, filename, x, y, xscale, yscale, opacity, ro);

            HalationInvoker.Dash(Halation.currentScriptName, cmd);
        }