最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
桌面端的移动运算(三)
时间:2022-07-02 11:41:46 编辑:袖梨 来源:一聚教程网
Moving Files on a Device
也许你会遇到需要在设备上移动或者重命名一个文件的情况。例如,你也许想在拷贝一个新版本的文件到设备上之前先为配置文件做一个备份。该功能的演示界面如图2。
Figure 2. The Move File tab of the RAPI demo program
OpenNETCF.Desktop.Communication命名空间RAPI类提供了MoveDeviceFile方法用于移动或重命名一个文件。作为CopyFile方法,这个方法将源文件作为第一个参数,将目的文件作为第二个参数。
BtnMovePerform按钮的点击事件过程演示了MoveDeviceFile方法。
[VC#.NET]
private void btnMovePerform_Click(object sender, System.EventArgs e)
{
// Perform the move.
try
{
if ((txtMoveSource.Text == "") || (txtMoveDestination.Text == ""))
{
MessageBox.Show("You must provide both a source and destination
file.",
"Missing File Information");
}
else
{
myrapi.MoveDeviceFile(txtMoveSource.Text, txtMoveDestination.Text);
MessageBox.Show("Your file has been copied.","Copy Success");
}
}
// Handle any errors that might occur.
catch (Exception ex)
{
MessageBox.Show("The following error occurred moving the file " +
ex.Message,"Connection Error");
}
}
[VB.NET]
Private Sub btnMovePerform_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnMovePerform.Click
' Perform the move.
Try
If (txtMoveSource.Text = "") Or (txtMoveDestination.Text = "") Then
也许你会遇到需要在设备上移动或者重命名一个文件的情况。例如,你也许想在拷贝一个新版本的文件到设备上之前先为配置文件做一个备份。该功能的演示界面如图2。
Figure 2. The Move File tab of the RAPI demo program
OpenNETCF.Desktop.Communication命名空间RAPI类提供了MoveDeviceFile方法用于移动或重命名一个文件。作为CopyFile方法,这个方法将源文件作为第一个参数,将目的文件作为第二个参数。
BtnMovePerform按钮的点击事件过程演示了MoveDeviceFile方法。
[VC#.NET]
private void btnMovePerform_Click(object sender, System.EventArgs e)
{
// Perform the move.
try
{
if ((txtMoveSource.Text == "") || (txtMoveDestination.Text == ""))
{
MessageBox.Show("You must provide both a source and destination
file.",
"Missing File Information");
}
else
{
myrapi.MoveDeviceFile(txtMoveSource.Text, txtMoveDestination.Text);
MessageBox.Show("Your file has been copied.","Copy Success");
}
}
// Handle any errors that might occur.
catch (Exception ex)
{
MessageBox.Show("The following error occurred moving the file " +
ex.Message,"Connection Error");
}
}
[VB.NET]
Private Sub btnMovePerform_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnMovePerform.Click
' Perform the move.
Try
If (txtMoveSource.Text = "") Or (txtMoveDestination.Text = "") Then
相关文章
- Claude Design避坑指南:3个新手常犯的错误 05-27
- Project Genie 地区限制避坑:这些热门国家无法使用 05-27
- 戴文军个人简历怎么查?从打工仔到百亿掌门只用6年 05-27
- 绝味鸭脖戴文军简介:揭秘鸭王背后不为人知的创业真相 05-27
- 亲测京东JoyInside一个月,这些优缺点你必须知道 05-27
- uc浏览器网页版入口官网-手机/电脑uc浏览器网页版入口地址 05-26