Ejemplo n.º 1
0
        private async void KeepgetIdCard()
        {
            ValueSet vs = new ValueSet();

            vs.Add("Command", "IDCard");
            AppServiceConnection connection = App.Connection;

            if (connection != null)
            {
                await Task.Run(async() =>
                {
                    while (keepReading)
                    {
                        var vss  = await connection.SendMessageAsync(vs);
                        var arry = vss.Message.ToArray();
                        if (vss.Message.Keys.Count >= 1)
                        {
                            await DispatcherHelper.ExecuteOnUIThreadAsync(() =>
                            {
                                CurrentCard = Newtonsoft.Json.JsonConvert.DeserializeObject <IDCard>(arry[0].Value as String);
                                IDCardReceived?.Invoke(this, null);
                            });
                        }

                        Thread.Sleep(800);
                    }
                });
            }
        }
Ejemplo n.º 2
0
        private async void getIdCardOnce()
        {
            ValueSet vs = new ValueSet();

            vs.Add("Command", "IDCard");
            AppServiceConnection connection = App.Connection;

            if (connection != null)
            {
                var vss = await connection.SendMessageAsync(vs);

                var arry = vss.Message.ToArray();
                if (vss.Message.Keys.Count >= 1)
                {
                    CurrentCard = Newtonsoft.Json.JsonConvert.DeserializeObject <IDCard>(arry[0].Value as String);
                    IDCardReceived?.Invoke(this, null);
                }
            }
        }