Beispiel #1
0
        public async Task <IEnumerable <Note> > GetAll()
        {
            HttpClient client = GetClient();
            string     result = await client.GetStringAsync(link);

            IDeserialize des = new JsConvert();

            return(des.DeserializeObj <Note>(result));
        }
Beispiel #2
0
            public long[] ToJsValue(IntPtr es)
            {
                long[] res   = new long[Count];
                int    index = 0;

                foreach (var item in this)
                {
                    res[index] = JsConvert.ConvertObjectToJS(es, item);
                }
                return(res);
            }
Beispiel #3
0
        private static T Call <T>(
            long i_webView,
            long i_control,
            long cancelPtr,
            string jsFunction,
            FunctionParamterCollection paramterCollection)
        {
            IntPtr  controlPtr = new IntPtr(i_control);
            Control control    = Control.FromHandle(controlPtr);

            return((T)control.Invoke(new Func <long, T>(w => {
                try
                {
                    IntPtr wV = new IntPtr(w);
                    var es = MBApi.wkeGlobalExec(wV);
                    var args = paramterCollection.ToJsValue(es);
                    var script = string.Format(FUNCTION_CALL_FORMAT, jsFunction);
                    var funV = MBApi.jsEvalW(es, script);
                    if (MBApi.jsIsUndefined(funV))
                    {
                        return default(T);
                    }
                    long resV = MBApi.jsCallGlobal(es, funV, args, args.Length);
                    var obj = JsConvert.ConvertJSToObject(es, resV, typeof(T));
                    if (obj == null)
                    {
                        return default(T);
                    }
                    return (T)obj;
                }
                catch (Exception ex)
                {
                    return default(T);
                }
            }), i_webView));
        }