protected override void removeButton_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("This action will permanently delete this job (also on the Hive server). Continue?", "HeuristicLab Hive Job Manager", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                System.Windows.Forms.ListView.SelectedListViewItemCollection selectedItems = itemsListView.SelectedItems;
                bool inProgress = false;
                foreach (ListViewItem item in selectedItems)
                {
                    RefreshableJob job = item.Tag as RefreshableJob;
                    if (job != null && job.IsProgressing)
                    {
                        inProgress = true;
                        break;
                    }
                }

                if (inProgress)
                {
                    MessageBox.Show("You can't delete jobs which are currently uploading or downloading." + Environment.NewLine + "Please wait for the jobs to complete and try again. ", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    DeleteHiveJobs(e);
                }
            }
        }
Ejemplo n.º 2
0
        //**********************************************************************************************
        private void this_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop)) //from explorer
            {
                //TODO
                String[] filePaths = (String[])e.Data.GetData("FileDrop");
            }
            else //from listview
            {
                System.Windows.Forms.ListView.SelectedListViewItemCollection items =
                    (System.Windows.Forms.ListView.SelectedListViewItemCollection)e.Data.GetData(
                        typeof(System.Windows.Forms.ListView.SelectedListViewItemCollection));

                foreach (ListViewItem item in items)
                {
                    DiskItem disk = (DiskItem)item.Tag;
                    form.QueueList.QueueDownloadItem(disk.IsDirectory, disk.path, form.LocalList.CurrentDirectory, disk.name, item.ImageIndex, disk.size);
                }

                form.QueueList.StartQueue();
            }

            AllowDrop = true;
            form.RemoteList.AllowDrop = true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Remove the client selected in the list view
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RemoveClientButtons_Click(object sender, EventArgs e)
        {
            try
            {
                System.Windows.Forms.ListView.SelectedListViewItemCollection slvic = this.ClientListView.SelectedItems;
                ListViewItem toRemove = null;

                if (slvic != null)
                {
                    foreach (ListViewItem lvi in slvic)
                    {
                        System.Windows.Forms.ListViewItem.ListViewSubItemCollection lvsic = lvi.SubItems;

                        if (this.clientHandler.AvailableClients.ContainsKey(lvsic[1].Text))
                        {
                            this.clientHandler.Remove(lvsic[1].Text);
                            toRemove = lvi;
                        }
                    }
                }

                if (toRemove != null)
                {
                    this.ClientListView.Items.Remove(toRemove);
                }
            }
            catch (Exception ex)
            {
                RemoraOutput.WriteLine("Removal of Client Failed: \n " + ex.ToString(), OutputType.Remora);
            }
        }
Ejemplo n.º 4
0
        private void AddVariablesToGrid(System.Windows.Forms.ListView.SelectedListViewItemCollection VariableNames)
        {
            DataTable Table = Grid.DataSourceTable;

            foreach (ListViewItem SelectedItem in VariableNames)
            {
                // Go look for a blank cell.
                int Row = 0;
                for (Row = 0; Row <= Table.Rows.Count - 1; Row++)
                {
                    if (Convert.IsDBNull(Table.Rows[Row][0]) || string.IsNullOrEmpty((string)Table.Rows[Row][0]))
                    {
                        break;                         // TODO: might not be correct. Was : Exit For
                    }
                }
                if (Row == Table.Rows.Count)
                {
                    DataRow NewRow = Grid.DataSourceTable.NewRow();
                    NewRow[0] = SelectedItem.Text;
                    Table.Rows.Add(NewRow);
                }
                else
                {
                    Table.Rows[Row][0] = SelectedItem.Text;
                }
            }
            Grid.PopulateGrid();
            Grid.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            Grid.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
        }
        /// <summary>
        ///	This function returns the total object found in search
        ///	for a perticular selected entry so the the state of
        ///	View Files button can be toggled
        /// </summary>
        /// <param name="iReturn"> </param>
        private int GetNumberOfObjectsFound(out int iReturn)
        {
            // get the currently selecteditem from the list view
            System.Windows.Forms.ListView.SelectedListViewItemCollection items = lvComputers.SelectedItems;

            // Declares and initialize the iIndex variable to -1
            int iIndex = -1;

            // initilize the iReturn valiable to -1
            iReturn = -1;

            // check that if items variable have some data or not
            if (0 < items.Count)
            {
                // get the index of the selected item
                iIndex = items[0].Index;

                // get the corresponding iFilesFound value from the
                // List that we have maintained by supplying the
                // iIndex value to it
                iReturn = ConnectedComputers[iIndex].iFilesFound;
            }

            // Also returns the iIndex number which is selected,
            // iIndex contains -1 if nothing is selected
            return(iIndex);
        }
