示例#1
0
 public void Div_DivideRegisters_ResultAndOverflowAreCorrect()
 {
     var prev = new MutableState().Set(Register.A, 3).Set(Register.B, 2);
     var state = new Div(new Reg(Register.A), new Reg(Register.B)).Apply(prev);
     Assert.AreEqual(0x1, state.Get(Register.A));
     Assert.AreEqual(0x8000, state.Get(Register.O));
 }
示例#2
0
		public static void Execute (Atom parent){

			var nb =new NavList ();
					
			nb.Add ("Simple Bootbox Dialog", handler: e=> Bootbox.Dialog("cayita is awesome"));
			nb.Add ("Custom Bootbox.Dialog I", handler:  CustomDialog_1);
			nb.Add ("Custom Bootbox.Dialog 2", handler:  CustomDialog_2);
			nb.Add ("Custom Bootbox.Dialog 3", handler:  CustomDialog_3);
			nb.AddDivider ();

			nb.Add ("Alert", handler: e=> Bootbox.Alert("Alert!",()=> "Alert callback...".LogInfo()));
			nb.Add ("Confirm", handler: e=> Bootbox.Confirm("Confirm...",(c)=> ("Confirm callback "+c).LogInfo()));
			nb.Add ("Prompt", handler: e=> Bootbox.Prompt("Pormpt...",(s)=> ("Prompt callback "+s).LogInfo()));

			var code = new Div ();

			new Div (d=>{
				d.ClassName="bs-docs-example";
				d.JQuery.Append(nb).Append("C# code".Header(4)).Append(code);
				parent.Append(d);
			});

			var rq =jQuery.GetData<string> ("code/demomodals.html");
			rq.Done (s=> code.InnerHTML=s);

		}
示例#3
0
		public static void Execute(Atom parent)
		{

			var fp = new Div ("bs-docs-example");
			var ff = new FileField (fp);
			var ufb = CreateUploadButton (fp);
			var logf = new Div (fp);

			var imp = new Div ("bs-docs-example");
			var imf = new ImgField (imp);
			var imb = CreateUploadButton (imp);
			var logim = new Div (imp);

			parent.JQuery
				.Append ("File Upload".Header(3))
					.Append (fp)
					.Append ("Image Upload".Header(3))
					.Append (imp);


			var rq =jQuery.GetData<string> ("code/demofileupload.html");
			rq.Done (s=> {
				var code=new Div();
				code.InnerHTML= s;
				parent.JQuery.Append ("C# code".Header(3)).Append(code);
			});



			ff.Changed+= (e) => ShowFileInfo(ufb, logf,ff.Input);
			imf.Changed+= (e) => ShowFileInfo(imb, logim, imf.Input);

			ufb.Clicked+= (e) => SendFile(ufb, ff.Input);
			imb.Clicked+= (e) => SendFile(imb, imf.Input);
		}
        protected override void CreateChildControls()
        {
            this.chkUseCustomProfileXml = new CheckBox() { Text = "Use custom publish settings..." };
            var ctlProjectPublishProfileXmlContainer = new Div() { ID = "ctlProjectPublishProfileXmlContainer" };

            this.txtProjectPath = new SourceControlFileFolderPicker();
            this.txtProjectPublishProfileName = new ValidatingTextBox();
            this.txtProjectPublishProfileXml = new ValidatingTextBox() { TextMode = TextBoxMode.MultiLine, Rows = 7 };
            ctlProjectPublishProfileXmlContainer.Controls.Add(new Div("Enter custom publish profile XML:"), this.txtProjectPublishProfileXml);

            this.txtProjectBuildConfiguration = new ValidatingTextBox() { Required = true };
            this.txtVisualStudioVersion = new ValidatingTextBox() { DefaultText = "12.0" };
            this.txtAdditionalArguments = new ValidatingTextBox();
            this.txtUserName = new ValidatingTextBox() { DefaultText = "Inherit credentials from extension configuration" };
            this.txtPassword = new PasswordTextBox();

            this.Controls.Add(
                new SlimFormField("Project/Solution file:", this.txtProjectPath),
                new SlimFormField("Publish profile:", new Div("Profile Name:"), this.txtProjectPublishProfileName, this.chkUseCustomProfileXml, ctlProjectPublishProfileXmlContainer),
                new SlimFormField("Build configuration:", this.txtProjectBuildConfiguration),
                new SlimFormField("Visual Studio version:", this.txtVisualStudioVersion)
                {
                    HelpText = "Visual Studio must be installed in order to publish directly from the command line. Choose " 
                    + "the version of Visual Studio that is installed on the selected server in order for Web Deploy to use the "
                    + "appropriate build targets for the installed version. The default is 12.0 (Visual Studio 2013)."
                },
                new SlimFormField("Credentials:", new Div(new Div("Username:"******"Password:"******"Additional MSBuild arguments:", this.txtAdditionalArguments)
            );

            this.Controls.BindVisibility(chkUseCustomProfileXml, ctlProjectPublishProfileXmlContainer);
        }
示例#5
0
		static void CustomDialog_3(jQueryEvent e){
			var item = e.CurrentTarget.As<NavItem> ();

			var dd = new Div(c=>{
				new TextField(c, i=>i.Placeholder="name");
				new CheckField(c,i=>{
					i.Input.Text="I like cayita";
					i.Input.Checked=true;
					i.Input.Disabled=true;
				});
				new TextAreaInput(c, i=>i.Value="cayita is amazing ...");
			});

			Bootbox.Dialog (dd,  new BootboxHandler {
				Callback=()=> item.Text.LogInfo(),
				Label="Go",
				Class="btn-info",

			},
			new BootboxOptions {
				Header=item.Text,
				Classes="modal-large",
				OnEscape=()=> "Esc pressed".LogInfo()
			});

		}
示例#6
0
		public static void Execute(Atom parent)
		{

			var nb =new NavList ();

			nb.Add ("Tables");
			nb.Add ("Forms");
			nb.Add ("Modals");
			nb.Add ("Panels");
			nb.AddDivider ();
			nb.Add ("Exit");


			var log = new Div ();
			var code = new Div ();

			new Div (d=>{
				d.ClassName="bs-docs-example";
				d.JQuery.Append(nb).Append(log).Append("C# code".Header(4)).Append(code);
				parent.Append(d);
			});

			nb.Selected += (e) => {
				var i = e.CurrentTarget.As<NavItem> ();
				log.Text=  "{0} Clicked".Fmt(i.Text); 
			};

			var rq =jQuery.GetData<string> ("code/demonavlist.html");
			rq.Done (s=> code.Text=s);

		}
示例#7
0
 public void Div_DivisorIsZero_ResultAndOverflowAreZero()
 {
     var prev = new MutableState().Set(Register.A, 1);
     var state = new Div(new Reg(Register.A), new Literal(0)).Apply(prev);
     Assert.AreEqual(0x0, state.Get(Register.A));
     Assert.AreEqual(0x0, state.Get(Register.O));
 }
示例#8
0
		public static void Execute(Atom parent)
		{
			var nb =new NavBar ();
			nb.BrandText="App Title";
			nb.Add ("Home");
			nb.Add ("License");
			nb.Add ("Contact");

			var dd = new DropdownMenu ();
			dd.Text = "Config";
			dd.Nav.Add ("Users");
			dd.Nav.Add ("Groups");

			nb.Add (dd);

			var log = new Div ();
			var code = new Div ();

			new Div (d=>{
				d.ClassName="bs-docs-example";
				d.JQuery.Append(nb).Append(log).Append("C# code".Header(4)).Append(code);
				parent.Append(d);
			});

			nb.Selected += (e) => {
				var i = e.CurrentTarget.As<NavItem> ();
				log.Text=  "{0} Clicked".Fmt(i.Text); 
			};

			var rq =jQuery.GetData<string> ("code/demonavbar.html");
			rq.Done (s=> code.Text=s);

		}
        public void AddTag_ToString_RetrnTagWhithChild()
        {
            Div d = new Div();
            d.AddTag("tagname");
            string html = d.ToString();

            string expected = "<div><tagname></tagname></div>";
            Assert.AreEqual(expected, html);
        }
示例#10
0
        public void AddAttribute_ToString_TagWithAttribute()
        {
            Div d = new Div();
            d.AddAttribute("attname", "val");
            string html = d.ToString();

            string expected = "<div attname=\"val\"></div>";
            Assert.AreEqual(expected, html);
        }
        public void Test_DivElement_Render_With_SubElement()
        {
            Div t = new Div();

            t.AddElement(new Element("test"));
            t.AddElement(new Div());

            Assert.AreEqual("<div><test></test><div></div></div>", t.Render(), "There's no test tag inside div");
        }
示例#12
0
        public void AddTWoAttributes_ToString_TagWithAttributes()
        {
            Div d = new Div();
            d.AddAttribute("first", "val1");
            d.AddAttribute("second", "val2");
            string html = d.ToString();

            string expected = "<div first=\"val1\" second=\"val2\"></div>";
            Assert.AreEqual(expected, html);
        }
示例#13
0
        public void AddClass_ToString_ReturnsTagWithClassAtribute()
        {
            Div d = new Div();
            d.AddClass("classname");

            string html = d.ToString();
            string expected = "<div class=\"classname\"></div>";

            Assert.AreEqual(expected, html);
        }
示例#14
0
        public void AddClassAddAttribute_ToString_TagWithClassesAndAttributes()
        {
            Div d = new Div();
            d.AddClass("one");
            d.AddAttribute("first", "val1");
            string html = d.ToString();

            string expected = "<div class=\"one\" first=\"val1\"></div>";
            Assert.AreEqual(expected, html);
        }
示例#15
0
		static void ShowFileInfo(ButtonIcon bt, Div log, FileInput input)
		{
			log.Empty ();
			bt.Disabled = input.Files.Length == 0;
			foreach (var f in input.Files) {
				log.Append ("Name:{0}<br>Size:{1}<br>Type:{2}<br>LastModifiedDate:{3}<br>"
				            .Fmt(f.Name,f.Size,f.Type,f.LastModifiedDate.ToString("dd-MM-yyyy HH:mm:ss")));
			}

		}
示例#16
0
        static int BruteForce()
        {
            int result = 0;
            var div = new Div(3, 2);
            for (int i = 0; i < 999; i++)
            {
                div = div.Next;
                if(div.NumeratorHasMoreDigitThanDenominator)
                {
                    result++;
                }
            }

            return result;
        }
示例#17
0
 private void LoadChilds(IList<Clay.Logic.Modules.Control> controls, BControl bc)
 {
     foreach (Clay.Logic.Modules.Control item in controls)
     {
         BControl child = null;
         switch (item.Type)
         {
             case Enums.ControlType.Div:
                 child = new Div { ID = item.ID, Float = item.Float, Clear = item.Clear, Width = item.Width, IsViewItem = item.IsViewItem, IsPanel = item.IsPanel };
                 break;
             case Enums.ControlType.Module:
                 child = new ModuleControl { ID = item.ID, ModuleName = item.ModuleName };
                 break;
         }
         bc.Controls.Add(child);
         LoadChilds(item.Controls, child);
     }
 }
        public void Test_DivElement_Render()
        {
            Div t = new Div();

            t.Id("myDiv");
            t.IsRowFluid(true);
            t.Size(GridUtils.FormatGrid(extraSmallSize: 12, largeSize: 12));
            t.AddCss("testClass");

            string render = t.Render();

            Assert.IsTrue(render.Contains("id=\"myDiv\""), "Dv not contains id declaration");
            Assert.IsTrue(render.Contains("class") &&
                render.Contains("row"), "Div not contains class=\"row ...\" declaration");
            Assert.IsTrue(render.Contains("class") && render.Contains("col-xs-12 col-lg-12"),
                "Div doesn't have grid responsive values");
            Assert.IsTrue(render.Contains("class") &&
                render.Contains("testClass"), "Div not contains class=\"testClass ...\" declaration");
            Assert.AreEqual("<div class=\"testClass row col-xs-12 col-lg-12\" id=\"myDiv\"></div>", render,
                "Div don't have same values from test");
        }
示例#19
0
        public virtual void TableWithSideMarginsBetweenFloatTest()
        {
            //TODO DEVSIX-4021 update cmp file after fix
            String      outFileName = destinationFolder + "tableWithSideMarginsBetweenFloat.pdf";
            String      cmpFileName = sourceFolder + "cmp_tableWithSideMarginsBetweenFloat.pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName));
            Document    document    = new Document(pdfDocument);
            Table       table1      = CreateTable(HorizontalAlignment.RIGHT);

            table1.SetMarginRight(150).SetMarginLeft(150);
            Table table2 = CreateTable(HorizontalAlignment.LEFT);

            table2.SetMarginRight(300);
            Table table3 = CreateTable(HorizontalAlignment.CENTER);

            table3.SetMarginLeft(300);
            Div div1 = CreateDiv(ColorConstants.GREEN, ClearPropertyValue.NONE, FloatPropertyValue.LEFT, UnitValue.CreatePointValue
                                     (100));
            Div div2 = CreateDiv(ColorConstants.BLUE, ClearPropertyValue.NONE, FloatPropertyValue.RIGHT, UnitValue.CreatePointValue
                                     (100));
            Div spaceDiv = new Div();

            spaceDiv.SetProperty(Property.CLEAR, ClearPropertyValue.BOTH);
            spaceDiv.Add(new Paragraph("Space Div").SetFontColor(ColorConstants.BLUE));
            document.Add(div1);
            document.Add(div2);
            document.Add(table1);
            document.Add(spaceDiv);
            document.Add(div1);
            document.Add(div2);
            document.Add(table2);
            document.Add(spaceDiv);
            document.Add(div1);
            document.Add(div2);
            document.Add(table3);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             ));
        }
