public void DropDownFormBuildTest()
        {
            var form   = new TestForm2() as IModelDefinitionForm;
            var fields = form.GetDetailsFields().Where(f => f.BindingProperty == "ClientId");

            Assert.Single(fields);
            var f = fields.Single();

            Assert.True(f.Required);
            Assert.False(f.Hidden);
            Assert.Null(f.ReadOnly);
            Assert.False(f.Filter);
            Assert.Equal("Client", f.Label);
            Assert.Equal(typeof(Client), f.SelectEntityType);
            Assert.Equal("Id", f.SelectIdProperty);
            Assert.Equal("Name", f.SelectNameProperty);
        }
Exemplo n.º 2
0
 public TestForm()
 {
     InitializeComponent();
     tf2 = new TestForm2(this); //Assign new object(form) to globally created variable(Second form)
     tf2.Show();                //Important to use Show not ShowDialog since if you use ShowDialog it will stop further code from executing
 }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            //var attempts = new FileParser().IMages((int)this.getTestID());
            this.Hide();
            var test_case = new List <SimplyTest>()
            {
                new SimplyTest()
                {
                    TestType = "OneWrong",
                    Question = new RenderObject()
                    {
                        StringValue = "Отметь \"лишний\" предмет", // вот тут текст вопросa
                        ImageValue  = null                         // картинка вопроса
                    },
                    Variables = new List <RenderObject>()
                    {
                        new RenderObject()
                        {
                            StringValue = "1",                                                      // вот тут текст который будет в варианте ответа
                            //ImageValue = Image.FromFile(@"C:\Users\Дарья\Documents\Visual Studio 2015\Projects\oksanas_kids\oksana_kids\bin\Debug\testsources\1\1\1.png") // ккатринка ответа
                            ImageValue = Image.FromFile(Path.GetFullPath(@"testsources\1\1\1.png")) // ккатринка ответа
                        },
                        new RenderObject()
                        {
                            StringValue = "2",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\1\2.jpg"))
                        },
                        new RenderObject()
                        {
                            StringValue = "3",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\1\3.png"))
                        },
                        new RenderObject()
                        {
                            StringValue = "4",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\1\4.jpg"))
                        }
                    },
                    RightIdx = 3 // индекс правильного ответа
                },
                new SimplyTest()
                {
                    TestType = "OneWrong",
                    Question = new RenderObject()
                    {
                        StringValue = "Отметь \"лишний\" предмет",
                        ImageValue  = null
                    },
                    Variables = new List <RenderObject>()
                    {
                        new RenderObject()
                        {
                            StringValue = "1",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\2\1.jpg"))
                        },
                        new RenderObject()
                        {
                            StringValue = "2",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\2\2.jpg"))
                        },
                        new RenderObject()
                        {
                            StringValue = "3",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\2\3.png"))
                        },
                        new RenderObject()
                        {
                            StringValue = "4",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\2\4.png"))
                        }
                    },
                    RightIdx = 2
                },
                new SimplyTest()
                {
                    TestType = "OneWrong",
                    Question = new RenderObject()
                    {
                        StringValue = "Отметь \"лишний\" предмет",
                        ImageValue  = null
                    },
                    Variables = new List <RenderObject>()
                    {
                        new RenderObject()
                        {
                            StringValue = "1",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\5\1.png"))
                        },
                        new RenderObject()
                        {
                            StringValue = "2",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\5\2.png"))
                        },
                        new RenderObject()
                        {
                            StringValue = "3",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\5\3.png"))
                        },
                        new RenderObject()
                        {
                            StringValue = "4",
                            ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\5\4.png"))
                        }
                    },
                    RightIdx = 3
                },
                new SimplyTest()
                {
                    TestType = "OneWrong",
                    Question = new RenderObject()
                    {
                        StringValue = "Какого цвета эти предметы?",
                        ImageValue  = Image.FromFile(Path.GetFullPath(@"testsources\1\4\4.jpg"))
                    },
                    Variables = new List <RenderObject>()
                    {
                        new RenderObject()
                        {
                            StringValue = "оранжевого"
                        },
                        new RenderObject()
                        {
                            StringValue = "красного"
                        },
                        new RenderObject()
                        {
                            StringValue = "желтого"
                        },
                        new RenderObject()
                        {
                            StringValue = "голубого"
                        }
                    },
                    RightIdx = 2
                }
            };

            Test.TestForm a = new Test.TestForm(test_case, this);
            a.Show();

            var simplyQuestion = new List <SimplyTest>()
            {
                new SimplyTest()
                {
                    TestType = "Juxtaposition",
                    Question = new RenderObject()
                    {
                        StringValue = "Разложи фрукты и ягоды по баночкам"
                    },
                    Questions = new List <RenderObject>()
                    {
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\1.jpg")
                        },
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\2.jpg")
                        }
                    },
                    Variables = new List <RenderObject>()
                    {
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\1-1.jpg")
                        },
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\1-2.jpg")
                        },
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\1-3.png")
                        },
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\1-4.jpg")
                        },
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\2-1.jpg")
                        },
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\2-2.jpg")
                        },
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\2-3.jpg")
                        },
                        new RenderObject()
                        {
                            ImageValue = Image.FromFile(@"testsources\1\3\2-4.jpg")
                        }
                    },
                    RightIdx = 30
                }
            };

            var imageSwapper = new TestForm2(simplyQuestion, this);

            imageSwapper.Show();
        }
 public TestForm()
 {
     InitializeComponent();
     tf2 = new TestForm2(this);
     tf2.Show();
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            BotBase <Start> bb = new BotBase <Start>(APIKey);

            bb.BotCommands.Add(new BotCommand()
            {
                Command = "start", Description = "Starts the bot"
            });
            bb.BotCommands.Add(new BotCommand()
            {
                Command = "form1", Description = "Opens test form 1"
            });
            bb.BotCommands.Add(new BotCommand()
            {
                Command = "form2", Description = "Opens test form 2"
            });
            bb.BotCommands.Add(new BotCommand()
            {
                Command = "params", Description = "Returns all send parameters as a message."
            });

            bb.BotCommand += async(s, en) =>
            {
                switch (en.Command)
                {
                case "/start":

                    var start = new Menu();

                    await en.Device.ActiveForm.NavigateTo(start);

                    break;

                case "/form1":

                    var form1 = new TestForm();

                    await en.Device.ActiveForm.NavigateTo(form1);

                    break;

                case "/form2":

                    var form2 = new TestForm2();

                    await en.Device.ActiveForm.NavigateTo(form2);

                    break;

                case "/params":

                    String m = en.Parameters.DefaultIfEmpty("").Aggregate((a, b) => a + " and " + b);

                    await en.Device.Send("Your parameters are: " + m, replyTo : en.Device.LastMessageId);

                    en.Handled = true;

                    break;
                }
            };

            //Update Bot commands to botfather
            bb.UploadBotCommands().Wait();

            bb.SetSetting(TelegramBotBase.Enums.eSettings.LogAllMessages, true);

            bb.Message += (s, en) =>
            {
                Console.WriteLine(en.DeviceId + " " + en.Message.MessageText + " " + (en.Message.RawData ?? ""));
            };

            bb.Start();



            Console.WriteLine("Telegram Bot started...");

            Console.WriteLine("Press q to quit application.");


            Console.ReadLine();

            bb.Stop();
        }