⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stock_detail.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 2 页
字号:
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;;;;;;;;;;;;;;;;;;;;;;;;;4,6 3b3f9830_manila.luac 

require("InforUpdating")
require("stock_svc")
require("hitfeedback")
InLandscapeMode = 0
ItemSizeWidth = 480
ItemSizeHeight = 80
StockManager = CStockManager(_application.Store)
RedIsUP = _application.Store:GetIntValue(Lifetime_Permanent, "StockData.RedIsUP") == 1
trace("@@@@@@@@Navigate In StockDetail@@@@@@@@")
HTTPTimeout = function()
   if StockManager == nil then
      return 
   end
   UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
   Script:GetMovieClip():RequestUpdate()
   SetupTimeUpdator()
   HTTPTimer:Stop()
   StockManager:CancelAllRequests()
   show_error()
end

StartHTTPRequestTimer = function()
   trace("Start StartHTTPRequestTimer")
   if HTTPTimer == nil then
      HTTPTimer = timer(60)
      HTTPTimer.OnElapsed:connect(HTTPTimeout)
      HTTPTimer:Start()
   else
      HTTPTimer:Start()
   end
end

HandleVisibilityChanged = function()
   if _application.Visibility == true then
      if IsUnknown == nil then
         UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
      else
         UpdateTime.String = ""
      end
      SetupTimeUpdator()
   elseif TimerUpdate ~= nil then
      TimerUpdate:Stop()
   end
end

TimerUpdate = nil
TimerTimeout = function()
   if StockManager == nil then
      return 
   end
   if IsUnknown == nil then
      UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
      txtLastUpdate._visible = true
   else
      UpdateTime.String = ""
      txtLastUpdate._visible = false
   end
   if autoDownloadOn then
      if(StockManager:GetPassThroughTime() >= nInterval or StockManager:GetPassThroughTime() < 0) then
        onPressUpdate()
      end
   end
end

SetupTimeUpdator = function()
   remainTime = nInterval
   if TimerUpdate == nil then
      TimerUpdate = timer(60)
      TimerUpdate.OnElapsed:connect(TimerTimeout)
      TimerUpdate:Start()
   else
      TimerUpdate:Start()
   end
end

RoamingDialogReturned = function(l_6_0)
   error_log = false
   l_6_0.OnExit:disconnect(RoamingDialogReturned)
   if l_6_0.Result.ExitType ~= DialogExitType_Cancel then
      trace("Click OK")
      UserRoamingOK = true
      onPressUpdate()
   else
      trace("Click Cancel")
   end
end

show_roaming_message = function()
   if error_log == true then
      trace("=== on press update ==== 2")
      return 
   end
   error_log = true
   trace("=== on press update ==== 2-1")
   local p = URL("Manila://Confirmation.dialog")
   p.Parameters:AddParameter("Title", Locale:GetString("IDS_ROAM_UPDATE_DLG_TITLE"))
   p.Parameters:AddParameter("ContentString", Locale:GetString("IDS_ROAM_UPDATE_DLG_MSG"))
   local dmg = _application.DialogManager:GetDialog(p)
   dmg.OnExit:connect(function(l_1_0)
      RoamingDialogReturned(l_1_0)
   end)
   dmg:Show()
end

UserRoamingOK = false
onPressUpdate = function()
   if StockManager == nil then
      return 
   end
   trace("=== on press update ====")
   if UpdateTime.String == Locale:GetString("IDS_UPDATING") then
      return 
   end
   if TimerUpdate ~= nil then
      TimerUpdate:Stop()
   end
   if not UserRoamingOK and StockManager:IsRoaming() == true and not DownloadWhenRoaming then
      show_roaming_message()
      return 
   end
   StartHTTPRequestTimer()
   UpdateTime.String = Locale:GetString("IDS_UPDATING")
   txtLastUpdate._visible = false
   if IsUnknown == nil then
     StockManager:Update(StockType_AllStocks, true)
   else
     trace("=== StockManager:Quote ====")
     StockManager:Quote(current_symbol)
   end
end

DialogReturned = function(l_9_0)
   error_log = false
   l_9_0.OnExit:disconnect(DialogReturned)
   if l_9_0.Result.ExitType ~= DialogExitType_Cancel then
      trace("Click OK")
      onPressUpdate()
   else
      trace("Click Cancel")
   end
end

