public void Append(IFileListControl flc, ListView lv) { FileListControl = flc; listView1 = lv; lv.MouseLeave += ListView1_MouseLeave; lv.MouseMove += listView1_MouseMove; RunPreview(); listView1.Controls.Add(preview); //listView1.Controls.SetChildIndex(preview, listView1.Controls.Count - 1); }
internal void Execute(IFileListControl fl) { if (fl.SelectedFile == null) { return; } ProcessStartInfo psi = new ProcessStartInfo(); string path = Path; psi.WorkingDirectory = new FileInfo(path).DirectoryName; psi.FileName = path; psi.Arguments = $"\"{fl.SelectedFile.FullName}\""; Process.Start(psi); }
public void Init(IFileListControl flc, IFileInfo file) { FileControl = flc; if (file != null) { currentFile = file; UpdateTags(file); } else { checkedListBox1.Enabled = false; } flc.SelectedFileChanged += Flc_SelectedFileChanged; }
public void Init(IFileListControl flc, IFileInfo file) { u.Init(flc, file); }
internal void Init(IFileListControl fileListControl, IFileInfo p) { quickTagsUserControl1.Init(fileListControl, p); }
protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { /*FileListControl fc = null; * if (fileListControl1.ContainsFocus) * { * fc = fileListControl1; * } * if (fileListControl2.ContainsFocus) * { * fc = fileListControl2; * } * * if (fc != null && fc.ListView.Focused && fc.SelectedFile != null) * { * ProcessStartInfo psi = new ProcessStartInfo(); * psi.WorkingDirectory = fc.SelectedFile.DirectoryName; * psi.FileName = fc.SelectedFile.FullName; * * Process.Start(psi); * * }*/ } //if (e.KeyCode == Keys.Delete) //{ // FileListControl fc = null; // if (fileListControl1.ContainsFocus) // { // fc = fileListControl1; // } // if (fileListControl2.ContainsFocus) // { // fc = fileListControl2; // } // if (fc != null && fc.ListView.Focused) // { // if (Stuff.Question("Delete file: " + fc.SelectedFile.FullName + "?") == DialogResult.Yes) // { // var attr = File.GetAttributes(fc.SelectedFile.FullName); // bool allow = true; // if (attr.HasFlag(FileAttributes.ReadOnly)) // { // if (Stuff.Question("File is read-only, do you want to delete it anyway?") != DialogResult.Yes) // { // allow = false; // } // else // { // File.SetAttributes(fc.SelectedFile.FullName, FileAttributes.Normal); // } // } // if (allow) // { // File.Delete(fc.SelectedFile.FullName); // } // } // } //} if (e.KeyCode == Keys.F2) {//rename FileListControl fc = null; if (fileListControl1.ContainsFocus) { fc = fileListControl1; } if (fileListControl2.ContainsFocus) { fc = fileListControl2; } if (fc != null) { fc.Rename(); } } if (Stuff.Hotkeys.Any(z => z.Hotkey == e.KeyCode && z.IsEnabled)) { var cc = Stuff.Hotkeys.First(z => z.Hotkey == e.KeyCode); IFileListControl fl = fileListControl1; if (fileListControl2.ContainsFocus) { fl = fileListControl2; } cc.Execute(fl); } if (e.KeyCode == Keys.F5) {//copy if (fileListControl1.Mode == ViewModeEnum.Filesystem && fileListControl2.Mode == ViewModeEnum.Filesystem) { var from = fileListControl1; var to = fileListControl2; if (fileListControl2.ContainsFocus) { from = fileListControl2; to = fileListControl1; } /*if (from.SelectedFiles != null) * { * bool allow = true; * var p1 = Path.Combine(to.CurrentDirectory.FullName, * from.SelectedFile.Name); * if (File.Exists(p1)) * { * if (MessageBox.Show( * "File " + p1 + " already exist. replace?", Text, * MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) * { * allow = false; * } * } * * if (allow) * { * File.Copy(from.SelectedFile.FullName, p1, true); * to.UpdateList(to.CurrentDirectory.FullName); * } * }*/ var self = from.SelectedFiles; var seld = from.SelectedDirectories; if (seld != null || self != null) { //copy recursively all files and dirs var prnt = from.CurrentDirectory; List <IFileInfo> list = new List <IFileInfo>(); List <IDirectoryInfo> dirs = new List <IDirectoryInfo>(); if (self != null) { list.AddRange(self); } if (seld != null) { foreach (var item in seld) { Stuff.GetAllFiles(item, list); Stuff.GetAllDirs(item, dirs); } } CopyDialog cpd = new CopyDialog(); cpd.Init(list.ToArray(), dirs.ToArray(), to.CurrentDirectory, prnt); cpd.ShowDialog(); } } if ((fileListControl1.Mode == ViewModeEnum.Filesystem || fileListControl1.Mode == ViewModeEnum.Libraries) && fileListControl2.Mode == ViewModeEnum.Tags) { if (fileListControl1.SelectedFile != null && fileListControl2.CurrentTag != null) { var fn = fileListControl1.SelectedFile; if (!fileListControl2.CurrentTag.ContainsFile(fn)) { fileListControl2.CurrentTag.AddFile(fn); MessageBox.Show(Path.GetFileName(fn.FullName) + " tagged as " + fileListControl2.CurrentTag.Name); fileListControl2.UpdateTagsList(); } } } } base.OnKeyDown(e); }