Ejemplo n.º 1
0
        private async Task move(int sourceIndex, int destinationIndex)
        {
            try
            {
                var sourceItem      = Items[sourceIndex];
                var destinationItem = Items[destinationIndex];
                var desiredRank     = destinationItem.Rank;
                if (destinationIndex > sourceIndex)
                {
                    desiredRank++;
                }

                Items.Move(sourceIndex, destinationIndex);
                var response = await QueueClient.SetRank(sourceItem.ID, desiredRank);

                if ((response == null) || !response.Success)
                {
                    await Application.Current.MainPage.DisplayAlert("Error", response != null?response.ErrorMessageClean : "Unable to move the selected video.", "OK");
                }

                MoveUp.ChangeCanExecute();
                MoveDown.ChangeCanExecute();
                MoveToTop.ChangeCanExecute();
                MoveToBottom.ChangeCanExecute();
            }
            catch (Exception ex)
            {
                //XXX : Handle error
                LoggerService.Instance.Log("ERROR: Queue.move: " + ex);
            }
        }