public void FromTo(ILockLibraryItem locker, int lockCounter) { FileLibraryItem item = locker as FileLibraryItem; this._path = item._path; this.Name = item.Name; }
public static FileLibraryItem Create(LibraryType type, string path) { if (!string.IsNullOrEmpty(path) || File.Exists(path)) { return(null); } FileLibraryItem item = null; if (type == LibraryType.Image) { item = new ImageInfo(); } else if (type == LibraryType.Video) { item = new VideoInfo(); } else { return(null); } item.Path = path; return(item); }
private ShapeLayer AddVideoLayer(FileLibraryItem item, SignInfo sign) { if (item == null || sign == null) { return(null); } ShapeVideo shape = new ShapeVideo(); if (!SetSignInfo(shape, sign)) { return(null); } shape.VideoUrl = item.Path; shape.IsBackground = true; shape.OldVirtualBound = new System.Drawing.Rectangle(0, 0, sign.Width / 2, sign.Height / 2); shape.FileHandle = item.Id; ShapeLayer layer = new ShapeLayer(shape); layer.Name = "Layer 1"; layer.EmphasisEffect.Duration = sign.Template.Message.DisplayTime; return(layer); }
private ShapeLayer AddVideoLayer(FileLibraryItem item, int length, SignInfo sign) { if (item == null || sign == null) { return(null); } ShapeVideo shape = new ShapeVideo(); if (!SetSignInfo(shape, sign)) { return(null); } shape.VideoUrl = item.Path; shape.IsBackground = true; shape.OldVirtualBound = new System.Drawing.Rectangle(0, 0, sign.Width / 2, sign.Height / 2); shape.FileHandle = item.Id; ShapeLayer layer = new ShapeLayer(shape); layer.Name = "Layer 1"; //layer.EmphasisEffect.StartTime = 0; //layer.EmphasisEffect.EndTime = long.Parse(length.ToString()); //layer.EmphasisEffect.Duration = length;// sign.Template.Message.DefaultLength; layer.EmphasisEffect.Left = 0; layer.EmphasisEffect.Width = sign.Template.Message.DisplayTime * Constance.Effect.UnitWidth; return(layer); }
private ShapeLayer AddImageLayer(FileLibraryItem item, SignInfo sign) { if (item == null || sign == null) { return(null); } ShapeImage shape = new ShapeImage(); if (!SetSignInfo(shape, sign)) { return(null); } shape.ImageUrl = item.Path; shape.IsBackground = true; shape.OldVirtualBound = new System.Drawing.Rectangle(0, 0, sign.Width / 2, sign.Height / 2); shape.FileHandle = item.Id; //shape.ComputeDestBoundBatchLoad(); ShapeLayer layer = new ShapeLayer(shape); layer.Name = "Layer 1"; //layer.EmphasisEffect.StartTime = 0; //layer.EmphasisEffect.EndTime = long.Parse(sign.Template.Message.DisplayTime.ToString()); layer.EmphasisEffect.Left = 0; layer.EmphasisEffect.Width = sign.Template.Message.DisplayTime * Constance.Effect.UnitWidth; shape.ComputeDestBoundBatchLoad(); return(layer); }
private bool CanDeleteFile(FileLibraryItem item) { string fileName = null; //foreach (Layer layer in _staticLayers) foreach (ShapeLayer layer in _layers) { switch (item.Type) { case LibraryType.Image: if (layer.Shape.Type == ShapeType.Image) { fileName = (layer.Shape as ShapeImage).ImageUrl; } break; case LibraryType.Video: if (layer.Shape.Type == ShapeType.Video) { fileName = (layer.Shape as ShapeVideo).VideoUrl; } break; } if (string.Equals(fileName, item.Path, StringComparison.OrdinalIgnoreCase)) { return(true); } } return(false); }
public bool CanDeleteFileLibrary(FileLibraryItem lib) { Check.Assert(lib != null); foreach (LibraryGroup item in this) { if (!item.CanDeleteLibrary(lib)) { return(false); } } return(true); }
public LibraryDeleteItem CanDeleteFileLibraryNew(FileLibraryItem lib) { LibraryDeleteItem deleteItem = new LibraryDeleteItem(); Check.Assert(lib != null); foreach (LibraryGroup item in this) { deleteItem = item.CanDeleteLibraryNew(lib); if (deleteItem.State == LibraryState.Referrence) { deleteItem.GroupName = item.Name; return(deleteItem); } } return(deleteItem); }
public bool Add(FileLibraryItem item, int length, SignInfo sign) { ShapeLayer layer = null; if (item.Type == LibraryType.Image) { layer = AddImageLayer(item, length, sign); } else if (item.Type == LibraryType.Video) { layer = AddVideoLayer(item, length, sign); } if (layer != null) { Add(layer); return(true); } return(false); }