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

📄 29.lua

📁 htc manila 2 sourcecode
💻 LUA
字号:
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;0,4;;0,6;;0,4;0,4;0,0,2,6;;0,0,4;3;8;;5,17;3;;;;79,85,91,92; 1f3be060_manila_19688.luac 

trace("Loaded Settings Script\n")
require("ScrollPhysics")
require("theme")
LVPositionX = 0
LVPositionY = 0
LVWidth = 480
LVHeight = 560
ItemSizeWidth = 480
ItemSizeHeight = 81
Settings_MapVisibleElements = {}
Settings_MapSettingsItemUI = {}
if _config_os == "windowsmobile" then
   require("machine_status_svc")
   Settings_MachineStatus = MachineStatus()
end
SettingsItemUI = class()
SettingsItemUI.__init = function(l_1_0, l_1_1, l_1_2, l_1_3, l_1_4)
   l_1_0.Text = l_1_1
   l_1_0.DetailText = l_1_2
   l_1_0.TextureRest = l_1_3
   l_1_0.TexturePressed = l_1_4
end

AboutUrl = "file:/windows/manila_about.html"
IsDisabled = function(l_2_0)
   local l_2_1 = l_2_0.Namespace:FindName("ControlGroup")
   return SyncIsVisible ~= true
end

Settings_HandleItemPressed = function(l_3_0)
   trace("Hit: " .. Settings_MapSettingsItemUI[l_3_0.Tag.Data].Text .. "\n")
   if _config_os == "windowsmobile" then
      if Settings_MapSettingsItemUI[l_3_0.Tag.Data] == SyncSettingsItemUI then
         if not IsDisabled(l_3_0) then
            local sv = Settings_MachineStatus.Synchronizing.Value
            Settings_MachineStatus.Synchronizing.Value = not sv
         else
            local wr = "\\Windows\\repllog.exe"
            local p = "/remote"
            Shell_NavigateTo(wr, p)
         end
      elseif Settings_MapSettingsItemUI[l_3_0.Tag.Data] == SoundsSettingsItemUI then
         _application.Navigation:Navigate(URL("Manila://settings/sounds/sounds.page"), true)
      elseif Settings_MapSettingsItemUI[l_3_0.Tag.Data] == WallpaperSettingsItemUI then
         if Settings_MachineStatus.HomeBackgroundPath.Value == "" then
            Settings_SetWallpaper()
         else
            local url = URL("Manila://Confirmation.dialog")
            url.Parameters:AddParameter("Title", Locale:GetString("IDS_WALLPAPER"))
            url.Parameters:AddParameter("ContentString", Locale:GetString("IDS_WALLPAPER_MSG"))
            local dlg = _application.DialogManager:GetDialog(url)
            dlg.OnExit:connect(Settings_WallpaperDialogReturned)
            dlg:Show()
         end
      elseif Settings_MapSettingsItemUI[l_3_0.Tag.Data] == CommunicationsSettingsItemUI then
         local cm = "\\Windows\\CommManager.exe"
         local param = ""
         _application.Navigation:Navigate(URL("Manila://shell.page?command=" .. cm .. "&parameters=" .. param), false)
      elseif Settings_MapSettingsItemUI[l_3_0.Tag.Data] == RearSettingsItemUI then
         _application.Navigation:Navigate(URL("Manila://settings/configuration/configuration.page"), true)
      elseif Settings_MapSettingsItemUI[l_3_0.Tag.Data] == UpdatesAndDataSettingsItemUI then
         _application.Navigation:Navigate(URL("Manila://settings/updatesanddata/updatesanddata.page"), true)
      elseif Settings_MapSettingsItemUI[l_3_0.Tag.Data] == AboutSettingsItemUI then
         Shell_NavigateTo(ShellLocation_Opera, AboutUrl)
      elseif Settings_MapSettingsItemUI[l_3_0.Tag.Data] == MyProfileSettingsItemUI then
         Shell_ContactEditor("Me")
      elseif Settings_MapSettingsItemUI[l_3_0.Tag.Data] == EmailSetupItemUI then
         Shell_NavigateTo(ShellLocation_EmailAddAccount)
      end
   end
end

Settings_HitIndex = function(l_4_0)
   local l_4_1 = SettingsListView:GetGenerator():GetItem(l_4_0)
   Settings_HandleItemPressed(l_4_1)
end