show_error = function()
   trace(" show error ")
   if error_log == true then
      return 
   end
   error_log = true
   local p = URL("Manila://Confirmation.dialog")
   p.Parameters:AddParameter("Title", Locale:GetString("IDS_INFOR_ERROR_TITLE"))
   p.Parameters:AddParameter("ContentString", Locale:GetString("IDS_INFOR_CONNECTION_ERROR"))
   local dmg = _application.DialogManager:GetDialog(p)
   dmg.OnExit:connect(function(l_1_0)
      DialogReturned(l_1_0)
   end)
   dmg:Show()
end

display_stock = function(l_11_0)
   HighValue.String = l_11_0.High
   LowValue.String = l_11_0.Low
   CPValue.String = l_11_0.ChangePercent
   OpenValue.String = l_11_0.Open
   VolValue.String = l_11_0.Volume
   CompanyNameText.String = l_11_0.Name
   Pricing.String = l_11_0.Price
   local l_11_1 = l_11_0.Change
   local l_11_2 = l_11_1:sub(1, 1)   
   if l_11_2 == "-" then
      if RedIsUP then
         updownsymbol:SetTextureRef("Icon_G_Decrease")
         Change.Color = Color(0, 150, 0, 255)
      else
         updownsymbol:SetTextureRef("Icon_R_Decrease")
         Change.Color = Color(190, 0, 0, 255)
      end
      Change.String = l_11_1:sub(2)
      local l_11_3 = Change.String
      if l_11_3:len() < 6 then
         Change.String = l_11_3 .. " "
      end
      updownsymbol._visible = true
   elseif l_11_2 == "+" then
      if RedIsUP then
         updownsymbol:SetTextureRef("Icon_R_Increase")
         Change.Color = Color(190, 0, 0, 255)
      else
         updownsymbol:SetTextureRef("Icon_G_Increase")
         Change.Color = Color(0, 150, 0, 255)
      end
      Change.String = l_11_1:sub(2)
      local cs = Change.String
      if cs:len() < 6 then
         Change.String = cs .. " "
      end
      updownsymbol._visible = true
   else
      if RedIsUP then
         updownsymbol:SetTextureRef("Icon_R_Increase")
         Change.Color = Color(190, 0, 0, 255)
      else
         updownsymbol:SetTextureRef("Icon_G_Increase")
         Change.Color = Color(0, 150, 0, 255)
      end
      updownsymbol._visible = true
      Change.String = "0 "
   end
   RelatednewsUrl = "http://sg.m.yahoo.com/p/search;_ylt=ApbWK1sO1dStWOIj7CLRzviyC3cJ?p=" .. l_11_0.Symbol .. "&submit=oneSearch"
end

OnSingleQuoteComplete = function(l_12_0, l_12_1)
   if l_12_0 then
      trace("@@@@@@@@OnSingleQuoteComplete success@@@@@@@@")
      display_stock(l_12_1)
      showchart(current_symbol, chart_format, chart_vol, true)
   else
      trace("@@@@@@@@OnSingleQuoteComplete failed@@@@@@@@")
      show_error()
   end
end

GoBack = function()
   if StockManager == nil then
      return 
   end
   StockManager:CancelAllRequests()
   _application.Navigation:NavigateBack()
end

OnChartIsReady = function(l_14_0, l_14_1)
   if StockManager == nil then
      return 
   end
   HTTPTimer:Stop()
   if IsUnknown == nil then
      UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
      txtLastUpdate._visible = true
   else
      UpdateTime.String = ""
      txtLastUpdate._visible = false
   end
   if l_14_0 == false then
      show_error()
      return 
   end
   if l_14_1:len() == 0 then
      trace("_symbol length is 0")
      show_error()
      return 
   end
   trace("chart is ready: " .. l_14_1)
   if l_14_1:upper() ~= current_symbol:upper() then
      return 
   end
   local gcff = StockManager:GetChartFromFile(l_14_1, chart_format, chart_vol, ChartStyle_CS_WHITE)
   if gcff ~= nil then
      trace("~~~set texture~~~~")
      chart._visible = true
      chart:SetTexture(gcff)
      gcff:Clear()
      if chart_format == ChartFormat_CF_DAY and chart_vol == 1 then
         TypeSelector.Position.x = BtnPosition.d1.x
         TypeSelector.Position.y = BtnPosition.d1.y
         for i_1,i_2 in pairs(type_button) do
            i_2.Color = Color(0, 0, 0, 255)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -