Exemplo n.º 1
0
        public static async Task <bool> ChangeBillboard(int id, BookListChangeType changeType,
                                                        int?alteredId = null, string alteredText = null)
        {
            var admin = new AdminObject("ChangeBillboard")
            {
                BillboardId   = id,
                ChangeType    = (int)changeType,
                AlteredBookId = alteredId,
                AlteredText   = alteredText
            };

            if (Storage.Test)
            {
                return(true);
            }

            var recv = await Connection.SendAdminAndReceive.GlobalLock(admin);

            var obj = JsonConvert.DeserializeObject(recv, typeof(ReceiveObject)) as ReceiveObject;

            if (obj != null && obj.Message != null && obj.Message.Trim().Length > 0)
            {
                var dialog = new Windows.UI.Xaml.Controls.ContentDialog()
                {
                    Content = obj.Message.Trim(),
                    Title   = "Edit Billboard Result",
                    IsSecondaryButtonEnabled = false,
                    PrimaryButtonText        = "OK"
                };
                await dialog.ShowAsync();
            }
            return(obj != null && obj.Success);
        }
Exemplo n.º 2
0
        public static async Task <bool> ChangeReadList(int readListId, BookListChangeType changeType,
                                                       int?alteredId = null, string alteredText = null)
        {
            if (Util.MainElem.CurrentPage == typeof(BillboardPage) && Storage.IsAdmin)
            {
                return(await NetworkAdmin.ChangeBillboard(readListId, changeType, alteredId, alteredText));
            }

            var change = new ChangeObject("ChangeReadList")
            {
                ReadListId    = readListId,
                ChangeType    = (int)changeType,
                AlteredBookId = alteredId,
                AlteredText   = alteredText
            };

            if (Storage.Test)
            {
                return(true);
            }

            var recv = await Connection.SendAndReceive.GlobalLock(change);

            return(recv.Success);
        }