Settings_HandleKey = function(l_5_0, l_5_1, l_5_2)
   if l_5_1.Code == KeyCode_Return or l_5_1.Code == KeyCode_Space then
      Settings_HandleItemPressed(l_5_0)
      l_5_2.value = true
   end
end

Settings_HandleSelected = function(l_6_0)
   local l_6_1 = l_6_0.Namespace:FindName("MainText")
   local dt = l_6_0.Namespace:FindName("DetailText")
   local ib = l_6_0.Namespace:FindName("IconBox")
   if not Settings_DontToggleIconsOnSelected then
      ib:SetTextureRef(Settings_MapSettingsItemUI[l_6_0.Tag.Data].TexturePressed)
   end
   l_6_1.Color = GetMainTextSelectedColor()
   dt.Color = GetSubTextSelectedColor()
end

Settings_HandleDeselected = function(l_7_0)
   local l_7_1 = l_7_0.Namespace:FindName("MainText")
   local dt = l_7_0.Namespace:FindName("DetailText")
   local ib = l_7_0.Namespace:FindName("IconBox")
   if not Settings_DontToggleIconsOnSelected then
      ib:SetTextureRef(Settings_MapSettingsItemUI[l_7_0.Tag.Data].TextureRest)
   end
   l_7_1.Color = GetMainTextUnselectedColor()   
   dt.Color = GetSubTextUnselectedColor()
end

Settings_HandleItemCreated = function(l_8_0, l_8_1)
   local l_8_2 = Settings_MapSettingsItemUI[l_8_0]
   local l_8_3 = l_8_1.Namespace:FindName("TextWithDetailComponent")
   l_8_3.Position.x = 60
   l_8_3._visible = true
   l_8_3 = l_8_1.Namespace:FindName("MainText")
   l_8_3.Color = GetMainTextUnselectedColor()
   l_8_3.String = l_8_2.Text
   l_8_3 = l_8_1.Namespace:FindName("DetailText")
   l_8_3.Color = GetSubTextUnselectedColor()
   l_8_3.String = l_8_2.DetailText
   l_8_3 = l_8_1.Namespace:FindName("IconBox")
   l_8_3.TextureCoords:set(0, 0, 0.875, 0.875)
   l_8_3:SetTextureRef(l_8_2.TextureRest)
   l_8_1.Tag = {}
   l_8_1.Tag.Data = l_8_0
   Settings_MapVisibleElements[l_8_2] = l_8_1
   l_8_1.Focusable = true
   l_8_1.onKeyDown:connect(Settings_HandleKey)
   l_8_1.OnSelected:connect(Settings_HandleSelected)
   l_8_1.OnDeselected:connect(Settings_HandleDeselected)
   if l_8_2 == SyncSettingsItemUI then
      Settings_OnActiveSyncStateChanged()
   end
   if Settings_HandleItemCreated_Operator ~= nil then
      Settings_HandleItemCreated_Operator(l_8_1)
   end
end

Settings_HandleItemDestroyed = function(l_9_0)
   Settings_MapVisibleElements[Settings_MapSettingsItemUI[l_9_0.Tag.Data]] = nil
   l_9_0.onKeyDown:disconnect(Settings_HandleKey)
   l_9_0.OnSelected:disconnect(Settings_HandleSelected)
   l_9_0.OnDeselected:disconnect(Settings_HandleDeselected)
end

UpdateDisabledUI = function(l_10_0, l_10_1)
   local l_10_2 = l_10_0.Namespace:FindName("ControlGroup")
   if l_10_1 then
     SyncIsVisible = false
   else
     SyncIsVisible = true
   end
end

Settings_OnSynchronizingChanged = function()
   local l_11_0 = Settings_MapVisibleElements[SyncSettingsItemUI]
   if l_11_0 ~= nil then
      local dt = l_11_0.Namespace:FindName("DetailText")
      if Settings_MachineStatus.Synchronizing.Value then
         dt.String = "[[IDS_SYNCHRONIZING]]"
      else
         dt.String = "[[IDS_SYNC_DETAIL]]"
      end
   end
end

Settings_OnActiveSyncStateChanged = function()
   local l_12_0 = Settings_MachineStatus.SyncConfigured.Value or Settings_MachineStatus.Cradled.Value
   UpdateDisabledUI(Settings_MapVisibleElements[SyncSettingsItemUI], not l_12_0)
