public JsonAutoCompleteTextBox()
            : base()
        {
            this.input = new JsonTextBox();
            this.DataTemplateName = "AutoComplete";
            this.images = new JsonImageSequence();
            this.eventSource = new JsonScriptObjectEventSource();

            this.AddJsonFunction(this.eventSource);

            this.preSearch = new JsonFunction();
            this.preSearch.ExecutionType = JavascriptExecutionTypes.Call;

            this.postSearch = new JsonFunction();
            this.postSearch.ExecutionType = JavascriptExecutionTypes.Call;

            this.attacher = new JsonFunction();
            this.attacher.ExecutionType = JavascriptExecutionTypes.OnWindowLoad;

            this.MinimumInputLength = 2;

            this.Styles["display"] = "none";
            this.ItemTagName = "div";
            this.InvokeOnce = false;
        }
Beispiel #2
0
 private void UnWireEventSources(JsonFunction function)
 {
     foreach (string eventSourceDomId in this.eventSourceDomIds)
     {
         //function.AppendScriptBody(string.Format("\r\njQuery('id={0}').unbind('{1}', {2});", eventSourceDomId, this.ClientEventName, this.JsonId));
         function.AppendScriptBody(string.Format("\r\nJSUI.RemoveEventHandler('{0}', {1}, '{2}');", eventSourceDomId, this.JsonId, this.ClientEventName));
     }
 }
Beispiel #3
0
        internal async Task <string> ExecuteRequestAsync(JsonFunction function, IParameters parameters, Func <HttpResponseMessage, Task <string> > responseParser = null)
        {
            var url = GetPrtgUrl(function, parameters);

            var response = await ExecuteRequestAsync(url, responseParser).ConfigureAwait(false);

            return(response);
        }
Beispiel #4
0
        internal string ExecuteRequest(JsonFunction function, IParameters parameters, Func <HttpResponseMessage, string> responseParser = null)
        {
            var url = GetPrtgUrl(function, parameters);

            var response = ExecuteRequest(url, responseParser);

            return(response);
        }
 public JsonCollapsiblePanel()
     : base()
 {
     this.togglerScript = new JsonFunction();
     this.togglerScript.JsonId = this.JsonId + "_toggle";
     this.setupScript = new JsonFunction();
     this.setupScript.JsonId = this.JsonId + "_setup";
     this.EnableViewState = true;
     this.Width = -1;
 }
 public JsonCollapsiblePanel()
     : base()
 {
     this.togglerScript        = new JsonFunction();
     this.togglerScript.JsonId = this.JsonId + "_toggle";
     this.setupScript          = new JsonFunction();
     this.setupScript.JsonId   = this.JsonId + "_setup";
     this.EnableViewState      = true;
     this.Width = -1;
 }
Beispiel #7
0
        public DataBox()
            : base()
        {
            this.Callback = new BoxCallback();
            //this.Callback.PreInvokeFunctions = new JsonFunctionDelegate();
            this.Callback.Invoker = this;
            this.type             = JsonInvokerTypes.extension;
            this.AddJsonFunction(this.Callback);

            this.ResponseFormat  = JsonResponseFormats.box;
            this.InvokeOnce      = true; //default
            this.ToggleEventName = "click";

            this.showWorkingPreInvoke = new JsonFunction();
            this.WorkingInline        = true;
            //this.AddRequiredScript("naizari.javascript.boxcontrols.box.js");
        }
        public override void WireScriptsAndValidate()
        {
            if (this.FunctionToExecute == null)
                ThrowInvalidOperationException("FunctionToExecute cannot be null.");

            this.FunctionToExecute.ExecutionType = JavascriptExecutionTypes.Call;

            if (string.IsNullOrEmpty(EventSourceDomIds))
                ThrowInvalidOperationException("EventSourceDomIds was not specified.");

            if (string.IsNullOrEmpty(EventName))
                ThrowInvalidOperationException("ClientEventName was not specified.");

            base.WireScriptsAndValidate();
            this.AddJsonFunction(FunctionToExecute);

            JsonFunction parseFunction = new JsonFunction();
            parseFunction.ExecutionType = JavascriptExecutionTypes.OnParse;
            parseFunction.FunctionBody = string.Format("JSUI.AddEventHandler('{0}', {1}, '{2}');", this.EventSourceDomIds, FunctionToExecute.JsonId, this.EventName);
            this.AddJsonFunction(parseFunction);
        }
