Example #1
0
        async Task EditFile(ButtonViewRow <VerifyFileView> button)
        {
            var cancel   = Tr.Get("Common.Cancel");
            var moveUp   = Tr.Get("Common.MoveUp");
            var moveDown = Tr.Get("Common.MoveDown");
            var edit     = Tr.Get("Common.Edit");
            var delete   = Tr.Get("Common.Delete");
            var openlink = T("OpenLink");

            var result = await DisplayActionSheet(Tr.Get("Common.Action"), cancel, null, moveUp, moveDown, edit, delete, openlink);

            if (result == edit)
            {
                await VerificationFilePage.Open(this, button.Tag as VerifyFileJson);
            }
            else if (result == delete)
            {
                Status.RemoveBusyView(button);
                RemoveView(button);
                Status.ReValidate();
            }
            else if (result == moveUp || result == moveDown)
            {
                var idx = StackLayout.Children.IndexOf(button);
                if (idx > 0)
                {
                    var hasNext = (StackLayout.Children[idx + 1] as StackRow)?.Tag is VerifyFileJson;
                    var hasPrev = (StackLayout.Children[idx - 1] as StackRow)?.Tag is VerifyFileJson;

                    if (hasNext && result == moveDown)
                    {
                        StackLayout.Children.RemoveAt(idx);
                        StackLayout.Children.Insert(idx + 1, button);
                    }
                    else if (hasPrev && result == moveUp)
                    {
                        StackLayout.Children.RemoveAt(idx);
                        StackLayout.Children.Insert(idx - 1, button);
                    }
                }
            }
            else if (result == openlink)
            {
                if (button.Tag is VerifyFileJson verify && !string.IsNullOrEmpty(verify.link))
                {
                    UIApp.OpenUrl(new Uri(verify.link));
                }
            }
        }
Example #2
0
 async Task AddFile(ButtonRow button)
 {
     await VerificationFilePage.Open(this, null);
 }