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

📄 clockview.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 4 页
字号:
      if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
         trace("[ClockPageView] : EnableLandscape")
         require("WorldClock\\ClockPageEdit_Landscape")
         PageSetLocalTime_Landscape = ClockPageEdit_ScreenRotation(Camera2D_SetLocalTime, ClockPageEdit_Mask, LvSetLocalTime, PageSetLocalTime_PhysicalScroll)
         PageSetLocalTime_Landscape._generator = l_48_0.ItemListGenerator
      end
   else
      psltTxtDate.String = PageSetLocalTime_TempTime:GetDateString("MMM d, yyyy")
      psltTxtTimeZone.String = PageSetLocalTime_TempTimeZone.Name
      if PageSetLocalTime_FirstLoad then
        PageSetLocalTime_FirstLoad = false
        local time = Time_GetNow()
        time:ToSpecificLocalTime(PageSetLocalTime_TempTimeZone.TimeZone)
        PageSetLocalTime_OriginalHour = time:GetActualHour()
        PageSetLocalTime_OriginalMinute = time.Minute
        TimeUI_init(time:GetActualHour(), time.Minute, l_48_0.ItemListGenerator:GetItem(0))
        TimeUI_ConnectTimeUI()
      else
        PageSetLocalTime_Dirty = true
      end
      psltSprDatePicker.onRelease:connect(l_48_0.OnDatePickerRelease, l_48_0)
      psltSprTimeZone.onRelease:connect(l_48_0.OnTimeZoneRelease, l_48_0)
      if PageSetLocalTime_Landscape ~= nil then
        PageSetLocalTime_Landscape:AdjustListviewItemLayout(0, l_48_0.ItemListGenerator:GetItem(0))
      end
   end
    l_48_0.Node._visible = true
   _application.Navigation.TabVisibility = false
   _application.TouchFlo.HorizontalEnabled = false
   _application.Navigation.Title = Locale:GetString("IDS_LocalTimeSettings_Title")
   _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_DONE"), PageSetLocalTime_OnLsk))
   _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_CANCEL"), PageSetLocalTime_OnRsk))
end

PageSetLocalTime.HidePage = function(l_49_0)
   _application.TouchFlo.HorizontalEnabled = true
   l_49_0.Node._visible = false
end

PageSetLocalTime_OnLsk = function()
   FrmClockView.WcMgr:SetTimeZone(PageSetLocalTime_TempTimeZone)
   local l_50_0 = -1
   local l_50_1 = -1
   for i = 0, FrmClockView.CityList:GetCount() - 1 do
      if FrmClockView.CityList:GetItem(i).IsLocalTime then
         l_50_0 = i
         FrmClockView.CityList:GetItem(i).IsLocalTime = false
      end
      if FrmClockView.CityList:GetItem(i).CityCode == PageSetLocalTime_TempTimeZone.CityCode then
         l_50_1 = i
         FrmClockView.CityList:GetItem(i).IsLocalTime = true
         _application.Store:SetStringValue(Lifetime_Permanent, "WorldClock.Local", PageSetLocalTime_TempTimeZone.CityCode)
      end
   end
   if l_50_1 == -1 and l_50_0 ~= -1 then
      local item = FrmClockView.CityList:GetItem(l_50_0)     
      item.CityCode = PageSetLocalTime_TempTimeZone.CityCode
      item.Name = PageSetLocalTime_TempTimeZone.Name
      item.TimeZone = PageSetLocalTime_TempTimeZone.TimeZone
      item.IsLocalTime = true
      _application.Store:SetStringValue(Lifetime_Permanent, "WorldClock.Local", PageSetLocalTime_TempTimeZone.CityCode)
   end
   FrmClockView.WcMgr:SetCityList(FrmClockView.CityList)
   FrmClockView.WcMgr:SetLocalTime(PageSetLocalTime_TempTime.Year, PageSetLocalTime_TempTime.Month, PageSetLocalTime_TempTime.Day, TimeUI_Time:GetActualHour(), TimeUI_Time.Minute, TimeUI_Time.Second, PageSetLocalTime_TempTimeZone)
   FrmClockView:Switch(FrmClockView.PageView)
end

PageSetLocalTime_OnRsk = function()
   FrmClockView:Switch(FrmClockView.PageView)
end