示例#20
0
        public void PurchaseRocketWithGloballyOverridenMethods()
        {
            App.NavigationService.Navigate("http://demos.bellatrix.solutions/");

            Select    sortDropDown          = App.ElementCreateService.CreateByNameEndingWith <Select>("orderby");
            Anchor    protonMReadMoreButton = App.ElementCreateService.CreateByInnerTextContaining <Anchor>("Read more");
            Anchor    addToCartFalcon9      = App.ElementCreateService.CreateByAttributesContaining <Anchor>("data-product_id", "28").ToBeClickable();
            Anchor    viewCartButton        = App.ElementCreateService.CreateByClassContaining <Anchor>("added_to_cart wc-forward").ToBeClickable();
            TextField couponCodeTextField   = App.ElementCreateService.CreateById <TextField>("coupon_code");
            Button    applyCouponButton     = App.ElementCreateService.CreateByValueContaining <Button>("Apply coupon");
            Number    quantityBox           = App.ElementCreateService.CreateByClassContaining <Number>("input-text qty text");
            Div       messageAlert          = App.ElementCreateService.CreateByClassContaining <Div>("woocommerce-message");
            Button    updateCart            = App.ElementCreateService.CreateByValueContaining <Button>("Update cart").ToBeClickable();
            Anchor    proceedToCheckout     = App.ElementCreateService.CreateByClassContaining <Anchor>("checkout-button button alt wc-forward");
            Heading   billingDetailsHeading = App.ElementCreateService.CreateByInnerTextContaining <Heading>("Billing details");
            Span      totalSpan             = App.ElementCreateService.CreateByXpath <Span>("//*[@class='order-total']//span");

            sortDropDown.SelectByText("Sort by price: low to high");
            protonMReadMoreButton.Hover();
            addToCartFalcon9.Focus();
            addToCartFalcon9.Click();
            viewCartButton.Click();
            couponCodeTextField.SetText("happybirthday");
            applyCouponButton.Click();

            messageAlert.ToHasContent().ToBeVisible().WaitToBe();
            messageAlert.ValidateInnerTextIs("Coupon code applied successfully.");
            App.BrowserService.WaitForAjax();
            quantityBox.SetNumber(2);

            // The overridden click delegate is called.
            updateCart.Click();
            App.BrowserService.WaitForAjax();

            totalSpan.ValidateInnerTextIs("114.00€", 15000);

            proceedToCheckout.Click();
            billingDetailsHeading.ToBeVisible().WaitToBe();
        }
示例#21
0
        public Element CreateElement()
        {
            var heading  = new Heading("Draw");
            var subtitle = new Paragraph("Click to draw a masterpiece");
            var canvas   = new Canvas {
                Width  = 320,
                Height = 240,
            };
            var context = canvas.GetContext2D();

            canvas.Clicked += (s, e) => {
                context.BeginPath();
                context.Rect(e.OffsetX - 5, e.OffsetY - 5, 10, 10);
                context.Fill();
            };
            canvas.Style.Cursor      = "pointer";
            canvas.Style.BorderColor = "#CCC";
            canvas.Style.BorderStyle = "solid";
            canvas.Style.BorderWidth = "1px";

            var clearbtn = new Button("Clear")
            {
                Type      = ButtonType.Submit,
                ClassName = "btn btn-danger",
            };

            clearbtn.Clicked += (s, e) => {
                context.ClearRect(0, 0, canvas.Width, canvas.Height);
            };
            clearbtn.Style.Display = "block";

            var app = new Div();

            app.AppendChild(heading);
            app.AppendChild(subtitle);
            app.AppendChild(canvas);
            app.AppendChild(clearbtn);
            return(app);
        }
示例#22
0
        public async Task <IActionResult> Create(string div)
        {
            Div bloco = null;

            if (div == "DivComum")
            {
                bloco = new DivComum();
            }
            if (div == "DivFixo")
            {
                bloco = new DivFixo();
            }

            bloco.Background = new BackgroundCor();

            var backgrounds = new List <Background>();
            var site        = HttpHelper.GetPedidoId();
            var pedido      = await _context.Pedido.Include(p => p.Paginas).FirstAsync(p => p.Id == site);


            return(PartialView(bloco));
        }
示例#23
0
        public virtual void MarginCollapseKeptTogetherDivGoesBackTest02()
        {
            // TODO DEVSIX-3995 The margin between the divs occupies 100 points instead of 300. After a fix the cmp should be updated
            String      cmpFileName = sourceFolder + "cmp_marginCollapseKeptTogetherDivGoesBackTest02.pdf";
            String      outFile     = destinationFolder + "marginCollapseKeptTogetherDivGoesBackTest02.pdf";
            PdfDocument pdfDoc      = new PdfDocument(new PdfWriter(outFile));
            Document    doc         = new Document(pdfDoc);

            doc.SetProperty(Property.COLLAPSING_MARGINS, true);
            Div div1 = new Div().SetMarginBottom(300).SetBackgroundColor(ColorConstants.RED).SetHeight(300).Add(new Paragraph
                                                                                                                    ("Bottom margin: 300"));

            doc.Add(div1);
            Div div2 = new Div().SetMarginTop(100).SetHeight(1000).SetBackgroundColor(ColorConstants.RED).Add(new Paragraph
                                                                                                                  ("Top margin: 100"));

            div2.SetKeepTogether(true);
            doc.Add(div2);
            doc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFile, cmpFileName, destinationFolder,
                                                                             "diff"));
        }
示例#24
0
        public ProgressDisplay(Overlay overlay)
        {
            _overlay = overlay;

            _divTitle = new Div();
            _divTitle.SetClass("progress--title");

            _divAnimationPart1 = new Div();
            _divAnimationPart1.SetClass("line");

            _divAnimationPart2 = new Div();
            _divAnimationPart2.SetClass("line");

            _divAnimationPart3 = new Div();
            _divAnimationPart3.SetClass("line");

            _divAnimationBg = new Div();
            _divAnimationBg.SetClass("animation-bg");

            _divAnimation = new Div(_divAnimationPart1, _divAnimationPart2, _divAnimationPart3, _divAnimationBg);
            _divAnimation.SetClass("progress--animation");

            _btnAbort = new Button("Abort", OnAbort);
            _btnAbort.Hide();

            _progressBar = new Util.ProgressBar(false);

            _progressContainer = new DumpContainer(_progressBar);
            _progressContainer.Hide();

            _divWrap = new Div(_divTitle, _divAnimation, _progressContainer, _btnAbort);
            _divWrap.SetClass("progress-container");

            _divContainer = new Div(_divWrap);
            _divContainer.SetClass("progress");
            _divContainer.Hide();

            VisualTree.Add(_divContainer);
        }
        public PageAdminContent(ComponentJson owner) : base(owner)
        {
            new Html(this)
            {
                TextHtml = "<h1>Content Page</h1>"
            };
            GridContent   = new GridContent(this);
            GridContentMd = new GridContentMd(this);
            ButtonPublish = new Button(this)
            {
                TextHtml = "Update Navigation", CssClass = "button is-primary"
            };
            var content = new Div(this)
            {
                CssClass = "content"
            };

            Html = new Html(content)
            {
                IsNoSanatize = true, IsNoSanatizeScript = "if (typeof Prism != 'undefined') { Prism.highlightAll(); }"
            };                                                                                                                                   // IsNoSanatize because of html id for named anchor.
        }
示例#26
0
        public virtual void UpdateHeightTest01()
        {
            String      testName    = "updateHeightTest01.pdf";
            String      outFileName = destinationFolder + testName;
            String      cmpFileName = sourceFolder + "cmp_" + testName;
            PdfDocument pdfDoc      = new PdfDocument(new PdfWriter(outFileName));

            pdfDoc.SetDefaultPageSize(new PageSize(102.0F, 102.0F));
            Document doc = new Document(pdfDoc);
            Div      div = new Div();

            div.SetBackgroundColor(ColorConstants.RED);
            div.Add(new Paragraph("row"));
            div.Add(new Paragraph("row 10"));
            div.SetKeepTogether(true);
            div.SetHeight(100);
            doc.Add(new Paragraph("a"));
            doc.Add(div);
            doc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , testName + "_diff"));
        }
示例#27
0
        public virtual void KeepTogetherInlineDiv02()
        {
            String      cmpFileName = sourceFolder + "cmp_keepTogetherInlineDiv02.pdf";
            String      outFile     = destinationFolder + "keepTogetherInlineDiv02.pdf";
            PdfDocument pdfDoc      = new PdfDocument(new PdfWriter(outFile));
            Document    doc         = new Document(pdfDoc);

            doc.Add(new Paragraph("first string"));
            Div           div    = new Div().SetWidth(200);
            StringBuilder buffer = new StringBuilder();

            for (int i = 0; i < 130; i++)
            {
                buffer.Append("Part #" + i + " of inline div");
            }
            div.Add(new Paragraph(buffer.ToString()));
            div.SetKeepTogether(true);
            doc.Add(new Paragraph().Add(div));
            doc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFile, cmpFileName, destinationFolder,
                                                                             "diff"));
        }
示例#28
0
        private void btnequal_Click(object sender, EventArgs e)
        {
            num2 = double.Parse(txtboxdata.Text);

            double Pls;
            double Min;
            double Mul;
            double Div;

            switch (selectedOpera)
            {
            case "+":
                Pls             = obj1.Plus((num1), (num2));
                txtboxdata.Text = Pls.ToString();
                break;

            case "-":
                Min             = obj2.Minus((num1), (num2));
                txtboxdata.Text = Min.ToString();
                break;

            case "*":
                Mul             = obj3.PMultiply((num1), (num2));
                txtboxdata.Text = Mul.ToString();
                break;

            case "/":
                Div = obj4.Divide((num1), (num2));
                if (num2 == 0)
                {
                    txtboxdata.Text = "Syntax ERROR";
                }
                else
                {
                    txtboxdata.Text = Div.ToString();
                }
                break;
            }
        }
示例#29
0
 public static void SelectControlInBrowserByID(IE ie, string strID, Enumerators.ControlType ctrl)
 {
     if (ctrl == Enumerators.ControlType.Image)
     {
         Image imgCtrl = (Image)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Image);
         imgCtrl.Click();
     }
     else if (ctrl == Enumerators.ControlType.TableCell)
     {
         TableCell tblCell = (TableCell)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.TableCell);
         tblCell.Click();
     }
     else if (ctrl == Enumerators.ControlType.Button)
     {
         Button btnToSelect = (Button)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Button);
         btnToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.Link)
     {
         Link lnkSelect = (Link)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Link);
         lnkSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.CheckBox)
     {
         CheckBox chkToSelect = (CheckBox)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.CheckBox);
         chkToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.Div)
     {
         Div divToSelect = (Div)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Div);
         divToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.Span)
     {
         Span spanToSelect = (Span)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Span);
         spanToSelect.Click();
     }
     ie.WaitForComplete();
 }
示例#30
0
        private void btnDiv_Click(object sender, EventArgs e)
        {
            float Div;

            bool C1 = float.TryParse(txtNum1.Text, out Div);

            if (C1 == false)
            {
                MessageBox.Show("請輸入數字", "Oops!");
                return;
            }
            bool C2 = float.TryParse(txtNum2.Text, out Div);

            if (C2 == false)
            {
                MessageBox.Show("請輸入數字", "Oops!");
                return;
            }

            Div         = float.Parse(txtNum1.Text) / float.Parse(txtNum2.Text);
            labANS.Text = Div.ToString();
        }
示例#31
0
        public virtual void DivWithBigRotatedParagraph()
        {
            String      outFileName = destinationFolder + "divBigRotatedParagraphTest01.pdf";
            String      cmpFileName = sourceFolder + "cmp_divBigRotatedParagraphTest01.pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName));
            Document    doc         = new Document(pdfDocument);
            String      str         = "Hello. I am a fairly long paragraph. I really want you to process me correctly. You heard that? Correctly!!! Even if you will have to wrap me.";
            Paragraph   p           = new Paragraph(new Text(str)).SetPadding(1f).SetBorder(new SolidBorder(ColorConstants.BLACK,
                                                                                                            2)).SetMargin(3).SetBackgroundColor(ColorConstants.LIGHT_GRAY).SetRotationAngle(Math.PI / 8);
            Div d = new Div().SetPadding(4f).SetBorder(new SolidBorder(ColorConstants.GREEN, 5)).SetMargin(6);

            d.Add(p);
            d.Add(new Paragraph(("iText")));
            MinMaxWidth result = ((AbstractRenderer)d.CreateRendererSubTree().SetParent(doc.GetRenderer())).GetMinMaxWidth
                                     ();

            d.SetWidth(ToEffectiveWidth(d, result.GetMinWidth()));
            doc.Add(d);
            doc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }
        public virtual void RunTest()
        {
            //TODO(DEVSIX-2979): Produces non-conforming PDF/A document
            String file     = "pdfABigNumber.pdf";
            String filename = destinationFolder + file;

            using (Stream icm = new FileStream(sourceFolder + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read
                                               )) {
                using (PdfADocument pdf = new PdfADocument(new PdfWriter(new FileStream(filename, FileMode.Create)), PdfAConformanceLevel
                                                           .PDF_A_3U, new PdfOutputIntent("Custom", "", "http://www.color.org", "sRGB ICC preference", icm))) {
                    using (Document document = new Document(pdf)) {
                        Div div = new Div();
                        div.SetMinWidth(float.MaxValue / 4);
                        div.SetMinHeight(100);
                        div.SetBackgroundColor(ColorConstants.LIGHT_GRAY);
                        document.Add(div);
                    }
                }
            }
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(filename, sourceFolder + "cmp_" + file, destinationFolder
                                                                             , "diff_"));
        }
示例#33
0
    /// <summary>
    /// Generates a list containing a grid of Divs based on the amount of padding and number of divs required.
    /// </summary>
    /// <param name="_xCount">The number of divs required on the X axis.</param>
    /// <param name="_yCount">The number of divs required on the Y axis.</param>
    /// <param name="_xPad">Amount of X padding in normalised screen space.</param>
    /// <param name="_yPad">Amount of Y padding in normalised screen space.</param>
    public void GenerateDivs(int _xCount, int _yCount, float _xPad, float _yPad, bool _outerOnly)
    {
        xCount = _xCount;
        yCount = _yCount;
        DeriveDivSize(_xPad, _yPad);

        for (int indexA = 0; indexA < xCount * yCount; ++indexA)
        {
            Div     curDivision = new Div();
            Vector2 coords      = DeriveCoords(indexA);         //This removes the need for a nested loop.

            //Check if the div is going to be on the outer edge.
            bool xIsOuter = (coords.x == 0 || coords.x == (xCount - 1));
            bool yIsOuter = (coords.y == 0 || coords.y == (yCount - 1));

            //If we're doing every division OR we're doing the outer divs and this div is on the outer edge.
            if (!_outerOnly || (_outerOnly && (xIsOuter || yIsOuter)))
            {
                //Calculate Bottom Left Bound on the X axis.
                float prevPad = _xPad * (1f + (coords.x * 2f));
                float prevDiv = xDivSize * coords.x;

                curDivision.bottomLeftBound.x = prevPad + prevDiv;

                //Calculate Bottom Left Bound on the Y axis.
                prevPad = _yPad * (1f + (coords.y * 2f));
                prevDiv = yDivSize * coords.y;

                curDivision.bottomLeftBound.y = prevPad + prevDiv;

                //Calculate Top Right Bounds by adding the known div sizes.
                curDivision.topRightBound.x = curDivision.bottomLeftBound.x + xDivSize;
                curDivision.topRightBound.y = curDivision.bottomLeftBound.y + yDivSize;

                //Add it to the list.
                divisions.Add(curDivision);
            }
        }
    }
示例#34
0
        public MultiSelectBox(Option[] options, int[] selectedIndexes = null, Action <MultiSelectBox> onSelectionChanged = null)
        {
            if (options != null && options.Length != 0)
            {
                Options = options;
            }

            _selectedIndexes = selectedIndexes;

            if (onSelectionChanged != null)
            {
                SelectionChanged += delegate
                {
                    onSelectionChanged(this);
                };
            }

            _checkBoxContainer = new DumpContainer();
            _divContainer      = new Div(_checkBoxContainer).SetClass("multi-select-box");

            VisualTree.Add(_divContainer);
        }
示例#35
0
        public virtual void ImageInRotatedBlockTest02()
        {
            String      outFileName = destinationFolder + "imageInRotatedBlockTest02.pdf";
            String      cmpFileName = sourceFolder + "cmp_imageInRotatedBlockTest02.pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName));
            Document    doc         = new Document(pdfDocument);

            iText.Layout.Element.Image image = new iText.Layout.Element.Image(ImageDataFactory.Create(sourceFolder + "Desert.jpg"
                                                                                                      ));
            image.SetWidth(200);
            Div div = new Div();

            div.SetHeight(100);
            div.SetRotationAngle(Math.PI / 2);
            div.SetBorder(new SolidBorder(ColorConstants.BLUE, 1));
            div.Add(image);
            doc.Add(div);
            doc.Add(new Paragraph("Hello!!!").SetBackgroundColor(ColorConstants.RED));
            doc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }
示例#36
0
        public virtual void InlineBlocksAndFloatsWithTextAlignmentTest02()
        {
            String      testName    = "inlineBlocksAndFloatsWithTextAlignmentTest02";
            String      outFileName = destinationFolder + testName + ".pdf";
            String      cmpFileName = sourceFolder + "cmp_" + testName + ".pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName));

            pdfDocument.SetTagged();
            Document  document    = new Document(pdfDocument);
            Paragraph parentPara  = new Paragraph().SetTextAlignment(TextAlignment.JUSTIFIED);
            Div       floatingDiv = new Div();

            floatingDiv.SetProperty(Property.FLOAT, FloatPropertyValue.RIGHT);
            parentPara.Add("Text begin").Add(new Div().Add(new Paragraph("div text").SetBorder(new SolidBorder(2)))).Add
                (floatingDiv.Add(new Paragraph("floating div text")).SetBorder(new SolidBorder(ColorConstants.GREEN, 2
                                                                                               ))).Add("MoretextMoretextMoretext. MoretextMoretextMoretext. MoretextMoretextMoretext. MoretextMoretextMoretext. MoretextMoretextMoretext. "
                                                                                                       );
            document.Add(parentPara.SetBorder(new DashedBorder(2)));
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diffTextAlign02_"));
        }
示例#37
0
        public virtual void ImageTest20()
        {
            String      outFileName = destinationFolder + "imageTest20.pdf";
            String      cmpFileName = sourceFolder + "cmp_imageTest20.pdf";
            PdfWriter   writer      = new PdfWriter(outFileName);
            PdfDocument pdfDoc      = new PdfDocument(writer);
            Document    doc         = new Document(pdfDoc);

            iText.Layout.Element.Image image = new iText.Layout.Element.Image(ImageDataFactory.Create(sourceFolder + "Desert.jpg"
                                                                                                      ));
            image.SetAutoScaleWidth(true);
            Div container = new Div();

            container.SetBorder(new SolidBorder(1f));
            container.SetWidth(UnitValue.CreatePercentValue(60f));
            container.SetHeight(UnitValue.CreatePointValue(300f));
            container.Add(image);
            doc.Add(container);
            doc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }
示例#38
0
        public virtual void BlockAlignmentTest02()
        {
            String          outFileName = destinationFolder + "blockAlignmentTest02.pdf";
            String          cmpFileName = sourceFolder + "cmp_blockAlignmentTest02.pdf";
            PdfDocument     pdfDocument = new PdfDocument(new PdfWriter(outFileName));
            Document        document    = new Document(pdfDocument);
            Div             div         = new Div();
            PdfImageXObject xObject     = new PdfImageXObject(ImageDataFactory.CreateJpeg(UrlUtil.ToURL(sourceFolder + "Desert.jpg"
                                                                                                        )));

            iText.Layout.Element.Image image1 = new iText.Layout.Element.Image(xObject, 100).SetHorizontalAlignment(HorizontalAlignment
                                                                                                                    .RIGHT);
            iText.Layout.Element.Image image2 = new iText.Layout.Element.Image(xObject, 100).SetHorizontalAlignment(HorizontalAlignment
                                                                                                                    .CENTER);
            iText.Layout.Element.Image image3 = new iText.Layout.Element.Image(xObject, 100).SetHorizontalAlignment(HorizontalAlignment
                                                                                                                    .LEFT);
            div.Add(image1).Add(image2).Add(image3);
            document.Add(div);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }
示例#39
0
        private Div GetPageElementPermAuthenticationViewParts(PageElement pageElement)
        {
            Div whoCanSeeDiv = new Div()
            {
                Class = { "form-group" }
            };

            Label whoCanSeeLabel = new Label()
            {
                Text = "Who can see this Element?", Class = { "d-block" }
            };
            RadioButton everyone = new RadioButton()
            {
                Inline  = true,
                Name    = "IsForAuthenticated",
                Value   = "false",
                Id      = "IsForAuthenticatedFalse",
                Text    = "Everyone",
                Checked = !pageElement.ForAuthenticatedOnly
            };

            RadioButton authenticatedOnly = new RadioButton()
            {
                Inline  = true,
                Name    = "IsForAuthenticated",
                Value   = "true",
                Id      = "IsForAuthenticatedTrue",
                Text    = "Authenticated Users Only",
                Checked = pageElement.ForAuthenticatedOnly
            };

            whoCanSeeDiv.Parts.AddRange(new List <ViewPart>()
            {
                whoCanSeeLabel,
                everyone,
                authenticatedOnly
            });
            return(whoCanSeeDiv);
        }
示例#40
0
        public virtual void FixedPositioningTest04()
        {
            String      outFileName = destinationFolder + "fixedPositioningTest04.pdf";
            String      cmpFileName = sourceFolder + "cmp_fixedPositioningTest04.pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName));
            Document    document    = new Document(pdfDocument);

            document.GetPdfDocument().AddNewPage();
            Div div = new Div().SetBackgroundColor(ColorConstants.LIGHT_GRAY).SetHeight(100).SetFixedPosition(1, 300,
                                                                                                              300, 100).Add(new Paragraph("Hello,  this is fairly long text. Lorem ipsum dolor sit amet, " + "consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna "
                                                                                                                                          + "aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex " +
                                                                                                                                          "ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu "
                                                                                                                                          + "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
                                                                                                                                          + "mollit anim id est laborum.").SetMargin(0));

            document.Add(div);
            new PdfCanvas(document.GetPdfDocument().GetPage(1)).SetStrokeColor(ColorConstants.BLACK).Rectangle(300, 300
                                                                                                               , 100, 100).Stroke().Release();
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }
        public virtual void CollapsingMarginsTest01()
        {
            String      outFileName = destinationFolder + "collapsingMarginsTest01.pdf";
            String      cmpFileName = sourceFolder + "cmp_collapsingMarginsTest01.pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFileName));

            DrawPageBorders(pdfDocument, 4);
            String textByron = "When a man hath no freedom to fight for at home,\n" + "    Let him combat for that of his neighbours;\n"
                               + "Let him think of the glories of Greece and of Rome,\n" + "    And get knocked on the head for his labours.\n"
                               + "\n" + "To do good to Mankind is the chivalrous plan,\n" + "    And is always as nobly requited;\n"
                               + "Then battle for Freedom wherever you can,\n" + "    And, if not shot or hanged, you'll get knighted.";
            Document doc = new Document(pdfDocument);

            doc.SetProperty(Property.COLLAPSING_MARGINS, true);
            doc.Add(new Paragraph("marker text").SetMargin(0));
            Paragraph p = new Paragraph(textByron);

            for (int i = 0; i < 5; i++)
            {
                p.Add(textByron);
            }
            Div div1 = new Div();
            Div div2 = new Div();

            div1.Add(p).SetBackgroundColor(new DeviceRgb(65, 151, 29));
            div2.Add(p).SetBackgroundColor(new DeviceRgb(209, 247, 29));
            div1.SetMarginBottom(20);
            div2.SetMarginTop(150);
            div2.SetMarginBottom(150);
            Div div = new Div().SetMarginTop(20).SetMarginBottom(10).SetBackgroundColor(new DeviceRgb(78, 151, 205));

            div.Add(div1);
            div.Add(div2);
            doc.Add(div);
            doc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }
