Ejemplo n.º 1
0
 private void BtnMoveTo_Clicked(object?sender, EventArgs e)
 {
     if (this.filesListStore.IterNChildren() > 0 &&
         this.queueListStore.IterNChildren() > 1 &&
         LbQueues.Selection.CountSelectedRows() > 0)
     {
         var qsd          = QueueSelectionDialog.CreateFromGladeFile(this, this.group);
         var queueNames   = new List <string>();
         var queueIds     = new List <string>();
         var selectedItem = GtkHelper.GetSelectedValue <DownloadQueue>(LbQueues, 1);
         var index        = 0;
         foreach (DownloadQueue item in GtkHelper.GetListStoreValues <DownloadQueue>(queueListStore, 1))
         {
             if (item != selectedItem)
             {
                 queueNames.Add(item.Name);
                 queueIds.Add(item.ID);
             }
             index++;
         }
         var downloadIds = new string[this.lvFiles.Selection.CountSelectedRows()];
         index = 0;
         foreach (InProgressDownloadItem lvi in GtkHelper.GetSelectedValues <InProgressDownloadItem>(lvFiles, 3))
         {
             downloadIds[index++] = lvi.Id;
         }
         qsd.SetData(queueNames, queueIds, downloadIds);
         qsd.QueueSelected += Qsd_QueueSelected;
         qsd.Run();
         qsd.Destroy();
         qsd.Dispose();
     }
 }
Ejemplo n.º 2
0
        private void BtnRemove_Clicked(object?sender, EventArgs e)
        {
            var selectedQueue = GtkHelper.GetSelectedValue <DownloadQueue>(LbQueues, 1);

            if (selectedQueue == null)
            {
                return;
            }
            var selectedIds = new List <string>();

            foreach (var item in GtkHelper.GetSelectedValues <InProgressDownloadItem>(lvFiles, 3))
            {
                if (item != null)
                {
                    selectedIds.Add(item.Id);
                }
            }
            foreach (var id in selectedIds)
            {
                selectedQueue.DownloadIds.Remove(id);
            }
            LoadQueueDetails(selectedQueue);
        }