private void SetPositioningType(PositioningType positioningType) { string cssPositionType; switch (positioningType) { case PositioningType.Absolute: cssPositionType = "absolute"; break; case PositioningType.Fixed: cssPositionType = "fixed"; break; case PositioningType.Relative: cssPositionType = "relative"; break; case PositioningType.Static: cssPositionType = "static"; break; default: cssPositionType = "static"; break; } InternalJQElement.Css("position", cssPositionType); }
private Point GetConstantPosition() { var left = InternalJQElement.Css <int>("left"); var top = InternalJQElement.Css <int>("top"); return(new Point(left, top)); }
private void SetFontStyle(FontStyle newFontStyle) { InternalJQElement.Css("font-size", newFontStyle.FontSize + "pt"); InternalJQElement.Css("font-weight", newFontStyle.FontWeight.ToString().ToLower()); _fontStyle = newFontStyle; }
public override void PerformLayout() { base.PerformLayout(); Action <object, string, string> fileOpenAction = (jsBlob, textContent, dataUrl) => { var eventArgs = new FileUploadEventArgs(jsBlob, textContent, dataUrl); FileOpened?.Invoke(this, eventArgs); Command?.Execute(new ICommandParameter(eventArgs)); }; Action <object> changeAction = evt => { var input = Verbatim.Expression("evt.target"); var file = Verbatim.Expression("$0.files[0]", input); FileName = (string)Verbatim.Expression("$0.name", file); var reader = Verbatim.Expression("new FileReader()"); Action onLoadAction = () => { var jsBlob = Verbatim.Expression("$0.result", reader); //string fileMimeType = (string)Verbatim.Expression("$0.type", file); string textContent = null; string dataUrl = null; switch (UploadType) { case FileUploadType.TextFile: switch (FileEncoding) { case FileReaderEncoding.ASCII: textContent = jsBlob as string; break; case FileReaderEncoding.UTF8: textContent = BufferConverter.ArrayBufferToStringUTF8(jsBlob); break; case FileReaderEncoding.UTF16: textContent = BufferConverter.ArrayBufferToStringUTF16(jsBlob); break; } break; case FileUploadType.ImageFile: dataUrl = jsBlob as string; break; } fileOpenAction(jsBlob, textContent, dataUrl); }; Verbatim.Expression("$0.onload = $1", reader, onLoadAction); switch (UploadType) { case FileUploadType.TextFile: case FileUploadType.BinaryFile: if (FileEncoding == FileReaderEncoding.ASCII) { Verbatim.Expression("$0.readAsText($1);", reader, file); } else { Verbatim.Expression("$0.readAsArrayBuffer($1);", reader, file); } break; case FileUploadType.ImageFile: Verbatim.Expression("$0.readAsDataURL($1);", reader, file); break; } }; InternalJQElement.BindEventListener("change", changeAction); }
/// <summary> /// Triggers the click event on the control /// </summary> public void SimulateClick() => InternalJQElement.Trigger("click");
/// <summary> /// Shows the control. Is equivalent to settings Visible to True /// </summary> public void Show() => InternalJQElement.Show();
/// <summary> /// Hides the control. Is equivalent to settings Visible to False /// </summary> public void Hide() => InternalJQElement.Hide();
/// <summary> /// Fades out the control. For more control over the animation, call an overload of Control.InternalJQElement.FadeOut /// </summary> public void FadeOut() => InternalJQElement.FadeOut();
/// <summary> /// Fades in the control. For more control over the animation, call an overload of Control.InternalJQElement.FadeIn /// </summary> public void FadeIn() => InternalJQElement.FadeIn();
private void SetRelativePosition(RelativePoint position) { InternalJQElement.Css("left", position.X); InternalJQElement.Css("top", position.Y); }
private void SetConstantPosition(Point position) { InternalJQElement.Css("left", position.X); InternalJQElement.Css("top", position.Y); }