Ejemplo n.º 6
0
 // пометить/снять пометку все выделенные элементы
 public static void ChekAllSelectedItems(ListView lv, bool bCheck)
 {
     System.Windows.Forms.ListView.SelectedListViewItemCollection selectedItems = lv.SelectedItems;
     foreach (ListViewItem lvi in selectedItems)
     {
         lvi.Checked = bCheck;
     }
 }
Ejemplo n.º 7
0
        private void menuPlaylist_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            System.Windows.Forms.ListView.SelectedListViewItemCollection items = playlist.SelectedItems;

            bool enabled = items != null && items.Count == 1;

            tsmiEdit.Enabled   = enabled;
            tsmiDelete.Enabled = enabled;
        }
Ejemplo n.º 8
0
        public static List <System.Windows.Forms.ListViewItem> ToList(this System.Windows.Forms.ListView.SelectedListViewItemCollection list)
        {
            var retval = new List <System.Windows.Forms.ListViewItem>();

            foreach (System.Windows.Forms.ListViewItem item in list)
            {
                retval.Add(item);
            }
            return(retval);
        }
Ejemplo n.º 9
0
 public static void CopySelectedItems(System.Windows.Forms.ListView.SelectedListViewItemCollection collection)
 {
     Items.Clear();
     Files.Clear();
     foreach (ListViewItem item in collection)
     {
         Items.Add(item);
         Files.Add(item.Tag as string);
     }
 }
Ejemplo n.º 10
0
        private void tsmiDelete_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.ListView.SelectedListViewItemCollection items = playlist.SelectedItems;

            if (items == null || items.Count == 0)
            {
                return;
            }

            playlist.Items.Remove(items[0]);
        }
Ejemplo n.º 11
0
        private void tsmiEdit_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.ListView.SelectedListViewItemCollection items = playlist.SelectedItems;

            if (items == null || items.Count == 0)
            {
                return;
            }

            this.EditPlaylistItem(items[0]);
        }
Ejemplo n.º 12
0
        //**********************************************************************************************
        private void Menu_Upload_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.ListView.SelectedListViewItemCollection items = SelectedItems;
            foreach (ListViewItem item in items)
            {
                DiskItem disk = (DiskItem)item.Tag;
                form.QueueList.QueueUploadItem(disk.IsDirectory, disk.path, form.RemoteList.CurrentDirectory, disk.name, item.ImageIndex, disk.size);
            }

            form.QueueList.StartQueue();
        }
Ejemplo n.º 13
0
        private void recountSelected(System.Windows.Forms.ListView.SelectedListViewItemCollection selFiles)
        {
            int  fileCount = selFiles.Count;
            long totalSize = 0;

            foreach (ListViewItem it in selFiles)
            {
                totalSize += ((FileInfo)it.Tag).FileSize;
            }
            statusLabelSelected.Text = string.Format(fileSizeFormat, "Selected: {0} files, {1:N} Bytes", fileCount, totalSize);
        }
