SD卡模块
您必须先挂载它,sdCard
然后才能使用它:
sdCard.MountSDCard();
为了确保您看到这一点,您应该事先“连接”Mounted 和 Unmounted 事件处理程序,不过:
void ProgramStarted() {
sdCard.SDCardMounted += new SDCard.SDCardMountedEventHandler(sdCard_SDCardMounted);
sdCard.SDCardUnmounted += new SDCard.SDCardUnmountedEventHandler(sdCard_SDCardUnmounted);
}
void sdCard_SDCardUnmounted(SDCard sender) {
Debug.Print("The SD card has been unmounted");
Debug.Print("DO NOT try to access it without mounting it again first");
}
void sdCard_SDCardMounted(SDCard sender, GT.StorageDevice SDCard) {
Debug.Print("SD card has been successfully mounted. You can now read/write/create/delete files");
Debug.Print("Unmount before removing");
}
GetStorageDevice()
如果这些都不是您的问题,我建议您按如下方式分解您的电话:
string rootDirectory = sdCard.GetStorageDevice().RootDirectory;
// What format is `picture`?
// I am going to assume System.Drawing.Bitmap for this example.
picture.Save(rootDirectory + "\\picture.bmp", ImageFormat.Bmp;
如果您不能使用Bitmap.Save 方法,您将使用其他传统的 StreamWriter 技术。
但是,我实际上无法测试它是否有效,因为我没有这些 SD 卡模块之一。我刚刚查看了SD 卡模块教程中的示例代码。
如果有帮助,请投票。如果它解决了您的问题,请将其标记为答案。