Looking to customize the resource scheduling board. I have looked around and was wondering if someone can point me to location of the method and properties i can use to add columns to the list view and add more information to the chart. Unless Epicor has made it nicer in the new UI
That is super helpful. I scanned through that - does the bar text get updated with the ToolTip or is that just a tooltip that appears when hovering? My main goal is to update the text on the “TimeItems” I think is what they are called. By default, it shows me a job # and something in parenthesis.
Ah that’s another code snippet I’ll find it for you, here you go. Again Really old code snips so use at your own risk
//Gist File: events_remove.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
//Useage
//cEventHandler.RemoveAllEventHandlers(naughty_object);
//cEventHelper.RemoveEventHandler(naughty_object, "SomeEvent");
static public class cEventHelper
{
static Dictionary<type, list<fieldinfo="">> dicEventFieldInfos = new Dictionary<type, list<fieldinfo="">>();
static BindingFlags AllBindings
{
get { return BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; }
}
//--------------------------------------------------------------------------------
static List<fieldinfo> GetTypeEventFields(Type t)
{
if (dicEventFieldInfos.ContainsKey(t))
return dicEventFieldInfos[t];
List<fieldinfo> lst = new List<fieldinfo>();
BuildEventFields(t, lst);
dicEventFieldInfos.Add(t, lst);
return lst;
}
//--------------------------------------------------------------------------------
static void BuildEventFields(Type t, List<fieldinfo> lst)
{
// Type.GetEvent(s) gets all Events for the type AND it's ancestors
// Type.GetField(s) gets only Fields for the exact type.
// (BindingFlags.FlattenHierarchy only works on PROTECTED & PUBLIC
// doesn't work because Fieds are PRIVATE)
// NEW version of this routine uses .GetEvents and then uses .DeclaringType
// to get the correct ancestor type so that we can get the FieldInfo.
foreach (EventInfo ei in t.GetEvents(AllBindings))
{
Type dt = ei.DeclaringType;
FieldInfo fi = dt.GetField(ei.Name, AllBindings);
if (fi != null)
lst.Add(fi);
}
// OLD version of the code - called itself recursively to get all fields
// for 't' and ancestors and then tested each one to see if it's an EVENT
// Much less efficient than the new code
/*
foreach (FieldInfo fi in t.GetFields(AllBindings))
{
EventInfo ei = t.GetEvent(fi.Name, AllBindings);
if (ei != null)
{
lst.Add(fi);
Console.WriteLine(ei.Name);
}
}
if (t.BaseType != null)
BuildEventFields(t.BaseType, lst);*/
}
//--------------------------------------------------------------------------------
static EventHandlerList GetStaticEventHandlerList(Type t, object obj)
{
MethodInfo mi = t.GetMethod("get_Events", AllBindings);
return (EventHandlerList)mi.Invoke(obj, new object[] { });
}
//--------------------------------------------------------------------------------
public static void RemoveAllEventHandlers(object obj) { RemoveEventHandler(obj, ""); }
//--------------------------------------------------------------------------------
public static void RemoveEventHandler(object obj, string EventName)
{
if (obj == null)
return;
Type t = obj.GetType();
List<fieldinfo> event_fields = GetTypeEventFields(t);
EventHandlerList static_event_handlers = null;
foreach (FieldInfo fi in event_fields)
{
if (EventName != "" && string.Compare(EventName, fi.Name, true) != 0)
continue;
// After hours and hours of research and trial and error, it turns out that
// STATIC Events have to be treated differently from INSTANCE Events...
if (fi.IsStatic)
{
// STATIC EVENT
if (static_event_handlers == null)
static_event_handlers = GetStaticEventHandlerList(t, obj);
object idx = fi.GetValue(obj);
Delegate eh = static_event_handlers[idx];
if (eh == null)
continue;
Delegate[] dels = eh.GetInvocationList();
if (dels == null)
continue;
EventInfo ei = t.GetEvent(fi.Name, AllBindings);
foreach (Delegate del in dels)
ei.RemoveEventHandler(obj, del);
}
else
{
// INSTANCE EVENT
EventInfo ei = t.GetEvent(fi.Name, AllBindings);
if (ei != null)
{
object val = fi.GetValue(obj);
Delegate mdel = (val as Delegate);
if (mdel != null)
{
foreach (Delegate del in mdel.GetInvocationList())
ei.RemoveEventHandler(obj, del);
}
}
}
}
}
}
//Gist File: removeValidatingEvent.cs
//This will remove the initial event when you type a JobNum in JobEntry -JG From Frazier customization
Type type = etb.GetType();
var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
var eventInfo = type.GetEvent("Validating", bindingFlags);
Type tHandler = eventInfo.EventHandlerType;
Erp.UI.App.JobEntry.JobHeadDetailPanel jd = csm.GetNativeControlReference("d08296b1-a700-4a45-aa1a-475309696931") as Erp.UI.App.JobEntry.JobHeadDetailPanel;
MethodInfo mi = jd.GetType().GetMethod("txtKeyField_Validating",BindingFlags.NonPublic | BindingFlags.Instance);
Delegate del = Delegate.CreateDelegate(tHandler, jd, mi);
// detach the event handler
if (del != null)
eventInfo.RemoveEventHandler(etb, del);
Sorry - still not quite there. Now I’m getting this error and I feel like it’s a silly one that I should be able to figure out but after about 20 minutes now, I’m not finding it. Any help for this?
Thank you @josecgomez and @klincecum. I’m not all the way there yet but I am past the silly errors. The camel case thing has gotten me before. You’d think I’d learn.
Now I have to figure out how to make it work. I see no difference in my Multi Resource Scheduling Board.