示例#42
0
        //Fin para saber operacion.

        //Calcular resultado.
        private void ButFin_Click(object sender, EventArgs e)
        {
            //Variables de resultado
            Double Div;

            //Segundo valor.
            P2 = Double.Parse(TBScreen.Text);

            switch (Op)
            {
            case "+":
                TBScreen.Text = Operacionesbasicas.suma(P1, P2).ToString();
                break;

            case "-":
                TBScreen.Text = Operacionesbasicas.resta(P1, P2).ToString();
                break;

            case "*":
                TBScreen.Text = Operacionesbasicas.mult(P1, P2).ToString();
                break;

            case "/":
                Div = Operacionesbasicas.div(P1, P2);;
                if (Div != 0)
                {
                    TBScreen.Text = Div.ToString();
                }
                else
                {
                    MessageBox.Show("No se puede dividir entre 0.");
                }

                break;
            }

            LabelEstado.Text = "";
        }
        public void DirectNestedClassMatch_Test()
        {
            int priority;
            var defn = new StyleDefn();

            defn.Match = "doc:Div.green > doc:Para.blue";

            var div1 = new Div();

            div1.ElementName = "doc:Div";
            div1.StyleClass  = "red";

            var div2 = new Div();

            div2.ElementName = "doc:Div";
            div2.StyleClass  = "green";
            div1.Contents.Add(div2);

            var para = new Paragraph();

            para.ElementName = "doc:Para";
            para.StyleClass  = "blue";
            div2.Contents.Add(para);

            var result = defn.IsMatchedTo(para, out priority);

            Assert.IsTrue(result, "The inner para was not matched as expected");


            //Switch the parent to .red and parents parent to .green and it should not match
            //As not a direct parent

            div1.StyleClass = "green";
            div2.StyleClass = "red";

            result = defn.IsMatchedTo(div2, out priority);
            Assert.IsFalse(result, "The inner para was matched - not as expected");
        }
示例#44
0
        /// <summary>
        /// Builds the toolbar and attaches it to the page.
        /// Called once the DataQuery completes and the toolbar data is available.
        /// </summary>
        private void OnReturnToolbarData(DataQueryResult res)
        {
            ToolbarBuildContext context = (ToolbarBuildContext)res.ContextData;

            // Apply any extensions to the data.
            res.QueryData = ApplyDataExtensions(res.QueryData);

            Toolbar = BuildToolbarFromData(res.QueryData, context);
            Toolbar.ToolbarBuilder = this;
            BuildClient.OnComponentCreated(Toolbar, Toolbar.Id);
            Toolbar.RefreshInternal();

            Placeholder.AppendChild(Toolbar.ElementInternal);

            // If there's a jewel on the toolbar, position the left buttondock adjacent to it
            foreach (ButtonDock dock in Toolbar.Children)
            {
                if (dock.Alignment == DataNodeWrapper.LEFTALIGN)
                {
                    Div jewelContainer = (Div)Browser.Document.GetById("jewelcontainer");
                    if (!CUIUtility.IsNullOrUndefined(jewelContainer))
                    {
                        if (Toolbar.TextDirection == Direction.LTR)
                        {
                            dock.ElementInternal.Style.Left = jewelContainer.OffsetWidth + "px";
                        }
                        else
                        {
                            dock.ElementInternal.Style.Right = jewelContainer.OffsetWidth + "px";
                        }
                    }
                    break;
                }
            }

            Utility.EnsureCSSClassOnElement(Placeholder, "loaded");
            BuildClient.OnComponentBuilt(Toolbar, Toolbar.Id);
        }
示例#45
0
        Div cmdGetMain(ModuleInfo module)
        {
            var main = new Div(cls: "markdown-11q6EU");

            if (module == null)
            {
                main.Children.Add(msgBox("error", "There is no module by that name."));
                return(main);
            }
            main.Children.Add(linkHeader(1, module.Name));
            if (module.Summary != null)
            {
                main.Children.Add(docParagraph().WithRawText(module.Summary));
            }
            if (module.Preconditions.Count > 0)
            {
                main.Children.Add(explainPreconditions(true, module.Preconditions.ToArray()));
            }

            foreach (var x in module.Commands)
            {
                var req = new HttpReqUrl(x.Aliases.First(), x.Name);
                foreach (var param in x.Parameters)
                {
                    req.AddParam(param);
                }
                main.Children.Add(req.ToHtml());
                if (x.Summary != null)
                {
                    main.Children.Add(docParagraph().WithRawText(x.Summary));
                }
                if (x.Preconditions.Count > 0)
                {
                    main.Children.Add(explainPreconditions(false, x.Preconditions.ToArray()));
                }
            }
            return(main);
        }
示例#46
0
        private void BtnIgual_Click(object sender, EventArgs e)
        {
            segundo = double.Parse(txtScreen.Text);

            double Sum;
            double Res;
            double Mul;
            double Div;
            double Por;

            switch (operador)
            {
            case "+":
                Sum            = obj.Sumar((primero), (segundo));
                txtScreen.Text = Sum.ToString();
                break;

            case "-":
                Res            = obj2.Restar((primero), (segundo));
                txtScreen.Text = Res.ToString();
                break;

            case "/":
                Div            = obj4.Dividir((primero), (segundo));
                txtScreen.Text = Div.ToString();
                break;

            case "*":
                Mul            = obj3.Multiplicar((primero), (segundo));
                txtScreen.Text = Mul.ToString();
                break;

            case "%":
                Por            = obj5.Porcentaje((primero), (segundo));
                txtScreen.Text = Por.ToString();
                break;
            }
        }
示例#47
0
        public Node ExprMul()
        {
            var node = ExprUnary();

            while (firstOfExprMul.Contains(CurrentToken))
            {
                switch (CurrentToken)
                {
                case TokenCategory.MULTIPLICATION:
                    var node_mul = new Mul();
                    node_mul.AnchorToken = Expect(TokenCategory.MULTIPLICATION);
                    node_mul.Add(node);
                    node_mul.Add(ExprUnary());
                    node = node_mul;
                    break;

                case TokenCategory.MODULO:
                    var node_rem = new Rem();
                    node_rem.AnchorToken = Expect(TokenCategory.MODULO);
                    node_rem.Add(node);
                    node_rem.Add(ExprUnary());
                    node = node_rem;
                    break;

                case TokenCategory.DIVIDE:
                    var node_div = new Div();
                    node_div.AnchorToken = Expect(TokenCategory.DIVIDE);
                    node_div.Add(node);
                    node_div.Add(ExprUnary());
                    node = node_div;
                    break;

                default:
                    throw new SyntaxError(firstOfExprMul, tokenStream.Current);
                }
            }
            return(node);
        }
示例#48
0
        protected void ManipulatePdf(string dest)
        {
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(dest));
            Document    doc         = new Document(pdfDocument);

            String bigText = "Hello. I am a fairly long paragraph. I really want you to process me correctly."
                             + " You heard that? Correctly!!! Even if you will have to wrap me.";

            Style rotatedStyle = new Style().SetPadding(0).SetMargin(0).SetBorder(new SolidBorder(ColorConstants.BLUE,
                                                                                                  2)).SetBackgroundColor(ColorConstants.LIGHT_GRAY);
            Style contentStyle = new Style().SetPadding(0).SetMargin(0).SetBorder(new SolidBorder(ColorConstants.GREEN
                                                                                                  , 2)).SetWidth(400);

            LineSeparator line = new LineSeparator(new SolidLine(1));

            //width of rotated element isn't set, so it's width will be set automatically
            Div contentDiv = new Div().AddStyle(contentStyle);

            contentDiv.Add(new Paragraph("Short paragraph").AddStyle(rotatedStyle).SetRotationAngle(Math.PI * 3 / 8));
            contentDiv.Add(line);

            contentDiv.Add(new Paragraph(bigText).AddStyle(rotatedStyle).SetRotationAngle(Math.PI * 3 / 8));
            contentDiv.Add(line);

            contentDiv.Add(new Paragraph(bigText).AddStyle(rotatedStyle).SetRotationAngle(Math.PI / 30));
            doc.Add(contentDiv);

            doc.Add(new AreaBreak());

            //fixed width of rotated elements, so the content inside will be located according set width
            contentDiv = new Div().AddStyle(contentStyle).SetWidth(200);

            contentDiv.Add(new Paragraph(bigText).AddStyle(rotatedStyle).SetWidth(400).SetRotationAngle(Math.PI / 2));
            doc.Add(contentDiv);

            doc.Add(new Paragraph(bigText).AddStyle(rotatedStyle).SetWidth(800).SetRotationAngle(Math.PI / 30));
            doc.Close();
        }
        protected override void CreateChildControls()
        {
            this.txtBaseUrl = new ValidatingTextBox { DefaultText = "ex: http://tfsserver:80/tfs", Required = true };

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            ddlAuthentication = new DropDownList() { ID = "ddlAuthentication" };
            ddlAuthentication.Items.Add(new ListItem("System", "system"));
            ddlAuthentication.Items.Add(new ListItem("Specify account...", "specify"));

            var ffgAuthentication = new SlimFormField("Authentication:", ddlAuthentication);

            var ffgCredentials = new Div(
                new SlimFormField("User name:", this.txtUserName),
                new SlimFormField("Password:"******"Domain:", this.txtDomain)
            );

            this.Controls.Add(
                new SlimFormField("TFS URL:", this.txtBaseUrl),
                ffgAuthentication,
                ffgCredentials,
                new RenderJQueryDocReadyDelegator(
                    w =>
                    {
                        w.Write("$('#{0}').change(function(){{", this.ddlAuthentication.ClientID);
                        w.Write("if($(this).val() == 'system') $('#{0}').hide(); else $('#{0}').show();", ffgCredentials.ClientID);
                        w.Write("});");
                        w.Write("$('#{0}').change();", this.ddlAuthentication.ClientID);
                    }
                )
            );
        }
