小编Hik*_*ari的帖子

Xamarin 表单文件系统观察器

我需要查看 ios/android 应用程序内的文件夹。

我想用FileSystemWatcher.

这是我的代码:

var DocFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var InboxFolder = DocFolder + "/Inbox";

 FileSystemWatcher watcher = new FileSystemWatcher() {
     Path = InboxFolder,
     NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName,
     Filter = "*.*",
     EnableRaisingEvents = true
 };

watcher.Created += (object sender, FileSystemEventArgs e) => {
    // do stuff
};
Run Code Online (Sandbox Code Playgroud)

初始化时FileSystemWatcher会触发此错误:

System.NotImplementedException: The method or operation is not implemented.
Run Code Online (Sandbox Code Playgroud)

我怎样才能让它发挥作用?

还有另一种方法可以查看文件夹吗?

谢谢你!

c# filesystemwatcher notimplementedexception xamarin.forms

4
推荐指数
1
解决办法
1367
查看次数

所有类的Xamarin\C#相同的命名空间?

我有一个Xamarin解决方案,里面有4个项目,PCL,Android,IOS和UWP.

这是我的PCL结构:

我想知道我创建的任何类是否必须位于相同的命名空间es.SgatMobileV2,或在不同的命名空间es.SgatMobileV2.Behaviors,SgatMobileV2.Helpers,SgatMobileV2.Models等.

这两种方法有区别吗?如果是的话,最好的应该是什么?

谢谢!

c# namespaces xamarin

1
推荐指数
1
解决办法
75
查看次数

C ++脏字符*

我具有此功能,用于读取目录中的照片:

vector<Mat> vImg;
Mat rImg;

DIR *dir;
struct dirent *file;
int count = 0;
std::vector<char*> arr; 

if(argc >= 2){
char* imgFolder = argv[1];
if ((dir = opendir(imgFolder)) != NULL) {
  while ((file = readdir(dir)) != NULL) {        
    std::string fn = file->d_name;
    std::string ext = StringToUpper(fn.substr(fn.find_last_of(".") + 1));
    if(ext == "JPG" || ext == "PNG" || ext == "JPEG") {
      count += 1;  
      char* itm = new char[100];
      strcat(itm, imgFolder);
      strcat(itm, "/");
      strcat(itm, file->d_name);
      printf("%s\n",itm);
      vImg.push_back(imread(itm));
    }
  }
  closedir (dir);
Run Code Online (Sandbox Code Playgroud)

问题是第一次 …

c++ opencv vector char

0
推荐指数
1
解决办法
166
查看次数