end

Settings_WallpaperDialogReturned = function(l_13_0)
   trace("Dialog Exit\n")
   if l_13_0.Result.ExitType == DialogExitType_OK then
      _application.Store:SetStringValue(Lifetime_Permanent, "HomeBackgroundPath", "")
   else
      Settings_SetWallpaper()
   end
end

WallPaperSubPath = "\\Content\\Wallpaper"
Settings_SetWallpaper = function()
   local l_14_0 = Settings_MachineStatus.MoviNandFolder.Value .. WallPaperSubPath
   trace("Wallpaper Path: " .. l_14_0)
   Shell_PickPicture(true, l_14_0, true)
   local l_14_1 = Shell_GetPhotoPath()
   if l_14_1 ~= "" then
      _application.Store:SetStringValue(Lifetime_Permanent, "HomeBackgroundPath", l_14_1)
   end
end

OnPickPictureChanged = function()
   local l_15_0 = Settings_MachineStatus.PhotoPickerFilePath.Value
   if l_15_0 ~= "" then
      trace("The PhotoPath return = " .. Settings_MachineStatus.PhotoPickerFilePath.Value)
      _application.Store:SetStringValue(Lifetime_Permanent, "HomeBackgroundPath", l_15_0)
   end
end

Settings_MenuExitCallback = function(l_16_0)
   trace("Dialog Exit\n")
   if l_16_0.Result.ExitType ~= DialogExitType_Cancel then
      trace("Dialog UserValue: " .. l_16_0.Result.UserValue .. "\n")
      if l_16_0.Result.UserValue == "Wireless Networks" then
         trace("Shell out to wireless networks dialog\n")
         if _config_os == "windowsmobile" then
            Shell_NavigateTo(ShellLocation_WiFi)
         end
       elseif l_16_0.Result.UserValue == "Bluetooth Devices" then
          trace("Shell out to load bluetooth dialog\n")
          if _config_os == "windowsmobile" then
             Shell_NavigateTo(ShellLocation_Bluetooth)
          end
      end
   end
end

Settings_AllSettingsSoftkeyCallback = function()
   Shell_NavigateTo(ShellLocation_Settings)
end

Settings_MenuSoftkeyCallback = function()
   if Settings_MachineStatus.DoNotShowWireless.Value == 0 then
      trace("Showing the settings menu with wireless option")
      DialogRequest = _application.DialogManager:GetDialog(URL("Manila://settings.dialog"))
   else
      trace("Showing the settings menu with no wireless option")
      DialogRequest = _application.DialogManager:GetDialog(URL("Manila://settings_no_wireless.dialog"))
   end
   DialogRequest.OnExit:connect(Settings_MenuExitCallback)
   DialogRequest:Show()
end

