private TracedHog(double x, double y, int id)
    {
        this.X  = x;
        this.Y  = y;
        this.ID = id;

        TracedHogManager.RegisterHogForID(id, this);

        WorkspaceEvents.WorkspaceAdded += WorkspaceEventsWorkspaceAdded;
    }
    public static TracedHog ByPoint(double x, double y)
    {
        TracedHog tHog;

        HogID hid = TraceUtils.GetTraceData(REVIT_TRACE_ID) as HogID;

        if (hid == null)
        {
            // Trace didn't give us a hog, it's a new one.
            tHog = new TracedHog(x, y);
        }
        else
        {
            tHog = TracedHogManager.GetHogByID(hid.IntID);
        }

        // Set the trace data on the return to be this hog.
        TraceUtils.SetTraceData(REVIT_TRACE_ID, new HogID {
            IntID = tHog.ID
        });
        return(tHog);
    }
 private TracedHog(double x, double y)
     : this(x, y, TracedHogManager.GetNextUnusedID())
 {
 }