PageSetLocalTime.OnItemCreated = function(l_52_0, l_52_1, l_52_2)
   trace("function PageSetLocalTime::OnItemCreated( Data, UIElement )")
   psltTxtDate = l_52_2.Namespace:FindName("TxtDate")
   psltTxtDate.String = PageSetLocalTime_TempTime:GetDateString("MMM d, yyyy")
   psltTxtTimeZone = l_52_2.Namespace:FindName("TxtTimeZone")
   psltTxtTimeZone.String = PageSetLocalTime_TempTimeZone.Name
   psltWCTimeDateSender = l_52_2.Namespace:FindName("WCTimeDateSender")
   psltTimeZoneSender = l_52_2.Namespace:FindName("TimeZoneSender")
   psltWCTimeDateSender.String = Locale:GetString("IDS_WSDATE")
   psltTimeZoneSender.String = Locale:GetString("IDS_TIMEZONE")
   if PageSetLocalTime_FirstLoad then
     PageSetLocalTime_FirstLoad = false
     local time = Time_GetNow()
     time:ToSpecificLocalTime(PageSetLocalTime_TempTimeZone.TimeZone)
     PageSetLocalTime_OriginalHour = time:GetActualHour()
     PageSetLocalTime_OriginalMinute = time.Minute
     TimeUI_init(time:GetActualHour(), time.Minute, l_52_2)
     TimeUI_ConnectTimeUI()
   else
     PageSetLocalTime_Dirty = true
   end
   psltSprDatePicker = l_52_2.Namespace:FindName("SprDatePicker")
   psltSprDatePicker.onRelease:connect(l_52_0.OnDatePickerRelease, l_52_0)
   psltSprTimeZone = l_52_2.Namespace:FindName("SprTimeZone")
   psltSprTimeZone.onRelease:connect(l_52_0.OnTimeZoneRelease, l_52_0)
   if PageSetLocalTime_Landscape ~= nil then
      PageSetLocalTime_Landscape:AdjustListviewItemLayout(l_52_1, l_52_2)
   end
end

PageSetLocalTime.OnItemDestroyed = function(l_53_0, l_53_1)
   psltSprDatePicker.onRelease:disconnect(l_53_0.OnDatePickerRelease, l_53_0)
   psltSprTimeZone.onRelease:disconnect(l_53_0.OnTimeZoneRelease, l_53_0)
end

PageSetLocalTime.OnDatePickerPress = function(l_54_0)
   PageSetLocalTime_Dirty = true
   FrmClockView:Switch(FrmClockView.PageDatePicker)
end

PageSetLocalTime.OnDatePickerRelease = function(l_55_0)
   PageSetLocalTime_Dirty = true
   FrmClockView:Switch(FrmClockView.PageDatePicker)
end

PageSetLocalTime.OnTimeZonePress = function(l_56_0)
   PageSetLocalTime_Dirty = true
   FrmClockView:Switch(FrmClockView.PageAdd)
end

PageSetLocalTime.OnTimeZoneRelease = function(l_57_0)
   PageSetLocalTime_Dirty = true
   FrmClockView:Switch(FrmClockView.PageAdd)
end

PageSetLocalTime.SetTempTimeZone = function(l_58_0, l_58_1, l_58_2, l_58_3)
   PageSetLocalTime_TempTimeZone.CityCode = l_58_1
   PageSetLocalTime_TempTimeZone.Name = l_58_2
   PageSetLocalTime_TempTimeZone.TimeZone = l_58_3
   if nil ~= TxtTimeZone then
      TxtTimeZone.String = PageSetLocalTime_TempTimeZone.Name
   end
end

PageSetLocalTime.SetNewDate = function(l_59_0, l_59_1, l_59_2, l_59_3)
   PageSetLocalTime_TempTime:SetYear(l_59_1)
   PageSetLocalTime_TempTime:SetMonth(l_59_2)
   PageSetLocalTime_TempTime:SetDay(l_59_3)
   if nil ~= TxtDate then
      TxtDate.String = PageSetLocalTime_TempTime:GetDateString("MMM d, yyyy")
   end
end

WorldClock.Clock.Form = class()
WorldClock.Clock.Form.__init = function(l_60_0)
   objs3D = {}
   objs3D[1] = KeyboardHandler
   setOffScreen()
   l_60_0.PrevPage = nil
   l_60_0.CurrPage = nil
   l_60_0.SelectedData = nil
   l_60_0.SelectedElement = nil
   l_60_0.Weather = AccuWeather(_application:GetScopedLog("weather"), _application.Store)
   l_60_0.PageView = WorldClock.Clock.PageView()
   l_60_0.PageDelete = WorldClock.Clock.PageDelete()
   l_60_0.PageRearrange = WorldClock.Clock.PageRearrange()
   l_60_0.PageEdit = PageSetLocalTime()
   l_60_0.PageAdd = WorldClock.Clock.PageAdd()
   l_60_0.PageDatePicker = DatePicker()
   _request.NavigateInFrom:connect(l_60_0.OnFormLoad, l_60_0)
   _request.NavigateOutTo:connect(l_60_0.OnFormClosed, l_60_0)
end

WorldClock.Clock.Form.Switch = function(l_61_0, l_61_1)
   if nil ~= l_61_0.CurrPage then
      l_61_0.CurrPage:HidePage()
   end
   l_61_1:ShowPage()
   l_61_0.PrevPage = l_61_0.CurrPage
   l_61_0.CurrPage = l_61_1
end

