Esempio n. 1
0
        private async void dialogMessageReceiver(DialogMessage dm)
        {
            MessageDialog dialog = null;

            if (dm.Description != null && dm.Title != null)
            {
                dialog = new MessageDialog(dm.Description, dm.Title);
            }
            else
            {
                dialog = new MessageDialog(dm.Description ?? "");
            }

            if (dm.Buttons != null && dm.Buttons.Count > 0)
            {
                foreach (var b in dm.Buttons)
                {
                    dialog.Commands.Add(new UICommand(b.Text)
                    {
                        Id = b.Id
                    });
                }
            }

            IUICommand result;

            using (await alock.LockAsync())
            {
                result = await dialog.ShowAsync();
            }
            if (dm.CallBack != null)
            {
                dm.CallBack(Convert.ToInt32(result.Id));
            }
        }