public static TextureElement Create(string s) { TextureElement element = new TextureElement { FullPath = s, }; return(element); }
/// <summary> /// Disposes the control. /// </summary> /// <param name="disposing">Whether Dispose has been called.</param> protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (this.dropDownTexture != null) { this.dropDownTexture.Dispose(); this.dropDownTexture = null; } if (this.buttonElement != null) { this.buttonElement.MouseDown -= this.ButtonElementMouseDown; this.buttonElement = null; } } }
/// <summary> /// Disposes the control. /// </summary> /// <param name="disposing">Whether Dispose has been called.</param> protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { this.VScrollBarElement.ValueChanged -= this.OnScrollBarValueChanged; this.VScrollBarElement.VisibleChanged -= this.OnScrollBarVisibleChanged; this.vertScrollBarElement = null; this.HScrollBarElement.ValueChanged -= this.OnScrollBarValueChanged; this.HScrollBarElement.VisibleChanged -= this.OnScrollBarVisibleChanged; this.horiScrollBarElement = null; if (this.scrollBarCorner != null) { this.scrollBarCorner.Dispose(); this.scrollBarCorner = null; } } }
private void OnScrollBarVisibleChanged(object sender, EventArgs e) { if (this.VScrollBarElement.Visible && this.HScrollBarElement.Visible && !this.scrollBarCornerVisible) { this.scrollBarCornerVisible = true; this.SetupScrollBarCorner(); this.ScrollBarsNeedUpdate = true; } else { this.scrollBarCornerVisible = false; if (this.scrollBarCorner != null) { this.scrollBarCorner.Dispose(); this.scrollBarCorner = null; } } this.UpdateClientSize(); this.PerformLayout(); }
public TextureTableItem(int id, string texturePath) : base(id) { element = new TextureElement(texturePath); }
private static void TextureDirWatcherOnChanged(object sender, FileSystemEventArgs args) { string dir = Path.GetFileName(Path.GetDirectoryName(args.FullPath)); if (dir == null) { return; } dir = dir.ToLower(); WatcherChangeTypes changeType = args.ChangeType; string oldPath = changeType == WatcherChangeTypes.Renamed ? ((RenamedEventArgs)args).OldFullPath : args.FullPath; string newPath = args.FullPath; if (changeType == WatcherChangeTypes.Deleted || changeType == WatcherChangeTypes.Changed || changeType == WatcherChangeTypes.Renamed) { string pathli = oldPath.ToLowerInvariant(); if (TextureCache.ContainsKey(pathli)) { //[WXP] Replaced Lambda to new Func/Action Dispatcher.Invoke(new Func <bool>(() => TextureCache.Remove(pathli))); } } var collection = TextureList.ContainsKey(dir) ? TextureList[dir] : null; if (collection == null) { return; } TextureElement element = collection.FirstOrDefault (textureElement => textureElement.FullPath.Equals(oldPath, StringComparison.OrdinalIgnoreCase)); if (changeType == WatcherChangeTypes.Deleted && element != null) { //[WXP] Replaced Lambda to new Func/Action Dispatcher.Invoke(new Func <bool>(() => collection.Remove(element))); } if (changeType == WatcherChangeTypes.Created) { //[WXP] Replaced Lambda to new Func/Action Dispatcher.Invoke(new Action(() => collection.Add(TextureElement.Create(newPath)))); } if ((changeType != WatcherChangeTypes.Renamed && changeType != WatcherChangeTypes.Changed) || element == null) { return; } if (changeType == WatcherChangeTypes.Renamed) { element.FullPath = newPath; } element.RaiseChanges(); }