protected override bool OnExchange(SciterElement element, ExchangeArgs args) { switch (args.Event) { case ExchangeEvent.DragEnter: element.SetAttributeValue("active", "true"); return(true); case ExchangeEvent.DragLeave: element.RemoveAttribute("active"); return(true); case ExchangeEvent.Drag: return(true); case ExchangeEvent.Drop: element.RemoveAttribute("active"); var fileList = new List <string>(); if (args.Value.IsArray) { fileList.AddRange(args.Value.AsEnumerable().Where(w => w.IsString).Select(s => s.AsString())); } if (args.Value.IsString) { fileList.Add(args.Value.AsString()); } element.SetHtml(string.Concat(fileList.Select(s => SciterElement.Create("text", s).Html))); return(true); case ExchangeEvent.WillAcceptDrop: // Use this for a drop filter! //var fileList = new List<string>(); //if (args.Value.IsArray) // fileList.AddRange(args.Value.AsEnumerable().Where(w => w.IsString).Select(s => s.AsString())); //if (args.Value.IsString) // fileList.Add(args.Value.AsString()); //return fileList.All(a => Path.GetExtension(a).Equals(".exe")); return(true); default: return(base.OnExchange(element, args)); } }
protected override void Attached(SciterElement element) { element.Parent.OnCustomEvent((eventName, source, target, value) => { switch (eventName) { case "waiting": if (value.IsString) { element.SetHtml($"<text>{value.AsString()}</text>"); source.SetAttributeValue("waiting", "true"); } else if (value.IsBool) { source.SetAttributeValue("waiting", (string)null); element.ClearText(); } break; } }); base.Attached(element); }