public byte[] GetImage(Guid formId, Guid imageId, int height = 0, int width = 0)
        {
            var form   = FormRepo.GetForm(formId);
            var finder = new ControlFinder(form);
            var image  = finder.Find(imageId) as BizImage;

            if (image == null || image.ImageBytes == null)
            {
                return(null);
            }

            if (width <= 0 && height <= 0)
            {
                return(image.ImageBytes);
            }

            using (var ms = new MemoryStream(image.ImageBytes))
            {
                using (var ms2 = new MemoryStream())
                {
                    ResizeImage(height, width, ms, ms2);
                    ms2.Position = 0;
                    return(ms2.ToArray());
                }
            }
        }
Exemple #2
0
        //[TestCase(typeof(NotExistingControl), "dadasda", "Controls.html")]
        public void ControlFinder_FindControl_ReturnsCorrectControl(Type expectedType, string controlName, string htmlResourceName)
        {
            string resourcePath = Path.Combine(_resourcesPath, htmlResourceName);
            string source       = File.ReadAllText(resourcePath);

            var controlFinder = new ControlFinder(source);
            var webControl    = controlFinder.Find(controlName);

            Assert.IsInstanceOf(expectedType, webControl);
        }
Exemple #3
0
        public void Test_ControlFinder_FindButtonControl()
        {
            string controlName      = "Cancel";
            string controlType      = "Button";
            var    htmlResourceName = "Controls.html";
            string resourcePath     = Path.Combine(_resourcesPath, htmlResourceName);
            string source           = File.ReadAllText(resourcePath);

            var         controlFinder = new ControlFinder(source);
            BaseControl controlFound  = controlFinder.Find(controlName, controlType);
        }
        //        private static void GotoProjectTab(string projectTabName)
        //        {
        //            TabControlTester t = new TabControlTester("_projectTabControl");
        //
        //            foreach (TabPage page in t.Properties.TabPages)
        //            {
        //                if (page.Name == projectTabName)
        //                {
        //                    t.Properties.SelectedTab = page;
        //                    break;
        //                }
        //            }
        ////            t.Properties.SelectedTab = t.Properties.TabPages[projectTabName];
        //
        //            Assert.IsNotNull(t.Properties.SelectedTab, "Couldn't find "+projectTabName);
        //        }

        private void WalkTopLevelTabs()
        {
            //            for(int i = 0; i<10000;i++)
            //            {
            //                Application.DoEvents();
            //            }
            ControlFinder f         = new ControlFinder("_areasToolStrip");
            ToolStrip     toolstrip = (ToolStrip)f.Find();

            foreach (ToolStripButton button in toolstrip.Items)
            {
                string name = button.Name;
                ClickToolStripButton(name);
            }
        }