private void RemovePreviewBox(PreviewBox pb) { string[] parts = pb.FileName.Split('\\'); string fn = parts[parts.Length - 1]; string id = fn.Substring(0, fn.IndexOf('_')); try { //movie FileOperations.Delete(pb.FileName); GetCameraWindow(Convert.ToInt32(id)).FileList.RemoveAll(p => p.Filename == fn); MasterFileList.RemoveAll(p => p.Filename == fn); //preview string dir = pb.FileName.Substring(0, pb.FileName.LastIndexOf("\\", StringComparison.Ordinal)); var lthumb = dir + "\\thumbs\\" + fn.Substring(0, fn.LastIndexOf(".", StringComparison.Ordinal)) + "_large.jpg"; FileOperations.Delete(lthumb); lthumb = dir + "\\thumbs\\" + fn.Substring(0, fn.LastIndexOf(".", StringComparison.Ordinal)) + ".jpg"; FileOperations.Delete(lthumb); } catch (Exception ex) { Log.Error("", ex); } flowPreview.Controls.Remove(pb); pb.Dispose(); }
private void DeletePreviewBox(PreviewBox pb) { _toDelete.Enqueue(pb.FileName); string[] parts = pb.FileName.Split('\\'); string fn = parts[parts.Length - 1]; try { switch (pb.Otid) { case 1: var vl = GetVolumeLevel(pb.Oid); vl?.RemoveFile(fn); break; case 2: var cw = GetCameraWindow(Convert.ToInt32(pb.Oid)); cw?.RemoveFile(fn); break; } } catch (Exception ex) { Logger.LogException(ex); } flowPreview.Controls.Remove(pb); pb.MouseDown -= PbMouseDown; pb.MouseEnter -= PbMouseEnter; pb.Dispose(); NeedsMediaRefresh = Helper.Now; _needsDelete = true; }