public void TestControlTypes() { TextControl textControl = new TextControl(); Assert.AreEqual(ControlType.Text, textControl.Type); ComboControl comboControl = new ComboControl(); Assert.AreEqual(ControlType.Combo, comboControl.Type); RadioControl radioControl = new RadioControl(); Assert.AreEqual(ControlType.Radio, radioControl.Type); CheckboxControl checkboxControl = new CheckboxControl(); Assert.AreEqual(ControlType.Checkbox, checkboxControl.Type); CheckboxGroupControl checkboxGroupControl = new CheckboxGroupControl(); Assert.AreEqual(ControlType.CheckboxGroup, checkboxGroupControl.Type); DateControl dateControl = new DateControl(); Assert.AreEqual(ControlType.Date, dateControl.Type); TimeControl timeControl = new TimeControl(); Assert.AreEqual(ControlType.Time, timeControl.Type); FileBrowserControl fileBrowserControl = new FileBrowserControl(); Assert.AreEqual(ControlType.FileBrowser, fileBrowserControl.Type); HiddenControl hiddenControl = new HiddenControl(); Assert.AreEqual(ControlType.Hidden, hiddenControl.Type); LabelControl labelControl = new LabelControl(); Assert.AreEqual(ControlType.Label, labelControl.Type); HtmlControl htmlControl = new HtmlControl(); Assert.AreEqual(ControlType.Html, htmlControl.Type); GroupControl groupControl = new GroupControl(); Assert.AreEqual(ControlType.Group, groupControl.Type); RepeaterControl repeaterControl = new RepeaterControl(); Assert.AreEqual(ControlType.Repeater, repeaterControl.Type); CalculationControl calculationControl = new CalculationControl(); Assert.AreEqual(ControlType.Calculation, calculationControl.Type); SignaturePadControl signaturePadControl = new SignaturePadControl(); Assert.AreEqual(ControlType.SignaturePad, signaturePadControl.Type); GeolocationControl geolocationControl = new GeolocationControl(); Assert.AreEqual(ControlType.Geolocation, geolocationControl.Type); HeadingControl headingControl = new HeadingControl(); Assert.AreEqual(ControlType.Heading, headingControl.Type); }
/// <summary> /// Writes the value of the geolocation to the table as an image. /// </summary> /// <param name="table">The <see cref="MigraDoc.DocumentObjectModel.Tables.Table"/> to write to.</param> /// <param name="control">The control.</param> /// <param name="container">The application data container.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> private void WriteValueGeolocation(Table table, GeolocationControl control, Dictionary<string, object> container, int level) { if (control.DisplayStyle == GeolocationDisplayStyle.None) { return; } Row row = table.AppendRow(this.DefaultStyle.Font.Size, control.Label, string.Empty); row.Cells[0].Format.LeftIndent = new Unit(PdfConstants.IndentMultiplier * level, UnitType.Millimeter); string coords = container[control.Name].ToString(); if (control.DisplayStyle == GeolocationDisplayStyle.Both || control.DisplayStyle == GeolocationDisplayStyle.Coordinates) { row.Cells[1].AddParagraph(coords); } if (control.DisplayStyle != GeolocationDisplayStyle.Both && control.DisplayStyle != GeolocationDisplayStyle.Map) { return; } string path = this.GetTemporaryFileName("png"); Coordinate coordinate = Coordinate.Parse(coords); GoogleMapProvider provider = new GoogleMapProvider(); using (FileStream fileStream = new FileStream(path, FileMode.Create)) { provider.Write(coordinate, new Size(225, 225), fileStream); } row.Cells[1].AddParagraph().AddImage(path); }