Phone 7编程点滴

1. 修改文件名

public static void Move(string sourceFileName, string destFileName);


2.得到运行的EXE文件所在目录

/*函数功能: 获取程序所在路径 */

public static string GetAppPath()

{

    string usrdir;

    usrdir = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;

    usrdir = System.IO.Path.GetDirectoryName(usrdir);

    return usrdir;

}

or:

Path.GetFullPath(Assembly.GetExecutingAssembly().GetName().CodeBase();

 

3. WP7数据存储方法

(1) 数据库、本地文件

(2) 全局域

(3) 将数据通过网络传送给服务端

(4) Isolate Storage

 

4. Windows Phone 7 使用GPS得到的坐标得到城市名( 应该是根据坐标获取附近的POI名称)?

转自:http://topic.csdn.net/u/20110415/21/3479235e-02dd-49bd-a476-205b213c66a8.html?60955

private void button1_Click(object sender, RoutedEventArgs e) { GeocodeServiceClient client = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService"); client.ReverseGeocodeCompleted += new EventHandler<ReverseGeocodeCompletedEventArgs>(OnReverseGeocodeCompleted); ReverseGeocodeRequest request = new ReverseGeocodeRequest(); request.Credentials = new Credentials(); request.Credentials.ApplicationId = "AjjGZGtCVs7lEuRn860kGigumg5hhJ8LqKXOIxpk1zwuxxQUgcrFDRWmrYfYCtFg"; Location loc = new Location(); loc.Latitude = 37.736025; loc.Longitude = 115.66153; request.Location = loc; client.ReverseGeocodeAsync(request); } private void OnReverseGeocodeCompleted(object sender, ReverseGeocodeCompletedEventArgs e) { if (e.Error == null) { if (e.Result.Results.Count > 0) { GeocodeResponse response = e.Result; this.textBlock1.Text = response.Results[0].DisplayName; System.Collections.ObjectModel.ObservableCollection<GeocodeResult> list = response.Results; string allName = ""; foreach (GeocodeResult i in list) { allName += i.DisplayName + " "; } this.textBlock2.Text = allName; } else MessageBox.Show("没有检索到该地理位置所对应的地点"); } }

你可能感兴趣的:(编程,String,object,list,button,credentials)