2013-10-17 66 views
0

是否有可能例如 - 寫一個後臺服務,它隨機更改Windows手機主題,我的意思是有可能通過代碼訪問設置下的Windows手機主題?並改變它?Windows Phone的主題管理器

如果這樣可以請你給我,我可以分升,API的,我可以用或其他庫的例子

謝謝

回答

0

不幸的是,你不能。無法通過代碼更改Windows Phone主題。唯一一個可以是用戶的人。這是Windows Phone概念的一部分。

您唯一能做的就是定義在您自己的應用中使用的主題。 抱歉有噩耗...

0

您可以更改應用程序的主題。有一個Nuget package可用,使這更容易。您可以通過設置應用程序打開時檢查的屬性來完成後臺任務中的更改。

// background agent code 
// get random value 
IsolatedStorageSettings.ApplicationSettings["Theme"] = randomValue; // this is just a string or something simple 
IsolatedStorageSettings.ApplicationSettings.Save(); 

當你的應用程序打開時,你會檢查這個值

var theme = "Standard"; 
if(IsolatedStorageSettings.ApplicationSettings.ContainsValue("Theme")) 
{ 
    theme = IsolatedStorageSettings.ApplicationSettings["Theme"]; 
    // Set the theme 
} 

您可以通過從github下載源代碼修改主題管理的源頭。主題管理器中有一些more info。如果您想自己更改值,則可以通過在啓動papp時設置資源值來實現此目的

((SolidColorBrush)Resources["PhoneAccentBrush"]).Color = myAccentBrush; 
((SolidColorBrush)Resources["PhoneBackgroundBrush"]).Color = myBackgroundBrush; 
((SolidColorBrush)Resources["PhoneChromeBrush"]).Color = myChromeBrush; 
((SolidColorBrush)Resources["PhoneForegroundBrush"]).Color = myForegroundBrush;