The XML is being loaded after the .lua. You don't say if your .lua file is being made part of the addon or a separate addon so I will assume separate and this should work in either case unless the original addon is Load-On-Demand.
Lua Code:
local Incoming = CreateFrame("Frame", "SharpedgeFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate");
Incoming:SetBackdrop({
bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
tile=1, tileSize=32, edgeSize=32,
insets={left=11, right=12, top=12, bottom=11}
})
Incoming:Hide()
Incoming:SetWidth(139)
Incoming:SetHeight(190)
Incoming:SetPoint("CENTER",UIParent)
Incoming:EnableMouse(true)
Incoming:SetMovable(true)
Incoming:RegisterForDrag("LeftButton")
Incoming:SetScript("OnDragStart", function(self) self:StartMoving() end)
Incoming:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
Incoming:SetFrameStrata("FULLSCREEN_DIALOG")
local button = CreateFrame("button","IncomingButton", Incoming, "UIPanelButtonTemplate")
button:SetHeight(24)
button:SetWidth(60)
button:SetPoint("BOTTOM", Incoming, "BOTTOM", 0, 10)
button:SetText("Close")
button:SetScript("OnClick", function(self) self:GetParent():Hide() end)
Incoming:RegisterEvent("PLAYER_LOGIN")
Incoming:SetScript("OnEvent", function(self, event, ...)
LocationMessageView:Show()
LocationMessageView:SetParent(self)
LocationMessageView:ClearAllPoints()
LocationMessageView:SetPoint("TOP")
LocationMessageView:SetMovable(false)
LocationMessageView:EnableMouse(false)
end)