示例#50
0
        private void LoadDiv(Div divobj,TreeNode node)
        {
            TreeNode div = new TreeNode("Div");
            foreach (WatiN.Core.Div obj in divobj.Divs)
            {
                if (obj.Id != null && obj.Id.ToString() != "")
                {
                    TreeNode nodeD = new TreeNode(obj.Id);
                    nodeD.Nodes.Add(obj.Id, "Id = " + obj.Id);
                    nodeD.Nodes.Add(obj.Name, "Name = " + obj.Name);
                    nodeD.Nodes.Add(obj.ClassName, "ClassName = " + obj.ClassName);
                    //nodeD.Nodes.Add("Text = " + obj.Text);

                    //nodeB.Nodes.Add("Tilte = " + obj.Title.ToString());
                    div.Nodes.Add(nodeD);

                    TreeNode textBox1 = new TreeNode("TextBox");
                    foreach (WatiN.Core.TextField obj1 in obj.TextFields)
                    {
                        TreeNode nodeA1 = new TreeNode(obj1.Name);
                        nodeA1.Nodes.Add(obj1.Id, "Id = " + obj1.Id);
                        nodeA1.Nodes.Add(obj1.Name, "Name = " + obj1.Name);
                        nodeA1.Nodes.Add(obj1.ReadOnly.ToString(), "ReadOnly = " + obj1.ReadOnly.ToString());
                        nodeA1.Nodes.Add(obj1.Text, "Text = " + obj1.Text);
                        nodeA1.Nodes.Add(obj1.Value, "Value = " + obj1.Value);
                        textBox1.Nodes.Add(nodeA1);
                    }
                    nodeD.Nodes.Add(textBox1);
                    TreeNode button1 = new TreeNode("Button");
                    foreach (WatiN.Core.Button obj1 in obj.Buttons)
                    {
                        TreeNode nodeB1 = new TreeNode(obj1.Value);
                        nodeB1.Nodes.Add(obj1.Id, "Id = " + obj1.Id);
                        nodeB1.Nodes.Add(obj1.Text, "ClassName = " + obj1.ClassName);
                        nodeB1.Nodes.Add(obj1.Text, "Text = " + obj1.Text);
                        nodeB1.Nodes.Add(obj1.Value, "Value = " + obj1.Value);
                        //nodeB.Nodes.Add("Tilte = " + obj.Title.ToString());
                        button1.Nodes.Add(nodeB1);
                    }
                    nodeD.Nodes.Add(button1);
                    TreeNode link1 = new TreeNode("Link");
                    foreach (WatiN.Core.Link obj1 in obj.Links)
                    {
                        //if (obj.ClassName != null && obj.ClassName.ToString() != "")
                        {
                            TreeNode nodeL1 = new TreeNode(obj1.Text);
                            nodeL1.Nodes.Add("Id = " + obj1.Id);
                            nodeL1.Nodes.Add("Value = " + obj1.Name);
                            nodeL1.Nodes.Add("Text = " + obj1.Text);
                            nodeL1.Nodes.Add("Link = " + obj1.Url);
                            nodeL1.Nodes.Add("Class = " + obj1.ClassName);
                            //nodeB.Nodes.Add("Tilte = " + obj.Title.ToString());
                            link1.Nodes.Add(nodeL1);
                        }
                    }
                    nodeD.Nodes.Add(link1);
                    LoadDiv(obj, nodeD);


                }
            }
            node.Nodes.Add(div);
        }
示例#51
0
		void Paint(Element parent)
		{	
			new Div(parent, div=>{
				div.ClassName="span6 offset3 well";
				div.Hide();
			}) ;
			
			SearchDiv= new Div(default(Element), searchdiv=>{
				searchdiv.ClassName= "span6 offset3 nav";

				var inputFecha=new InputText(searchdiv, ip=>{
					ip.ClassName="input-medium search-query";
					ip.SetAttribute("data-mask","99.99.9999");
					ip.SetPlaceHolder("dd.mm.aaaa");
				}).Element(); 
				
				new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-search icon-large";
					abn.JSelect().Click(evt=>{
						if( ! inputFecha.Value.IsDateFormatted()){
							Div.CreateAlertErrorAfter(SearchDiv.Element(),"Digite una fecha valida");
							return;
						}
						LoadGastos( inputFecha.Value.ToServerDate() );

					});
				});

				BNew= new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-plus-sign icon-large";
					abn.JSelect().Click(evt=>{
						FormDiv.FadeIn();
						GridDiv.FadeOut();
						Form.Element().Reset();
						BDelete.Element().Disabled=true;
					});
				});

				BDelete=new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-remove-sign icon-large";
					abn.Disabled=true;
					abn.JSelect().Click(evt=>{
						RemoveRow();
					});
				});

				BList= new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-reorder icon-large";
					abn.Disabled=true;
					abn.JSelect().Click(evt=>{
						FormDiv.FadeOut();
						GridDiv.FadeIn();
						abn.Disabled=true;
					});
				});
				
			});
			SearchDiv.AppendTo(parent);
			
			
			FormDiv= new Div(default(Element), formdiv=>{
				formdiv.ClassName="span6 offset3 well";
				Form = new Form(formdiv, f=>{
					f.ClassName="form-horizontal";
					f.Action="api/Gasto/";
					f.Method="post";

					var inputId= new InputText(f, e=>{
						e.Name="Id";
						e.Hide();
					}); 

					var cbConcepto=new SelectField(f, (e)=>{
						e.Name="IdConcepto";
						e.ClassName="span12";
						new HtmlOption(e, o=>{
							o.Value="";
							o.Selected=true;
							o.Text="Seleccione el concepto ...";
						});											
						LoadConceptos(e);
					});
					
					var cbFuente= new SelectField(f, (e)=>{
						e.Name="IdFuente";
						e.ClassName="span12";
						new HtmlOption(e, o=>{
							o.Value="";
							o.Selected=true;
							o.Text="Seleccione la fuente de pago ...";
						});											
						LoadFuentes(e);
					});
					
					var fieldValor= new TextField(f,(field)=>{
						field.ClassName="span12";
						field.Name="Valor";
						field.SetPlaceHolder("$$$$$$$$$$");
						field.AutoNumericInit();
						field.Style.TextAlign="right";
					});
					
					new TextField(f,(field)=>{
						field.ClassName="span12";
						field.Name="Beneficiario";
						field.SetPlaceHolder("Pagado a ....");
					});
					
					new TextField(f,(field)=>{
						field.ClassName="span12";
						field.Name="Descripcion";
						field.SetPlaceHolder("Descripcion");
					});
										
					var bt = new SubmitButton(f, b=>{
						b.JSelect().Text("Guardar");
						b.LoadingText(" Guardando ...");
						b.ClassName="btn btn-info btn-block" ;
					});
					
					var vo = new ValidateOptions()
						.SetSubmitHandler( form=>{
							
							bt.ShowLoadingText();

							var action= form.Action+(string.IsNullOrEmpty(inputId.Value())?"create":"update");
							jQuery.PostRequest<BLResponse<Gasto>>(action, form.AutoNumericGetString(), cb=>{},"json")
								.Success(d=>{
									Cayita.Javascript.Firebug.Console.Log("Success guardar gasto",d);
									if(string.IsNullOrEmpty(inputId.Value()) )
										AppendRow(d.Result[0]);
									else
										UpdateRow(d.Result[0]);

									form.Reset();
								})
									.Error((request,  textStatus,  error)=>{
										Cayita.Javascript.Firebug.Console.Log("request", request );
										Cayita.Javascript.Firebug.Console.Log("error", error );
										Div.CreateAlertErrorBefore(form.Elements[0],
										                           textStatus+": "+ request.StatusText);
									})
									.Always(a=>{
										bt.ResetLoadingText();
									});
							
						})
							.AddRule((rule, msg)=>{
								rule.Element=fieldValor.Element();
								rule.Rule.Required();
								msg.Required("Digite el valor del gasto");
							})

							.AddRule((rule, msg)=>{
								rule.Element=cbConcepto.Element();
								rule.Rule.Required();
								msg.Required("Seleccione el concepto");
							})
							
							.AddRule((rule, msg)=>{
								rule.Element=cbFuente.Element();
								rule.Rule.Required();
								msg.Required("Seleccione al fuente del pago");
							});
					
					f.Validate(vo);				
				});
			});

			FormDiv.AppendTo(parent);
						
			GridDiv= new  Div(default(Element), gdiv=>{
				gdiv.ClassName="span10 offset1";

				TableGastos= new HtmlTable(gdiv, table=>{
					InitTable (table);
				});	
				gdiv.Hide();
			});

			GridDiv.AppendTo(parent);	
		}
 public Div Div()
 {
     Div d = new Div();
     Divs.Add(d);
     return d;
 }
