Now we hook the sqlite adds rather than the file.

This commit is contained in:
Lars Brubaker 2015-09-22 15:20:49 -07:00
parent 359d343b3e
commit dcec0ae890
2 changed files with 13 additions and 80 deletions

View file

@ -41,66 +41,6 @@ using System.Linq;
namespace MatterHackers.MatterControl
{
public class TempRootedObjectEventHandler
{
#if DEBUG
private event EventHandler InternalEventForDebug;
private List<EventHandler> DebugEventDelegates = new List<EventHandler>();
private event EventHandler InternalEvent
{
//Wraps the PrivateClick event delegate so that we can track which events have been added and clear them if necessary
add
{
InternalEventForDebug += value;
DebugEventDelegates.Add(value);
}
remove
{
InternalEventForDebug -= value;
DebugEventDelegates.Remove(value);
}
}
#else
EventHandler InternalEvent;
#endif
public void RegisterEvent(EventHandler functionToCallOnEvent, ref EventHandler functionThatWillBeCalledToUnregisterEvent)
{
InternalEvent += functionToCallOnEvent;
functionThatWillBeCalledToUnregisterEvent += (sender, e) =>
{
InternalEvent -= functionToCallOnEvent;
};
}
public void UnregisterEvent(EventHandler functionToCallOnEvent, ref EventHandler functionThatWillBeCalledToUnregisterEvent)
{
InternalEvent -= functionToCallOnEvent;
// After we remove it it will still be removed again in the functionThatWillBeCalledToUnregisterEvent
// But it is valid to attempt remove more than once.
}
public void CallEvents(Object sender, EventArgs e)
{
#if DEBUG
if (InternalEventForDebug != null)
{
InternalEventForDebug(this, e);
}
#else
if (InternalEvent != null)
{
InternalEvent(this, e);
}
#endif
}
}
public class ActivePrinterProfile
{
public enum SlicingEngineTypes { Slic3r, CuraEngine, MatterSlice };
@ -109,7 +49,7 @@ namespace MatterHackers.MatterControl
private static ActivePrinterProfile globalInstance = null;
public RootedObjectEventHandler ActivePrinterChanged = new RootedObjectEventHandler();
public TempRootedObjectEventHandler DoPrintLevelingChanged = new TempRootedObjectEventHandler();
public RootedObjectEventHandler DoPrintLevelingChanged = new RootedObjectEventHandler();
// private so that it can only be gotten through the Instance
private ActivePrinterProfile()