Example #1
0
        private void BtnUp_Clicked(object?sender, EventArgs e)
        {
            var indices = GtkHelper.GetSelectedIndices(lvFiles);

            if (indices.Length > 0 && indices[0] > 0)
            {
                var ent = GtkHelper.GetValueAt <InProgressDownloadItem>(lvFiles, indices[0] - 1, 3);
                if (ent == null)
                {
                    return;
                }
                var index = indices[indices.Length - 1];
                GtkHelper.RemoveAt(filesListStore, indices[0] - 1);
                filesListStore.InsertWithValues(index, ent.Name,
                                                FormattingHelper.FormatSize(ent.Size), ent.Status.ToString(), ent);
            }
            //var indices = GtkHelper.getse lvFiles.GetSelectedIndices();
            //if (indices.Length > 0 && indices[0] > 0)
            //{
            //    var item = this.downloads[indices[0] - 1];
            //    var index = indices[indices.Length - 1];
            //    this.downloads.Remove(item);
            //    this.downloads.Insert(index, item);
            //    //var index1 = indices[0] - 1;
            //    //var index2 = indices[0] + lvFiles.SelectedItems.Count - 1;
            //    //var value = this.downloads[index1];
            //    //this.downloads.RemoveAt(index1);
            //    //this.downloads.Insert(index2, value);
            //}
        }
Example #2
0
        private void BtnDown_Clicked(object?sender, EventArgs e)
        {
            var indices = GtkHelper.GetSelectedIndices(lvFiles);

            if (indices.Length > 0 && indices[indices.Length - 1] < this.filesListStore.IterNChildren() - 1)
            {
                var index = indices[indices.Length - 1] + 1;
                var ent   = GtkHelper.GetValueAt <InProgressDownloadItem>(lvFiles, index, 3);
                if (ent == null)
                {
                    return;
                }
                GtkHelper.RemoveAt(filesListStore, index);
                filesListStore.InsertWithValues(indices[0], ent.Name,
                                                FormattingHelper.FormatSize(ent.Size), ent.Status.ToString(), ent);
            }
        }