Ejemplo n.º 14
0
        private void lvPlayer2Ships_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(typeof(SLWIC)))
            {
                ShipLoaderListView lv = (ShipLoaderListView)sender;
                SLWIC cool            = (SLWIC)e.Data.GetData(typeof(SLWIC));
                foreach (ListViewItem item in cool)
                {
                    lv.Items.Add((ListViewItem)item.Clone());
                }
                lv.Refresh();

                RecalcPlayer1();
                RecalcPlayer2();
            }
        }
        /// <summary>
        /// This function is called when you click the View files button
        /// </summary>
        /// <param name="sender"> </param>

        /// <param name="e"> </param>
        protected void btnViewFiles_Click(object sender, System.EventArgs e)
        {
            // Creates an ShareForm object from frmShare class and
            // initializes it
            frmShare ShareForm = new frmShare();

            // Get the currently selected item from the list view
            System.Windows.Forms.ListView.SelectedListViewItemCollection items = lvComputers.SelectedItems;

            // Get the IPAddress of the Selected item from IP Address
            // column
            string SelectedIP = items[0].SubItems[1].Text.Trim();

            // The followinf 12 lines of code Scans through the
            // SERVERSEARCH list and insert the values in the List view
            // of the frmShare class Folder and file wise
            for (int i = 0; i < iSearchResult; i++)
            {
                if (0 == xmlStruct.SERVERSEARCH[i].sIPAddress.Trim().CompareTo(SelectedIP))
                {
                    ImageList imgList = new ImageList();
                    imgList.Images.Add(System.Drawing.Image.FromFile(Application.StartupPath + "\\Folder.ico"));
                    imgList.Images.Add(System.Drawing.Image.FromFile(Application.StartupPath + "\\File.ico"));
                    ShareForm.lvFiles.SmallImageList = imgList;

                    if (xmlStruct.SERVERSEARCH[i].sFilename.EndsWith("\\"))
                    {
                        lvItems            = ShareForm.lvFiles.Items.Insert(i, xmlStruct.SERVERSEARCH[i].sFilename);
                        lvItems.ImageIndex = 0;
                    }
                    else
                    {
                        lvItems            = ShareForm.lvFiles.Items.Insert(i, xmlStruct.SERVERSEARCH[i].sFilename);
                        lvItems.ImageIndex = 1;
                    }
                }
            }
            /////////////////////////////////////////////////////////////////
            ///

            ShareForm.btnPrint.Enabled = false;
            ShareForm.btnChat.Enabled  = false;

            // Shows the ShareForm window
            ShareForm.ShowDialog();
        }
