sábado, 26 de maio de 2018

UWP: System.Exception: 'The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))'


System.Exception: 'O aplicativo chamou uma interface marshalled para um outro thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))'

System.Exception: 'The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))'



            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                textbox1.Header = e;
            }
            );

sábado, 19 de maio de 2018

json reference cycle - from C# NewtonSoft JSON

This is more a JS problem than a Vue one - $ref/$id are non-standard JSON. NET syntax. Been a while since I’ve dealt with cyclical refs, but I think this is what I used last time: https://bitbucket.org/smithkl42/jsonnetdecycle - then store the decycled object graph in your Vue model

sexta-feira, 18 de maio de 2018

How to Get Query String Parameters with JavaScript

// Assuming "?post=1234&action=edit"
var urlParams = new URLSearchParams(window.location.search);

console
.log(urlParams.has('post')); // true
console
.log(urlParams.get('action')); // "edit"
console
.log(urlParams.getAll('action')); // ["edit"]
console
.log(urlParams.toString()); // "?post=1234&action=edit"
console
.log(urlParams.append('active', '1')); // "?post=1234&action=edit&active=1"
URLSearchParams
https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams


You can use URLSearchParams and this polyfill to ensure that it will work on most web browsers:
https://github.com/WebReflection/url-search-params/blob/master/build/url-search-params.js


https://davidwalsh.name/query-string-javascript

See
https://stackoverflow.com/a/50417160/194717
https://stackoverflow.com/a/50417160/194717
https://stackoverflow.com/a/12151322/194717

terça-feira, 15 de maio de 2018

Flurl custom Json settings

            Flurl.Http.FlurlHttp.Configure(settings =>
            {
                settings.JsonSerializer = new Flurl.Http.Configuration.NewtonsoftJsonSerializer(WebAPI.helper.serializerSettings);
            });

public static class helper
    {
        ///

        /// Utilize este arquivo helper.cs
        /// Atencao em todo o sistema deve usar esta mesma configuracao, Server e no Client,
        /// exemplo no Azure Function e no site SistemaMulti
        ///

        public static Newtonsoft.Json.JsonSerializerSettings serializerSettings = new Newtonsoft.Json.JsonSerializerSettings()
        {
            ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
            PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.All,    //????.Arrays,
            TypeNameHandling = Newtonsoft.Json.TypeNameHandling.All,
            //Formatting = Newtonsoft.Json.Formatting.Indented,

        };
        public static string ToUTF8String(this System.IO.Stream se)
        {
            using (var reader = new System.IO.StreamReader(se, Encoding.UTF8))
            {
                string value = reader.ReadToEnd();
                return value;
            }
        }
    }

sexta-feira, 4 de maio de 2018

Azure Web App - Facebook OAuth redirect


https://login.microsoftonline.com/te/tsmulti.onmicrosoft.com/oauth2/authresp
https://sistemamulti.azurewebsites.net/.auth/login/facebook/callback