/// <summary>添加处理器</summary> /// <param name="handler"></param> /// <returns></returns> public Binary AddHandler(IBinaryHandler handler) { if (handler != null) { handler.Host = this; Handlers.Add(handler); // 根据优先级排序 (Handlers as List <IBinaryHandler>).Sort(); } return(this); }
/// <summary>添加处理器</summary> /// <param name="handler"></param> /// <returns></returns> public Binary AddHandler(IBinaryHandler handler) { if (handler != null) { handler.Host = this; Handlers.Add(handler); // 根据优先级排序 Handlers = Handlers.OrderBy(e => e.Priority).ToList(); } return(this); }
// If the image changes, then the in-memory image needs to be unloaded void FileHandler_ContentsChanged(IBinaryHandler sender, EventArgs e) { FileHandler.ContentsChanged -= new EventHandler<IBinaryHandler, EventArgs>(FileHandler_ContentsChanged); _Image = null; }
void BinaryHandler_ContentsChanged(IBinaryHandler sender, EventArgs e) { foreach (string cachedView in Directory.GetFiles(CachePath, "*.cached")) File.Delete(cachedView); }