private void keypressed(object sender, KeyEventArgs e, AlphaBlendTextBox path, string destination, ListView listView) { menu.copy(sender, e, destination, startPathL, listView); menu.move(sender, e, destination, startPathL, listView); menu.delete(sender, e, startPathL, listView); menu.compress(sender, e, startPathL, listView); if (e.KeyCode == Keys.Enter) { menu.openRightClick(path, startPathL, listView); } if (e.KeyCode == Keys.F3) { SearchForm searching = new SearchForm(startPathL); searching.Show(); } if (e.KeyCode == Keys.F4) { menu.getPath(startPathL, listView); Rename rename = new Rename(menu.getPath(startPathL, listView)); rename.Show(); } if (e.KeyCode == Keys.F7) { NewDirectory newdir = new NewDirectory(startPathL); newdir.Show(); } }
void actualDrive_Click(object sender, EventArgs e, AlphaBlendTextBox Path, string name, bool ready) { Bunifu.Framework.UI.BunifuImageButton buttonThatWasClicked = (Bunifu.Framework.UI.BunifuImageButton)sender; if (ready) { Path.Text = name; } else { CustomException exception = new CustomException("Drive is not ready!"); } }
public void getDrives(Panel DrivePanel, AlphaBlendTextBox Path) { DriveInfo[] drives = DriveInfo.GetDrives(); int startWidth = 5; int driverID = 1; foreach (DriveInfo driver in drives) { Bunifu.Framework.UI.BunifuImageButton actualDrive = new Bunifu.Framework.UI.BunifuImageButton(); actualDrive.Parent = DrivePanel; actualDrive.Name = "actualDrive" + driverID; actualDrive.BackColor = Color.Transparent; actualDrive.Width = 27; actualDrive.Height = 27; actualDrive.Location = new Point(startWidth, 2); actualDrive.Zoom = 0; actualDrive.Cursor = Cursors.Hand; actualDrive.Click += new EventHandler((sender, e) => actualDrive_Click(sender, e, Path, driver.Name, driver.IsReady)); Label DriveName = new Label(); DriveName.Width = 35; DriveName.Height = 27; DriveName.Text = driver.Name; DriveName.ForeColor = Color.White; DriveName.BackColor = Color.Transparent; DriveName.Location = new Point(startWidth + actualDrive.Width + 5, 10); if (driver.DriveType.ToString() == "Fixed") { actualDrive.Image = Properties.Resources.mini_hdd; } if (driver.DriveType.ToString() == "Removable") { actualDrive.Image = Properties.Resources.mini_usb; } if (driver.DriveType.ToString() == "CDRom") { actualDrive.Image = Properties.Resources.mini_cd; } driverID++; startWidth += 67; DrivePanel.Controls.Add(actualDrive); DrivePanel.Controls.Add(DriveName); } }
public void item_Click(Object sender, ToolStripItemClickedEventArgs e, MouseEventArgs ep, AlphaBlendTextBox Path, string dirPath, ListView list, ContextMenuStrip rightClickMenu) { switch (e.ClickedItem.Name.ToString()) { case "Open": menu.openRightClick(Path, dirPath, list); break; case "Copy": menu.copyRightClick(Path, dirPath, list); break; case "Move": menu.moveRightClick(Path, dirPath, list); break; case "Delete": menu.deleteRightClick(dirPath, list); break; case "Properties": Property properties = new Property(menu.getPath(dirPath, list)); properties.Show(); break; case "Decompress": menu.decompress(dirPath, list); break; case "Encrypt": menu.encryptFile(dirPath, list); break; case "Decrypt": menu.decryptFile(dirPath, list); break; } }
public void getContectMenu(ListView contentPanel, MouseEventArgs ep, AlphaBlendTextBox Path, string path) { ContextMenuStrip rightClickMenu = new ContextMenuStrip(); rightClickMenu.Items.Clear(); rightClickMenu.Items.Add("Open").Name = "Open"; int indexopen = rightClickMenu.Items.IndexOfKey("Open"); rightClickMenu.Items[indexopen].Image = Properties.Resources.open; rightClickMenu.Items.Add("Copy").Name = "Copy"; int indexcopy = rightClickMenu.Items.IndexOfKey("Copy"); rightClickMenu.Items[indexcopy].Image = Properties.Resources.copy; rightClickMenu.Items.Add("Move").Name = "Move"; int indexmove = rightClickMenu.Items.IndexOfKey("Move"); rightClickMenu.Items[indexmove].Image = Properties.Resources.move; rightClickMenu.Items.Add("Delete").Name = "Delete"; int indexdelete = rightClickMenu.Items.IndexOfKey("Delete"); rightClickMenu.Items[indexdelete].Image = Properties.Resources.delete; string clicked = ""; foreach (ListViewItem item in contentPanel.SelectedItems) { clicked = item.Text; } if (!clicked.StartsWith("[")) { FileInfo file = new FileInfo(path + clicked); if (file.Extension == ".zip" || file.Extension == ".gz" || file.Extension == ".tar") { rightClickMenu.Items.Add("Decompress").Name = "Decompress"; int indexdecompress = rightClickMenu.Items.IndexOfKey("Decompress"); rightClickMenu.Items[indexdecompress].Image = Properties.Resources.decompress; } if (file.Attributes.HasFlag(FileAttributes.Encrypted)) { rightClickMenu.Items.Add("Decrypt").Name = "Decrypt"; int indexdecrypt = rightClickMenu.Items.IndexOfKey("Decrypt"); rightClickMenu.Items[indexdecrypt].Image = Properties.Resources.decrypt; } if (!file.Attributes.HasFlag(FileAttributes.Encrypted)) { rightClickMenu.Items.Add("Encrypt").Name = "Encrypt"; int indexencrypt = rightClickMenu.Items.IndexOfKey("Encrypt"); rightClickMenu.Items[indexencrypt].Image = Properties.Resources.encrypt; } } rightClickMenu.Items.Add("Properties").Name = "Properties"; int indexprop = rightClickMenu.Items.IndexOfKey("Properties"); rightClickMenu.Items[indexprop].Font = new Font(rightClickMenu.Font, FontStyle.Bold); rightClickMenu.Items[indexprop].Image = Properties.Resources.prop; rightClickMenu.ItemClicked += new ToolStripItemClickedEventHandler((sender, e) => item_Click(sender, e, ep, Path, path, contentPanel, rightClickMenu)); Point pt = contentPanel.PointToScreen(ep.Location); rightClickMenu.Show(pt); }
public ListView getContent(int left, int top, ListView contentPanel, Panel ContentPanel, AlphaBlendTextBox Path, string path) { addImages(contentImage); contentPanel.SmallImageList = contentImage; contentPanel.Name = "LeftContent"; contentPanel.Location = new Point(left, top); contentPanel.Width = 520; contentPanel.Height = 348; contentPanel.View = View.Details; contentPanel.BackColor = Color.FromArgb(54, 54, 54); contentPanel.ForeColor = Color.White; ContentPanel.Controls.Add(contentPanel); contentPanel.BorderStyle = BorderStyle.None; if (path.Split('\\').Length != 2) { ListViewItem item = new ListViewItem(); item.Text = "[..]"; item.SubItems.Add(""); item.SubItems.Add("<DIR>"); contentPanel.Items.Add(item); item.ImageKey = "up"; } DirectoryInfo getDirectories = new DirectoryInfo(path); DirectoryInfo[] directories = getDirectories.GetDirectories(); FileInfo[] files = getDirectories.GetFiles(); foreach (DirectoryInfo dir in directories) { string attributes = dir.Attributes.ToString(); string[] getAttributes = attributes.Split(','); string size = "<DIR>"; long totalsize = 0; ListViewItem item = new ListViewItem(); if (getAttributes[0] == "Hidden") { item.ForeColor = Color.DarkGray; } item.Text = "[" + dir.Name + "]"; item.SubItems.Add(dir.LastWriteTime.ToString()); item.SubItems.Add(size); contentPanel.Items.Add(item); item.ImageKey = "folder"; } foreach (FileInfo info in files) { string attributes = info.Attributes.ToString(); string[] getAttributes = attributes.Split(','); long size = info.Length; ListViewItem item = new ListViewItem(); if (getAttributes[0] == "Hidden") { item.ForeColor = Color.DarkGray; } item.Text = info.Name; item.SubItems.Add(info.LastWriteTime.ToString()); item.SubItems.Add(size.ToString("N0")); contentPanel.Items.Add(item); item.ImageKey = "files"; } return(contentPanel); }
private void Leftcontent_rightClick(object sender, MouseEventArgs e, ListView leftContent, AlphaBlendTextBox path, string startPathL) { if (e.Button == MouseButtons.Right) { context.getContectMenu(leftContent, e, path, startPathL); } }
private void LeftContent_MouseDoubleClick(object sender, MouseEventArgs e, AlphaBlendTextBox Path, string dirPath, ListView list) { menu.open(sender, e, Path, dirPath, list); }