Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private Point GetConstantPosition()
        {
            var left = InternalJQElement.Css <int>("left");
            var top  = InternalJQElement.Css <int>("top");

            return(new Point(left, top));
        }
Exemplo n.º 3
0
 private void SetFontStyle(FontStyle newFontStyle)
 {
     InternalJQElement.Css("font-size", newFontStyle.FontSize + "pt");
     InternalJQElement.Css("font-weight", newFontStyle.FontWeight.ToString().ToLower());
     _fontStyle = newFontStyle;
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Triggers the click event on the control
 /// </summary>
 public void SimulateClick() => InternalJQElement.Trigger("click");
Exemplo n.º 6
0
 /// <summary>
 /// Shows the control. Is equivalent to settings Visible to True
 /// </summary>
 public void Show() => InternalJQElement.Show();
Exemplo n.º 7
0
 /// <summary>
 /// Hides the control. Is equivalent to settings Visible to False
 /// </summary>
 public void Hide() => InternalJQElement.Hide();
Exemplo n.º 8
0
 /// <summary>
 /// Fades out the control. For more control over the animation, call an overload of Control.InternalJQElement.FadeOut
 /// </summary>
 public void FadeOut() => InternalJQElement.FadeOut();
Exemplo n.º 9
0
 /// <summary>
 /// Fades in the control. For more control over the animation, call an overload of Control.InternalJQElement.FadeIn
 /// </summary>
 public void FadeIn() => InternalJQElement.FadeIn();
Exemplo n.º 10
0
 private void SetRelativePosition(RelativePoint position)
 {
     InternalJQElement.Css("left", position.X);
     InternalJQElement.Css("top", position.Y);
 }
Exemplo n.º 11
0
 private void SetConstantPosition(Point position)
 {
     InternalJQElement.Css("left", position.X);
     InternalJQElement.Css("top", position.Y);
 }