Settings_Create = function()
   SyncSettingsItemUI = SettingsItemUI("[[IDS_SYNC]]", "[[IDS_SYNC_DETAIL]]", "settings_autosync_rest", "settings_autosync_pressed")
   SoundsSettingsItemUI = SettingsItemUI("[[IDS_SOUNDS]]", "[[IDS_SOUNDS_DETAIL]]", "settings_sounds_rest", "settings_sounds_pressed")
   AboutSettingsItemUI = SettingsItemUI("[[IDS_ABOUT]]", string.format(Locale:GetString("IDS_ABOUT_DETAIL"), Settings_MachineStatus.VersionNumber.Value), "settings_about_rest", "settings_about_pressed")
   RearSettingsItemUI = SettingsItemUI("[[IDS_CustomizeTabs]]", "[[IDS_Tabs_Control]]", "settings-touchflo-rest", "settings-touchflo-dn")
   MyProfileSettingsItemUI = SettingsItemUI("[[IDS_MYPROFILE]]", "[[IDS_MYPROFILE_DETAIL]]", "settings_people_rest", "settings_people_pressed")
   WallpaperSettingsItemUI = SettingsItemUI("[[IDS_WALLPAPER]]", "[[IDS_WALLPAPER_DETAIL]]", "settings_wallpaper_rest", "settings_wallpaper_pressed")
   EmailSetupItemUI = SettingsItemUI("[[IDS_EMAILSETUP]]", "[[IDS_EMAILSETUP_DETAIL]]", "settings_email_rest", "settings_email_pressed")
   if Settings_MachineStatus.DoNotShowWireless.Value == 0 then
      CommunicationsSettingsItemUI = SettingsItemUI("[[IDS_COMMUNICATIONS]]", "[[IDS_COMMUNICATIONS_DETAIL]]", "settings_comm_rest", "settings_comm_pressed")
   else
      CommunicationsSettingsItemUI = SettingsItemUI("[[IDS_COMMUNICATIONS]]", "[[IDS_COMMUNICATIONS_DETAIL_NO_WIRELESS]]", "settings_comm_rest", "settings_comm_pressed")
   end
   local l_19_0 = nil
   local l_19_1 = _application.Store:GetIntValue(Lifetime_Permanent, "IsShowConfiguration")
   local l_19_2 = _application.Store:GetIntValue(Lifetime_Permanent, "IsShowEmailSetup")
   local l_19_3 = 0
   Settings_MapSettingsItemUI[l_19_3] = SyncSettingsItemUI
   l_19_3 = l_19_3 + 1
   Settings_MapSettingsItemUI[l_19_3] = SoundsSettingsItemUI
   if not Settings_DontShowWallpaperPicker then
      l_19_3 = l_19_3 + 1
      Settings_MapSettingsItemUI[l_19_3] = WallpaperSettingsItemUI
   end
   l_19_3 = l_19_3 + 1
   Settings_MapSettingsItemUI[l_19_3] = CommunicationsSettingsItemUI
   if l_19_1 == 1 then
      l_19_3 = l_19_3 + 1
      Settings_MapSettingsItemUI[l_19_3] = RearSettingsItemUI
   end
   l_19_3 = l_19_3 + 1
   Settings_MapSettingsItemUI[l_19_3] = MyProfileSettingsItemUI
   if l_19_2 == 1 then
      l_19_3 = l_19_3 + 1
      Settings_MapSettingsItemUI[l_19_3] = EmailSetupItemUI
   end
   l_19_3 = l_19_3 + 1
   Settings_MapSettingsItemUI[l_19_3] = AboutSettingsItemUI
   l_19_0 = l_19_3
   SettingsListView.Position.x = LVPositionX
   SettingsListView.Position.y = LVPositionY
   SettingsListView.Viewport.x = LVWidth
   SettingsListView.Viewport.y = LVHeight
   Settings_ItemListLayout = TileLayout()
   Settings_ItemListLayout.SelectionNode = Selector
   Settings_ItemListLayout:SetItemSize(ItemSizeWidth, ItemSizeHeight, 0)
   Settings_ItemListLayout.DisableVirtualization = true
   SettingsListView:SetLayout(Settings_ItemListLayout)
   FakeCollection = VectorNotifyint()
   for i = 0, l_19_0 do
      FakeCollection:push_back(i)
   end
   Settings_ItemListGenerator = LibraryGeneratorint(FakeCollection, SettingsListView:GetMovie(), SettingsListView.ComponentLibraryName, SettingsListView.ComponentLibraryID)
   Settings_ItemListGenerator.RecycleItems = true
   Settings_ItemListGenerator.ItemCreated:connect(Settings_HandleItemCreated)
   Settings_ItemListGenerator.ItemDestroyed:connect(Settings_HandleItemDestroyed)
   SettingsListView:SetGenerator(Settings_ItemListGenerator)
   ListPhysics = ScrollPhysics(SettingsListView, SettingsListView, Settings_HitIndex)
   ListPhysics:ConnectMouseEvents()
   SettingsListView:Focus()
   if _config_os == "windowsmobile" then
      _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_ALLSETTINGS"), Settings_AllSettingsSoftkeyCallback))
      _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), Settings_MenuSoftkeyCallback))
      Settings_MachineStatus.Synchronizing.OnValueChanged:connect(Settings_OnSynchronizingChanged)
      Settings_MachineStatus.SyncConfigured.OnValueChanged:connect(Settings_OnActiveSyncStateChanged)
      Settings_MachineStatus.Cradled.OnValueChanged:connect(Settings_OnActiveSyncStateChanged)
   end
   Settings_MachineStatus:ForceRegistrySync()
end

if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
   trace("[SettingsPage] : EnableLandscape")
   require("Settings\\SettingsPage_Landscape")
   _SettingsPage_ScreenRotation = SettingsPage_ScreenRotation(SettingsListView, Camera_2D, Camera_3D, Mask)
end
Settings_Create()

⌨️ 快捷键说明

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