示例#53
0
        // Generates content of webSettingsPart1.
        private void GenerateWebSettingsPart1Content(WebSettingsPart webSettingsPart1)
        {
            WebSettings webSettings1 = new WebSettings() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 w16se" } };
            webSettings1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            webSettings1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            webSettings1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            webSettings1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            webSettings1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
            webSettings1.AddNamespaceDeclaration("w16se", "http://schemas.microsoft.com/office/word/2015/wordml/symex");

            Divs divs1 = new Divs();

            Div div1 = new Div() { Id = "198011547" };
            BodyDiv bodyDiv1 = new BodyDiv() { Val = true };
            LeftMarginDiv leftMarginDiv1 = new LeftMarginDiv() { Val = "60" };
            RightMarginDiv rightMarginDiv1 = new RightMarginDiv() { Val = "60" };
            TopMarginDiv topMarginDiv1 = new TopMarginDiv() { Val = "60" };
            BottomMarginDiv bottomMarginDiv1 = new BottomMarginDiv() { Val = "15" };

            DivBorder divBorder1 = new DivBorder();
            TopBorder topBorder90 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            LeftBorder leftBorder89 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            BottomBorder bottomBorder95 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            RightBorder rightBorder89 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };

            divBorder1.Append(topBorder90);
            divBorder1.Append(leftBorder89);
            divBorder1.Append(bottomBorder95);
            divBorder1.Append(rightBorder89);

            DivsChild divsChild1 = new DivsChild();

            Div div2 = new Div() { Id = "1885019551" };
            LeftMarginDiv leftMarginDiv2 = new LeftMarginDiv() { Val = "0" };
            RightMarginDiv rightMarginDiv2 = new RightMarginDiv() { Val = "0" };
            TopMarginDiv topMarginDiv2 = new TopMarginDiv() { Val = "0" };
            BottomMarginDiv bottomMarginDiv2 = new BottomMarginDiv() { Val = "0" };

            DivBorder divBorder2 = new DivBorder();
            TopBorder topBorder91 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            LeftBorder leftBorder90 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            BottomBorder bottomBorder96 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            RightBorder rightBorder90 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };

            divBorder2.Append(topBorder91);
            divBorder2.Append(leftBorder90);
            divBorder2.Append(bottomBorder96);
            divBorder2.Append(rightBorder90);

            div2.Append(leftMarginDiv2);
            div2.Append(rightMarginDiv2);
            div2.Append(topMarginDiv2);
            div2.Append(bottomMarginDiv2);
            div2.Append(divBorder2);

            Div div3 = new Div() { Id = "1927107593" };
            LeftMarginDiv leftMarginDiv3 = new LeftMarginDiv() { Val = "0" };
            RightMarginDiv rightMarginDiv3 = new RightMarginDiv() { Val = "0" };
            TopMarginDiv topMarginDiv3 = new TopMarginDiv() { Val = "0" };
            BottomMarginDiv bottomMarginDiv3 = new BottomMarginDiv() { Val = "0" };

            DivBorder divBorder3 = new DivBorder();
            TopBorder topBorder92 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            LeftBorder leftBorder91 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            BottomBorder bottomBorder97 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            RightBorder rightBorder91 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };

            divBorder3.Append(topBorder92);
            divBorder3.Append(leftBorder91);
            divBorder3.Append(bottomBorder97);
            divBorder3.Append(rightBorder91);

            div3.Append(leftMarginDiv3);
            div3.Append(rightMarginDiv3);
            div3.Append(topMarginDiv3);
            div3.Append(bottomMarginDiv3);
            div3.Append(divBorder3);

            divsChild1.Append(div2);
            divsChild1.Append(div3);

            div1.Append(bodyDiv1);
            div1.Append(leftMarginDiv1);
            div1.Append(rightMarginDiv1);
            div1.Append(topMarginDiv1);
            div1.Append(bottomMarginDiv1);
            div1.Append(divBorder1);
            div1.Append(divsChild1);

            Div div4 = new Div() { Id = "1653750813" };
            LeftMarginDiv leftMarginDiv4 = new LeftMarginDiv() { Val = "0" };
            RightMarginDiv rightMarginDiv4 = new RightMarginDiv() { Val = "0" };
            TopMarginDiv topMarginDiv4 = new TopMarginDiv() { Val = "0" };
            BottomMarginDiv bottomMarginDiv4 = new BottomMarginDiv() { Val = "0" };

            DivBorder divBorder4 = new DivBorder();
            TopBorder topBorder93 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            LeftBorder leftBorder92 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            BottomBorder bottomBorder98 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            RightBorder rightBorder92 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };

            divBorder4.Append(topBorder93);
            divBorder4.Append(leftBorder92);
            divBorder4.Append(bottomBorder98);
            divBorder4.Append(rightBorder92);

            div4.Append(leftMarginDiv4);
            div4.Append(rightMarginDiv4);
            div4.Append(topMarginDiv4);
            div4.Append(bottomMarginDiv4);
            div4.Append(divBorder4);

            divs1.Append(div1);
            divs1.Append(div4);
            OptimizeForBrowser optimizeForBrowser1 = new OptimizeForBrowser();
            RelyOnVML relyOnVML1 = new RelyOnVML();
            AllowPNG allowPNG1 = new AllowPNG();

            webSettings1.Append(divs1);
            webSettings1.Append(optimizeForBrowser1);
            webSettings1.Append(relyOnVML1);
            webSettings1.Append(allowPNG1);

            webSettingsPart1.WebSettings = webSettings1;
        }
示例#54
0
		public static void Execute (Atom parent){

			Task v= new Task( ()=> Firebug.Console.Log("hello"));
			v.Start ();

			var store = new UserStore ();
			var grid = new UserGrid (parent, store);
			store.Read ();

			var form = new UserForm (parent);

			form.ButtonCreate.Disabled = false;

			form.ButtonCreate.Clicked+= (e) => {
				grid.ClearSelection();
				form.Clear();
			};

			form.ButtonDestroy.Clicked+= (e) => {
				form.Clear();
				var u = store.First(r=>r.Id== int.Parse( grid.SelectedRow.RecordId ));
				store.Remove(u);
			};

			form.Changed+= (e) => {
				form.ButtonSave.Disabled= !form.HasChanges();
			};
				
			form.Updated += (fr, ac) => {
				form.ButtonDestroy.Disabled= ac == FormUpdatedAction.Clear;
				form.ButtonSave.Disabled=true;
			};

			form.SubmitHandler = fr => SubmitHandler (grid, form, store);

			grid.RowSelected += (g, row) => {
				var u =  store.First(r=>r.Id== int.Parse( row.RecordId));
				form.PopulateFrom(u);
			};


			parent.Append("Paged Tables".Header (3));


			var cu = new CustomerStore ();
			new CustomerGrid(parent, cu);
			parent.Append (new StorePager<Customer>(cu));
			cu.Read ();


			parent.Append ("Filters".Header (3));
			var cu2 = new CustomerStore ();
			new TextInput (parent, i=>	{	
				i.Placeholder="Country";
				i.On("keyup", evt=>{
					var st = i.Value.ToUpper();
					cu2.Filter( f=>f.Country.ToUpper().StartsWith(st));
				});
			});

			new CustomerGrid (parent,  cu2);
			parent.Append (new StorePager<Customer>(cu2));
			cu2.Read ();

			parent.Append ("C# code".Header(3));

			var rq =jQuery.GetData<string> ("code/demotables.html");
			rq.Done (s=> {
				var code=new Div();
				code.InnerHTML= s;
				parent.Append(code);
			});



		}
        protected override void CreateChildControls()
        {
            this.txtBaseUrl = new ValidatingTextBox
            {
                DefaultText = "ex: http://tfsserver:80/tfs",
                Required = true
            };

            this.txtCustomReleaseNumberFieldName = new ValidatingTextBox { DefaultText = "iteration" };

            this.txtUserName = new ValidatingTextBox();

            this.txtDomain = new ValidatingTextBox();

            this.txtPassword = new PasswordTextBox();

            this.chkAllowHtml = new CheckBox { Text = "Allow HTML in issue descriptions" };

            this.txtCustomClosedStates = new ValidatingTextBox()
            {
                TextMode = TextBoxMode.MultiLine,
                Rows = 3,
                DefaultText = "Closed\r\nResolved"
            };

            ddlAuthentication = new DropDownList
            {
                ID = "ddlAuthentication",
                Items =
                {
                    new ListItem("System", "system"),
                    new ListItem("Specify account...", "specify")
                }
            };

            this.ddlUseWiql = new DropDownList
            {
                ID = "ddlUseWiql",
                Items =
                {
                    new ListItem("Not using a custom query", "False"),
                    new ListItem("Custom WIQL query", "True")
                }
            };

            var ffgAuthentication = new SlimFormField("Authentication:", ddlAuthentication);

            var ffgCredentials = new Div(
                new SlimFormField("User name:", this.txtUserName),
                new SlimFormField("Password:"******"Domain:", this.txtDomain)
            );

            this.txtWiql = new ValidatingTextBox
            {
                TextMode = TextBoxMode.MultiLine,
                Rows = 5
            };

            var ctlWiql = new SlimFormField("WIQL query:", this.txtWiql)
            {
                HelpText = "This will be sent to TFS directly, after BuildMaster variables have been replaced. This WIQL query should return all issues "
                         + "for the current BuildMaster release. Any release-level or higher BuildMaster variables may be used in this query."
            };

            var ctlNoWiql = new SlimFormField("Release number field:", this.txtCustomReleaseNumberFieldName)
            {
                HelpText = HelpText.FromHtml("If you store your TFS work item release numbers in a custom field, enter the full field \"refname\" of the custom field here - otherwise leave this field blank and \"Iteration\" will be used to retrieve them.<br /><br />For more information on custom work item types, visit <a href=\"http://msdn.microsoft.com/en-us/library/ms400654.aspx\" target=\"_blank\">http://msdn.microsoft.com/en-us/library/ms400654.aspx</a>")
            };

            this.Controls.Add(
                new SlimFormField("TFS URL:", this.txtBaseUrl),
                ffgAuthentication,
                ffgCredentials,
                new SlimFormField("Query mode:", this.ddlUseWiql),
                ctlNoWiql,
                ctlWiql,
                new SlimFormField("Options:", this.chkAllowHtml),
                new RenderJQueryDocReadyDelegator(
                    w =>
                    {
                        w.Write("$('#{0}').change(function(){{", this.ddlAuthentication.ClientID);
                        w.Write("if($(this).val() == 'system') $('#{0}').hide(); else $('#{0}').show();", ffgCredentials.ClientID);
                        w.Write("});");
                        w.Write("$('#{0}').change();", this.ddlAuthentication.ClientID);

                        w.Write("$('#{0}').change(function(){{", this.ddlUseWiql.ClientID);
                        w.Write("if($(this).val() == 'False') {{ $('#{0}').hide(); $('#{1}').show(); }} else {{ $('#{0}').show(); $('#{1}').hide(); }}", ctlWiql.ClientID, ctlNoWiql.ClientID);
                        w.Write("});");
                        w.Write("$('#{0}').change();", this.ddlUseWiql.ClientID);
                    }
                ),
                new SlimFormField("Closed statuses:", this.txtCustomClosedStates)
                {
                    HelpText = "The newline-separated list of issue states in TFS that BuildMaster will use to determine if a synchronized issue is closed."
                }
            );
        }