Ejemplo n.º 16
0
        //*************************************************************************************************************
        private void this_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop)) //from explorer
            {
                string[] filePaths = (string[])e.Data.GetData("FileDrop");
                Cursor.Current = Cursors.WaitCursor;
                foreach (string path in filePaths)
                {
                    DiskItem disk;
                    int      imageIndex = 0;

                    if (Directory.Exists(path))
                    {
                        disk       = new DiskItem(true, false, path, Path.GetFileName(path));
                        imageIndex = ShellImageList.GetFileImageIndex(disk.path, FileAttributes.Directory);
                    }
                    else
                    {
                        FileInfo f = new FileInfo(path);
                        disk       = new DiskItem(false, false, path, Path.GetFileName(path), f.Length);
                        imageIndex = ShellImageList.GetFileImageIndex(disk.path, File.GetAttributes(path));
                    }
                    form.QueueList.QueueUploadItem(disk.IsDirectory, disk.path,
                                                   CurrentDirectory, disk.name, imageIndex, disk.size);
                }
            }
            else //from listview
            {
                System.Windows.Forms.ListView.SelectedListViewItemCollection items =
                    (System.Windows.Forms.ListView.SelectedListViewItemCollection)e.Data.GetData(
                        typeof(System.Windows.Forms.ListView.SelectedListViewItemCollection));
                Cursor.Current = Cursors.WaitCursor;
                foreach (ListViewItem item in items)
                {
                    DiskItem disk = (DiskItem)item.Tag;
                    form.QueueList.QueueUploadItem(disk.IsDirectory, disk.path,
                                                   CurrentDirectory, disk.name, item.ImageIndex, disk.size);
                }
            }

            form.QueueList.StartQueue();

            form.LocalList.AllowDrop = true;
            AllowDrop = true;
        }
        /// <summary>
        /// Invoked when the user clicks on the Open button
        /// </summary>
        /// <param name="sender"> </param>
        /// <param name="e"> </param>
        protected void btnOpen_Click(object sender, System.EventArgs e)
        {
            // Get the currently selected item from the list view
            System.Windows.Forms.ListView.SelectedListViewItemCollection items = lvComputers.SelectedItems;

            try
            {
                // if item is found or not
                if (0 < items.Count)
                {
                    // Makes the string that is required to pass to the contructor
                    // of the frmShare class

                    // Appends the "(" and ")" at the begin and end of the IPAddress
                    string SelectedIP = " (" + items[0].SubItems[1].Text + ")";

                    // gets the name of the computer from Computername column
                    // of the list view
                    string Computername = items[0].Text;

                    // Concatenates the Computername to IP address
                    Computername = Computername + SelectedIP;

                    // declares a variable ShareForm of type frmShare class
                    // and passes the Computername to it
                    frmShare ShareForm = new frmShare(Computername);

                    // Shows the frmShare dialog window
                    ShareForm.Show();
                }

                // Throws the exception
                else
                {
                    throw new Exception("No selected computer found");
                }
            }

            // cathces the exception and shows it in a message box
            catch (Exception err) { MessageBox.Show(err.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
        }
Ejemplo n.º 18
0
        public void HandleListViewEntitiesSelectedIndexChanged()
        {
            string           inputEntityLogicalName = "account";
            HashSet <string> inputSelectedEntity    = new HashSet <string>();

            using (var listView = new System.Windows.Forms.ListView())
            {
                var selectedItems = new System.Windows.Forms.ListView.SelectedListViewItemCollection(listView);

                using (var systemUnderTest = new SchemaWizard())
                {
                    systemUnderTest.OrganizationService = ServiceMock.Object;
                    systemUnderTest.MetadataService     = MetadataServiceMock.Object;

                    var serviceParameters = GenerateMigratorParameters();

                    FluentActions.Invoking(() => systemUnderTest.HandleListViewEntitiesSelectedIndexChanged(inputEntityRelationships, inputEntityLogicalName, inputSelectedEntity, selectedItems, serviceParameters))
                    .Should()
                    .NotThrow();
                }
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Connect to a client
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ConnectClientButton_Click(object sender, EventArgs e)
        {
            try
            {
                System.Windows.Forms.ListView.SelectedListViewItemCollection slvic = this.ClientListView.SelectedItems;

                if (slvic != null && slvic.Count == 1)
                {
                    ListViewItem lvi = slvic[0];

                    System.Windows.Forms.ListViewItem.ListViewSubItemCollection lvsic = lvi.SubItems;

                    this.clientHandler.SetMachine(lvsic[1].Text);

                    RemoraCommon.Communicator.Shutdown();
                    RemoraCommon.Communicator.ResgisterWithClient();
                }
            }
            catch (Exception ex)
            {
                RemoraOutput.WriteLine("Connection to Client Failed: \n " + ex.ToString(), OutputType.Remora);
            }
        }
Ejemplo n.º 20
0
        private void treePart_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            //GetDropTarget
            System.Windows.Forms.TreeNode tn = this.treePart.GetNodeAt(
                this.treePart.PointToClient(new System.Drawing.Point(e.X, e.Y))
                );
            if (tn == null || tn.Tag == null || tn.Tag.GetType() != typeof(System.Xml.XmlElement))
            {
                return;
            }
            string className = (string)(XmlPart.Elem)(System.Xml.XmlElement) tn.Tag;

            //GetDropObject
            if (!e.Data.GetDataPresent(typeof(System.Windows.Forms.ListView.SelectedListViewItemCollection)))
            {
                return;
            }
            System.Windows.Forms.ListView.SelectedListViewItemCollection items
                = (System.Windows.Forms.ListView.SelectedListViewItemCollection)
                  e.Data.GetData(typeof(System.Windows.Forms.ListView.SelectedListViewItemCollection));
            //SetClass
            for (int i = 0; i < items.Count; i++)
            {
                if (!items[i].Tag.GetType().IsSubclassOf(typeof(Hanyu.Word.Content)))
                {
                    continue;
                }
                ((Hanyu.Word.Content)items[i].Tag).Class.Add(className);
            }
            //DropTarget を元に戻す
            if (this.treePartDropTarget == null)
            {
                return;
            }
            this.treePartDropTarget.NodeFont = this.FontDefault;
            this.treePartDropTarget          = null;
        }
Ejemplo n.º 21
0
 private void treePart_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
 {
     if (!e.Data.GetDataPresent(typeof(System.Windows.Forms.ListView.SelectedListViewItemCollection)))
     {
         return;
     }
     System.Windows.Forms.ListView.SelectedListViewItemCollection items
         = (System.Windows.Forms.ListView.SelectedListViewItemCollection)
           e.Data.GetData(typeof(System.Windows.Forms.ListView.SelectedListViewItemCollection));
     for (int i = 0; i < items.Count; i++)
     {
         System.Type type = items[i].Tag.GetType();
         if (type == typeof(Hanyu.Word))
         {
             //何もしない
         }
         else if (type.IsSubclassOf(typeof(Hanyu.Word.Content)))
         {
             e.Effect = DragDropEffects.Link;
             return;
         }
     }
     e.Effect = DragDropEffects.None;
 }
Ejemplo n.º 22
0
 public static IEnumerable <System.Windows.Forms.ListViewItem> AsEnumerable(this System.Windows.Forms.ListView.SelectedListViewItemCollection source)
 {
     TypeCheckEnumerable(source, (s) => s.AsEnumerable(), (s) => s[0]);
     return(source.Cast <System.Windows.Forms.ListViewItem>());
 }