Beispiel #9
0
        public override void WireScriptsAndValidate()
        {
            if (string.IsNullOrEmpty(DragHandleDomId))
            {
                throw ExceptionHelper.CreateException <JsonInvalidOperationException>("The DragHandleDomId was not specified for : {0}", this.ToString());
            }

            if (string.IsNullOrEmpty(DraggableDomId))
            {
                throw ExceptionHelper.CreateException <JsonInvalidOperationException>("The DraggableDomId was not specified for : {0}", this.ToString());
            }

            JsonFunction createDraggableFunction = new JsonFunction();

            createDraggableFunction.JsonId = this.JsonId + "_init";
            string modal = this.IsModal ? "true" : "false";
            string body  = "BoxMgr.CreateDialog('" + this.DraggableDomId + "', {dragHandle: '" + this.DragHandleDomId + "', modal: " + modal + "});";//, this.DraggableDomId, this.DragHandleDomId, this.IsModal ? "true": "false")

            if (RenderDialogButtons)
            {
                body += string.Format("BoxMgr.Dialogs['{0}'].RenderDialogButtons();", this.DraggableDomId);
            }

            if (!string.IsNullOrEmpty(this.OKDomId))
            {
                body += string.Format("BoxMgr.Dialogs['{0}'].SetOkId('{1}');", this.DraggableDomId, this.OKDomId);
            }

            if (!string.IsNullOrEmpty(this.CancelDomId))
            {
                body += string.Format("BoxMgr.Dialogs['{0}'].SetCancelId('{1}');", this.DraggableDomId, this.CancelDomId);
            }

            createDraggableFunction.ExecutionType = JavascriptExecutionTypes.OnWindowLoad;
            createDraggableFunction.FunctionBody  = body;
            this.AddJsonFunction(createDraggableFunction);
        }
Beispiel #10
0
 public JsonFunctionParameters(JsonFunction function)
 {
     Function = function;
 }
Beispiel #11
0
 public PrtgUrl(ConnectionDetails connectionDetails, JsonFunction function, IParameters parameters) :
     this(connectionDetails, GetResourcePath(function), parameters)
 {
 }
Beispiel #12
0
 protected override void OnParameterAdded(JsonFunction function, string parameterName)
 {
 }
Beispiel #13
0
 private PrtgUrl GetPrtgUrl(JsonFunction function, IParameters parameters) =>
 new PrtgUrl(prtgClient.connectionDetails, function, parameters);
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer); // always call Render first to set styles and attributes

            controlToRender.TagName = "img";
            controlToRender.Attributes.Add("src", this.InitialImageSource);
            controlToRender.Attributes.Add("id", this.DomId);
            controlToRender.RenderControl(writer);

            JsonFunction function = new JsonFunction();
            // name, outimage, overimage
            string functionBody = string.Format("JSUI.QueueSwapifyConfig(JSUI.construct(\"ToggleConfig\", ['{0}', '{1}', '{2}', '{3}', '{4}']));", this.JsonId, this.InitialImageSource, this.ToggleImageSource, this.InitialImageEvent, this.ToggleImageEvent);
            functionBody += string.Format("\r\nJSUI.SetToggleImage('{0}', '{1}');", this.DomId, this.JsonId);
            //functionBody += string.Format("\r\nJSUI.ImageSwapify('{0}', '{0}');", this.JsonId);

            if (this.SetHandCursor)
                functionBody += string.Format("\r\nJSUI.SetHandCursor('{0}');", this.DomId);

            function.FunctionBody = functionBody;
            function.ExecutionType = JavascriptExecutionTypes.OnWindowLoad;
            this.AddJsonFunction(function);
            if (RenderScripts)
            {
                function.RenderControl(writer);
            }
        }
 internal PrtgRequestMessage(ConnectionDetails connectionDetails, JsonFunction function, IParameters parameters) :
     this(connectionDetails, GetResourcePath(function), parameters)
 {
 }
Beispiel #16
0
 public PrtgUrl(string server, string username, string passhash, JsonFunction function, Parameters.Parameters parameters) :
     this(server, username, passhash, GetResourcePath(function), parameters)
 {
 }