WorldClock.Clock.Form.OnFormLoad = function(l_62_0, l_62_1)
   _request.NavigateInFrom:disconnect(l_62_0.OnFormLoad, l_62_0)
   Transition(l_62_1, "In")
   l_62_0.MachineStatus = MachineStatus()
   l_62_0.WcMgr = WorldClockManager()
   if _application.Store:GetIntValue(Lifetime_Permanent, "WorldClock.IsPreset") == 0 then
      l_62_0.CityList = l_62_0.WcMgr:Preset()
      l_62_0.WcMgr:SetCityList(l_62_0.CityList)
      _application.Store:SetIntValue(Lifetime_Permanent, "WorldClock.IsPreset", 1)
   else
      l_62_0.CityList = l_62_0.WcMgr:GetCityList()
   end
   for i = 0, l_62_0.CityList:GetCount() - 1 do
      if l_62_0.CityList:GetItem(i).IsLocalTime then
         l_62_0.SelectedData = l_62_0.CityList:GetItem(i)
         break         
      end
   end
   l_62_0.OriginalCityCode = l_62_0.SelectedData.CityCode
   KeyboardHandler.Focusable = true
   KeyboardHandler:Focus()
   KeyboardHandler.onKeyUp:connect(l_62_0.OnKeyUp, l_62_0)
   _application.OnVisibilityChanged:connect(OnVisibilityChanged)
   l_62_0:Switch(l_62_0.PageView)
end

WorldClock.Clock.Form.OnFormClosed = function(l_63_0, l_63_1)
   _request.NavigateOutTo:disconnect(l_63_0.OnFormClosed, l_63_0)
   Transition(l_63_1, "Out")
   if nil ~= InputBox then
     InputBox:SetShowWindowFlag(false)
   end
   if FrmClockView.SelectedData.CityCode ~= FrmClockView.OriginalCityCode or TimeZone_IsTimeZoneChanged() then
      local time = Time_GetNow();
      time:ToSpecificLocalTime(FrmClockView.SelectedData.TimeZone)
      FrmClockView.WcMgr:SetLocalTime(time.Year, time.Month, time.Day, time:GetActualHour(), time.Minute, time.Second, FrmClockView.SelectedData)
      FrmClockView.WcMgr:SetTimeZone(FrmClockView.SelectedData)
      for i = 0, FrmClockView.CityList:GetCount() - 1 do
         if FrmClockView.CityList:GetItem(i).IsLocalTime then
            _application.Store:SetStringValue(Lifetime_Permanent, "WorldClock.Local", FrmClockView.CityList:GetItem(i).CityCode)
         end
      end
   end
   TimeZone_ToRegistry()
   KeyboardHandler.onKeyUp:disconnect(l_63_0.OnKeyUp, l_63_0)
   _application.OnVisibilityChanged:disconnect(OnVisibilityChanged)
   if nil ~= l_63_0.CurrPage then
      l_63_0.CurrPage:HidePage()
   end
end

OnVisibilityChanged = function()
   if _application.Visibility and TimeZone_IsTimeZoneChanged() then
      FrmClockView.PageView.ItemListGenerator.SelectedIndex = -1
      for i = FrmClockView.CityList:GetCount() - 1, 0, -1 do
         FrmClockView.CityList:DeleteItem(i)
      end
      local l_64_0 = FrmClockView.WcMgr:GetCityList()
      for i = 0, l_64_0:GetCount() - 1 do
         FrmClockView.CityList:AddItem(l_64_0:GetItem(i))
      end
      _application.Store:SetStringValue(Lifetime_Permanent, "WorldClock.Local", "(system)")
   end
end

WorldClock.Clock.Form.OnKeyUp = function(l_65_0, l_65_1, l_65_2, l_65_3)
   if l_65_2.Code == KeyCode_Back then
      if l_65_0.PageAdd == l_65_0.CurrPage then
         if CountryPickerList._visible then
            l_65_0:Switch(l_65_0.PrevPage)
         else
            WorldClock.Clock.PageAdd_BackToCountry()
         end
      else
         if l_65_0.PageEdit == l_65_0.CurrPage then
            l_65_0:Switch(l_65_0.PageView)
         else
            if l_65_0.PageDelete == l_65_0.CurrPage then
               l_65_0:Switch(l_65_0.PageView)
            else
               if l_65_0.PageRearrange == l_65_0.CurrPage then
                  l_65_0:Switch(l_65_0.PageView)
               else
                  if l_65_0.PageDatePicker == l_65_0.CurrPage then
                     l_65_0:Switch(l_65_0.PageEdit)
                  else
                     if l_65_0.PageView == l_65_0.CurrPage then
                        _application.Navigation:NavigateBack()
                     end
                  end
               end
            end
         end
      end
      l_65_3.value = true      
   end
end

FrmClockView = WorldClock.Clock.Form()

⌨️ 快捷键说明

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