주가 값의 문자열 표현 (Yahoo finance API를 통해)을 다운로드했습니다. 그러나 String 변수에 값을 할당하려고하면 이전 값을 유지하고 변경되지 않습니다. 여기에 코드가 있습니다.문자열 변수 값이 변경되지 않습니다
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
String result = "Default";
public void wb_DownloadStringCompleted(Object sender, DownloadStringCompletedEventArgs e)
{
result = e.Result;
//I changed the application title to be sure the required string was in fact downloaded
ApplicationTitle.Text = e.Result;
}
//When I Click a radio button, the tile is created and inialized
private void radioButton1_Checked(object sender, RoutedEventArgs e)
{
WebClient wb = new WebClient();
wb.DownloadStringAsync(new Uri("http://finance.yahoo.com/d/quotes.csv?s=GOOG&f=a"));
wb.DownloadStringCompleted += wb_DownloadStringCompleted;
//string result = DownloadStringCompletedEventArgs.result;
int newCount = 0;
// Application Tile is always the first Tile, even if it is not pinned to Start.
ShellTile TileToFind = ShellTile.ActiveTiles.First();
// Application should always be found
if (TileToFind != null)
{
// Set the properties to update for the Application Tile.
// Empty strings for the text values and URIs will result in the property being cleared.
StandardTileData NewTileData = new StandardTileData
{
Title = "Stocks",
BackgroundImage = new Uri("google_icon.jpg", UriKind.Relative),
Count = newCount,
BackTitle = "Google Stock",
BackBackgroundImage = new Uri("google_icon.jpg", UriKind.Relative),
//This is where the problem is. The value of result is still "Default"
BackContent = result.ToString()
};
// Update the Application Tile
TileToFind.Update(NewTileData);
}
}
}
나는 라이브 타일에서 결과를 표시하려고하고 값이 "기본"대신 주식 가치 당신은 라이브 타일을 업데이트해야합니다 "548.47"
check e.Result, e.result의 값은 무엇입니까 –
'wb_DownloadStringCompleted'가 끝난 후에는 어떻게됩니까? 나는 페이지/무엇이 새로 고쳐지고'result'의 값이''Default "' – DGibbs
@ PoomrokcThe3years로 재설정되었는지 의심 스럽습니다. e.result의 값은 548.47입니다. textBlock (이 경우 ApplicationTitle)의 값을 설정하여 확인했습니다. – Fourth