示例#56
0
文件: RibbonBar.cs 项目: biganth/Curt
        /// <summary>
        /// Returns a item from a telerik "select list" element
        /// </summary>
        /// <param name="comboBoxLink">The link object that expands the drop down. Ex. ModuleComboBox</param>
        /// <param name="comboBoxDiv">The div object containing all of the list items for the drop down. Ex. ModuleSelectDiv</param>
        /// <param name="selectListClass">The class to filter all of the items within the comboBoxDiv by. 
        /// The currently selected item will have the class "rcbHovered ", all others will have the class "rcbItem ".</param>
        /// <param name="ItemText">The text of the item in the drop down.</param>
        /// <returns>The list item from the drop down, considered an Element object instead of a list item.</returns>
        public Element GetItemFromTelerikComboBox(Link comboBoxLink, Div comboBoxDiv, string selectListClass, string ItemText)
        {
            //Click Drop down
            comboBoxLink.Click();

            System.Threading.Thread.Sleep(1500);
            //Find Item to Select
            //Find all List Item elements that match the class
            ElementCollection selectListElements = comboBoxDiv.Elements.Filter(Find.ByClass(selectListClass));
            Element result = null;
            //Search for the desired Element
            foreach (Element e in selectListElements)
            {
                if (e.InnerHtml.Contains(ItemText))
                {
                    //Found the Element
                    result = e;
                    break;
                }
                continue;
            }
            return result;
        }
示例#57
0
文件: Memo.cs 项目: crazytan/Memo
        // Generates content of webSettingsPart1.
        private static void GenerateWebSettingsPart1Content(WebSettingsPart webSettingsPart1)
        {
            WebSettings webSettings1 = new WebSettings() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15" } };
            webSettings1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            webSettings1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            webSettings1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            webSettings1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            webSettings1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");

            Divs divs1 = new Divs();

            Div div1 = new Div() { Id = "714617678" };
            BodyDiv bodyDiv1 = new BodyDiv() { Val = true };
            LeftMarginDiv leftMarginDiv1 = new LeftMarginDiv() { Val = "0" };
            RightMarginDiv rightMarginDiv1 = new RightMarginDiv() { Val = "0" };
            TopMarginDiv topMarginDiv1 = new TopMarginDiv() { Val = "0" };
            BottomMarginDiv bottomMarginDiv1 = new BottomMarginDiv() { Val = "0" };

            DivBorder divBorder1 = new DivBorder();
            TopBorder topBorder2 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            LeftBorder leftBorder2 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            BottomBorder bottomBorder3 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            RightBorder rightBorder2 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };

            divBorder1.Append(topBorder2);
            divBorder1.Append(leftBorder2);
            divBorder1.Append(bottomBorder3);
            divBorder1.Append(rightBorder2);

            div1.Append(bodyDiv1);
            div1.Append(leftMarginDiv1);
            div1.Append(rightMarginDiv1);
            div1.Append(topMarginDiv1);
            div1.Append(bottomMarginDiv1);
            div1.Append(divBorder1);

            divs1.Append(div1);
            OptimizeForBrowser optimizeForBrowser1 = new OptimizeForBrowser();
            RelyOnVML relyOnVML1 = new RelyOnVML();
            AllowPNG allowPNG1 = new AllowPNG();

            webSettings1.Append(divs1);
            webSettings1.Append(optimizeForBrowser1);
            webSettings1.Append(relyOnVML1);
            webSettings1.Append(allowPNG1);

            webSettingsPart1.WebSettings = webSettings1;
        }
示例#58
0
 protected override void Initialize()
 {
     //Tamanho da Tela
     graphics.PreferredBackBufferWidth = 1024;
     graphics.PreferredBackBufferHeight = 768;
     graphics.ApplyChanges();
     spriteBatch = new SpriteBatch(GraphicsDevice);
     spriteBatch.Begin();
     spriteBatch.Draw(Content.Load<Texture2D>("loading"), new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2), Color.White);
         Log = new Text.RealText.Login(this, Content.Load<SpriteFont>("font3"));
         teste = new Connection();
         Time = new Tempo();
         Time.globHighscore = teste.getHighscore();
         Time.globNome = teste.getName();
         Game1 = new Jogo1(Content.Load<Texture2D>("Inimigo"), Content.Load<Texture2D>("Nave"));
         Game2 = new Jogo2(Content.Load<Texture2D>("Ball"));
         Game3 = new Jogo3();
         Game4 = new Jogo4(Content.Load<Texture2D>("Inimigo"), Content.Load<Texture2D>("mouse"));
         Game5 = new Jogo5(Content.Load<Texture2D>("Inimigo"), Content.Load<Texture2D>("Nave"), Content.Load<Texture2D>("Tiro"));
         Game6 = new Jogo6(Content.Load<Texture2D>("Inimigo"), Content.Load<Texture2D>("mouse"));
         Divs = new Div();
         register = false;
     spriteBatch.End();
     base.Initialize();
 }
        protected override void CreateChildControls()
        {
            this.ddlProjectBuildConfiguration = new DropDownList()
            {
                Items =
                {
                    new ListItem("Debug", "Debug"),
                    new ListItem("Release", "Release"),
                    new ListItem("Other...", "Other")
                }
            };

            this.txtOtherConfig = new ValidatingTextBox() { Width = 150 };
            this.divConfig = new Div() { ID = "divConfig" };
            this.divConfig.Controls.Add(this.txtOtherConfig);

            this.txtProjectPath = new ValidatingTextBox() { Width = 300, Required = true };

            this.txtAdditionalArguments = new ValidatingTextBox() { Width = 300 };

            this.Controls.Add(
                new FormFieldGroup("Project or Solution File Path",
                    "The path to the MVC project file or solution file.<br /><br />This path may be absolute or relative to the default directory.",
                    false,
                    new StandardFormField("Project File:", this.txtProjectPath)
                ),
                new FormFieldGroup("Project Build Configuration",
                    "The build configuration and platform for your project (usually either Debug or Release).",
                    false,
                    new StandardFormField("Project Build Configuration:", this.ddlProjectBuildConfiguration, this.divConfig)
                ),
                new FormFieldGroup("Additional Arguments",
                    "Any additional arguments to pass to MSBuild.",
                    false,
                    new StandardFormField("Additional Arguments:", this.txtAdditionalArguments)
                )
            );
        }
        protected override void CreateChildControls()
        {
            this.txtExePath = new SourceControlFileFolderPicker
            {
                Required = true,
                DefaultText = @"ex: C:\Program Files\Example\MyExampleService.exe"
            };

            this.txtArguments = new ValidatingTextBox { DefaultText = "none" };

            this.txtServiceName = new ValidatingTextBox { Required = true };

            this.txtDisplayName = new ValidatingTextBox { Required = true };

            this.txtDescription = new ValidatingTextBox { DefaultText = "none" };

            this.txtUserAccount = new ValidatingTextBox { DefaultText = "NT AUTHORITY\\LocalSystem" };

            this.txtPassword = new PasswordTextBox();

            this.chkRecreate = new CheckBox
            {
                Text = "Reinstall if a service with the same name is already installed"
            };

            var ctlRecreateContainer = new Div(this.chkRecreate) { ID = "ctlRecreateContainer" };

            this.chkErrorIfAlreadyInstalled = new CheckBox
            {
                ID = "chkErrorIfAlreadyInstalled",
                Text = "Log error if service with same name is already installed"
            };

            this.Controls.Add(
                new SlimFormField("Service executable:", this.txtExePath),
                new SlimFormField("Executable arguments:", this.txtArguments),
                new SlimFormField("Service name:", this.txtServiceName),
                new SlimFormField("Service display name:", this.txtDisplayName),
                new SlimFormField("Service description:", this.txtDescription),
                new SlimFormField("User account:", this.txtUserAccount)
                {
                    HelpText = HelpText.FromHtml("Supply a user account which the service will run as. <i>NT AUTHORITY\\LocalSystem</i> is used if an account is not supplied. " +
                        "To use Network Service, enter <i>NT AUTHORITY\\NetworkService</i>.<br/><br/>" +
                        "If a built in service account is used, leave the password field blank.")
                },
                new SlimFormField("User account password:"******"Options:",
                    new Div(this.chkErrorIfAlreadyInstalled),
                    ctlRecreateContainer
                ),
                new RenderJQueryDocReadyDelegator(
                    w =>
                    {
                        w.Write(
                            "$('#{0}').change(function(){{if($(this).attr('checked')) $('#{1}').hide(); else $('#{1}').show();}});",
                            this.chkErrorIfAlreadyInstalled.ClientID,
                            ctlRecreateContainer.ClientID
                        );

                        w.Write("$('#{0}').change();", this.chkErrorIfAlreadyInstalled.ClientID);
                    }
                )
            );
        }