📄 stock_quote.luac.lua
字号:
StockManager:CancelAllRequests()
_application.Navigation:NavigateBack()
end))
end
end
Show_Error_Symbol = function()
error_box = true
onsearching = true
InputBox:SetShowWindowFlag(false)
local l_19_0 = URL("Manila://Confirmation.dialog")
l_19_0.Parameters:AddParameter("Type", "OK")
l_19_0.Parameters:AddParameter("Title", Locale:GetString("IDS_ERROR_SEARCH_TITLE"))
l_19_0.Parameters:AddParameter("ContentString", Locale:GetString("IDS_ERROR_SEARCH"))
local l_19_1 = _application.DialogManager:GetDialog(l_19_0)
l_19_1.OnExit:connect(function(l_1_0)
DialogReturned_ESymbol(l_1_0)
end)
l_19_1:Show()
end
RoamingDialogReturned = function(l_20_0)
onroaming = false
l_20_0.OnExit:disconnect(RoamingDialogReturned)
if l_20_0.Result.ExitType ~= DialogExitType_Cancel then
trace("Click OK")
UserRoamingOK = true
SearchBotton_OnRelease()
else
trace("Click Cancel")
InputBox:SetShowWindowFlag(true)
end
end
show_roaming_message = function()
if onroaming == true then
return
end
InputBox:SetShowWindowFlag(false)
onroaming = true
local l_21_0 = URL("Manila://Confirmation.dialog")
l_21_0.Parameters:AddParameter("Title", Locale:GetString("IDS_ROAM_UPDATE_DLG_TITLE"))
l_21_0.Parameters:AddParameter("ContentString", Locale:GetString("IDS_ROAM_UPDATE_DLG_MSG"))
local l_21_1 = _application.DialogManager:GetDialog(l_21_0)
l_21_1.OnExit:connect(function(l_1_0)
RoamingDialogReturned(l_1_0)
end)
l_21_1:Show()
end
SearchBotton_OnPress = function(l_22_0)
if onsearching then
return
end
SearchBotton:SetTextureRef("Bt_Search_press")
end
SearchBotton_OnRelease = function(l_23_0)
if onsearching then
return
end
if not UserRoamingOK and StockManager:IsRoaming() == true and not DownloadWhenRoaming then
show_roaming_message()
return
end
SearchBotton:SetTextureRef("Bt_Search_rest")
local l_23_1 = InputBox.WindowText
trace("[StockQuote] user input = " .. tostring(l_23_1) .. "\n")
trace("[StockQuote] size = " .. tostring(l_23_1:len()) .. "\n")
if l_23_1:len() > 0 then
ListPhysics:DisconnectMouseEvents()
local l_23_2 = StockManager:GetStockItemList(StockType_AllStocks)
StockManager:LoadSearchResult()
local l_23_3 = StockManager:GetStockItemList(StockType_Unknown)
local l_23_4 = SymbolCollection()
for i1 = 0, l_23_3:GetCount() - 1 do
local l_23_9 = l_23_3:GetItem(i1)
local l_23_10 = true
for i2 = 0, l_23_2:GetCount() - 1 do
local gi2 = l_23_2:GetItem(i2)
if gi2.Symbol == l_23_9.Symbol then
l_23_10 = false
break
end
end
if l_23_10 then
l_23_4:AddItem(l_23_9.Symbol)
end
end
StockManager:DeleteChart(l_23_4)
l_23_3:DeleteAll()
StockManager:SaveSearchResult()
StockListView._visible = false
StockListView.Opacity:Interpolate(0, 5, 0, Interpolate_EaseInQuad, nil)
StockManager:SymbolSearch(l_23_1)
ShowUpdatingIndicator()
onsearching = true
InputBox:SetShowWindowFlag(false)
StartHTTPRequestTimer()
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_CANCEL"),function()
StopUpdatingIndicator()
StockManager:CancelAllRequests()
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_INFOR_BACK"),function()
StockManager:CancelAllRequests()
_application.Navigation:NavigateBack()
end))
end))
end
end
SearchBotton_OnReleaseOutside = function(l_24_0)
if onsearching then
return
end
SearchBotton:SetTextureRef("Bt_Search_rest")
end
HTTPTimeout = function()
HTTPTimer:Stop()
StockManager:CancelAllRequests()
Show_Error_Connection()
end
StartHTTPRequestTimer = function()
trace("[StockSublayer] Start StartHTTPRequestTimer")
if HTTPTimer == nil then
HTTPTimer = timer(60)
HTTPTimer.OnElapsed:connect(HTTPTimeout)
HTTPTimer:Start()
else
HTTPTimer:Start()
end
end
QuoteComplete = function(l_27_0, l_27_1)
if StockManager == nil then
return
end
HTTPTimer:Stop()
ListPhysics:ConnectMouseEvents()
StockListView:ForceLayout()
StopUpdatingIndicator()
StockListView._visible = true
StockListView.Opacity:Interpolate(100, 10, 0, Interpolate_EaseInQuad, nil)
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_INFOR_BACK"), function()
StockManager:CancelAllRequests()
_application.Navigation:NavigateBack()
end))
if l_27_0 == false then
trace("[StockQuote] Search fail!!\n")
Show_Error_Connection()
return
end
StockManager:SaveSearchResult()
end
SymbolSearchComplete = function(l_28_0, l_28_1)
if StockManager == nil then
return
end
trace("[StockQuote] Symbol Search Complete!!\n")
local l_28_2 = _application.Store:GetIntValue(Lifetime_Application, "StockManager.ParseSymbol")
trace("[StockQuote] Symbol Search Complete, status=" .. l_28_2)
if l_28_0 == false then
if l_28_2 == 0 or l_28_2 == 1 or l_28_2 == 2 then
trace("[StockQuote] Search fail!!\n")
Show_Error_Connection()
elseif l_28_2 == 3 then
Show_Error_Symbol()
end
return
end
if l_28_1 == nil then
Show_Error_Symbol()
return
end
if l_28_1:GetCount() == 0 then
Show_Error_Symbol()
return
end
StockManager:Update(StockType_Unknown, true)
end
AddStockCallBack = function()
_application.Navigation:NavigateBack()
end
error_box = false
onroaming = false
InputBox_onPress = function(l_30_0, l_30_1)
if onsearching or error_box or onroaming then
return
end
_application:ShowInputPanel(0)
l_30_0:SetShowWindowFlag(true)
l_30_0:Focus()
end
FocusOutInputBox = function()
_application:HideInputPanel()
end
onInputBoxKeyDown = function(l_32_0, l_32_1, l_32_2)
trace("[StockQuote] ~~inputbox keydown~~~")
if l_32_1.Code == KeyCode_Return then
SearchBotton_OnRelease(nil)
end
end
objs3D = {}
objs3D[1] = SearchGroup
objs2D = {}
objs2D[1] = InputCam
setOffScreen()
OnNavigateOut = function(l_33_0)
_request.NavigateOutTo:disconnect(OnNavigateOut)
InputBox._visible = false
_application:EnableVelocityEngine(true)
InputBox:SetShowWindowFlag(false)
InputBox.onPress:disconnect(InputBox_onPress)
InputBox.onFocusOut:disconnect(FocusOutInputBox)
InputBox.onKeyDown:disconnect(onInputBoxKeyDown)
if StockManager ~= nil then
StockManager:CancelAllRequests()
end
Transition(l_33_0, "Out")
_application:HideInputPanel()
end
OnNavigateIn = function(l_34_0)
Transition(l_34_0, "In")
_application:EnableVelocityEngine(false)
start()
_application:ShowInputPanel(0)
end
start = function()
_application:SetRightSoftkey(Softkey("", function()
end))
_application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_INFOR_BACK"), function()
StockManager:CancelAllRequests()
_application.Navigation:NavigateBack()
end))
_application.Navigation.TabVisibility = false
DownloadWhenRoaming = _application.Store:GetIntValue(Lifetime_Permanent,"StockData.DownloadWhenRoaming") == 1
StockManager = CStockManager(_application.Store)
local l_35_0 = StockType_MyPortfolio
if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
trace("[StockDeletePage] : EnableLandscape")
require("Stock\\StockQuotePage_Landscape")
_StockQuotePage_ScreenRotation = StockQuotePage_ScreenRotation(StockListView, Camera_2D, Camera_3D, Mask, SearchBoxBackground, SearchBox, SearchBotton, InputBox, InputCam)
end
StockListView.Position.x = LVPositionX
StockListView.Position.y = LVPositionY
StockListView.Viewport.x = LVWidth
StockListView.Viewport.y = LVHeight
error_log = false
onsearching = false
RedIsUP = _application.Store:GetIntValue(Lifetime_Permanent, "StockData.RedIsUP") == 1
StockManager.OnSymbolSearchComplete:connect(SymbolSearchComplete)
StockManager.OnQuoteComplete:connect(QuoteComplete)
StockManager:LoadSearchResult()
SearchBotton.onPress:connect(SearchBotton_OnPress)
SearchBotton.onRelease:connect(SearchBotton_OnRelease)
SearchBotton.onReleaseOutside:connect(SearchBotton_OnReleaseOutside)
InputBox:SetShowWindowFlag(true)
InputBox.onPress:connect(InputBox_onPress)
InputBox.onFocusOut:connect(FocusOutInputBox)
InputBox.onKeyDown:connect(onInputBoxKeyDown)
UnknownStockList = StockManager:GetStockItemList(StockType_Unknown)
CreateListView(UnknownStockList, StockListView, nil)
ListPhysics = ScrollPhysics(StockListView, StockListView, HandleItemSelection)
if UnknownStockList:GetCount() > 0 then
ListPhysics:ConnectMouseEvents()
end
end
_request.NavigateOutTo:connect(OnNavigateOut)
_request.NavigateInFrom:connect(OnNavigateIn)
trace("[StockQuote] stock_quote.lua begin ")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -