コード例 #1
0
        private void CreateFileObserver(string path)
        {
            // FileObserverEvents.Create | FileObserverEvents.Delete | FileObserverEvents.MovedFrom | FileObserverEvents.MovedTo;
            const FileObserverEvents Mask = FileObserverEvents.Create | FileObserverEvents.Delete | FileObserverEvents.MovedFrom | FileObserverEvents.MovedTo | (FileObserverEvents)0x40000000;

            Console.WriteLine(Mask.ToString());
            fileObserver              = new FilePickerFileObserver(path, Mask);
            fileObserver.OnFileEvent += (events, s) =>
            {
                LogDebug(string.Format("FileObserver event received - {0}", events));
                if ((events & (FileObserverEvents)0x40000000) == (FileObserverEvents)0x40000000)
                {
                    Console.WriteLine("Folder event");
                }
                events &= FileObserverEvents.AllEvents;
                var eventName = Enum.GetName(typeof(FileObserverEvents), events);
                Console.WriteLine(eventName);
                if ((events & Mask) == events)
                {
                    if (Activity != null)
                    {
                        Activity.RunOnUiThread(RefreshFilesList);
                    }
                }
            };
        }
コード例 #2
0
        private void CreateFileObserver(string path)
        {
            // FileObserverEvents.Create | FileObserverEvents.Delete | FileObserverEvents.MovedFrom | FileObserverEvents.MovedTo;
            const FileObserverEvents Mask = FileObserverEvents.Create | FileObserverEvents.Delete | FileObserverEvents.MovedFrom | FileObserverEvents.MovedTo | (FileObserverEvents)0x40000000;
            Console.WriteLine(Mask.ToString());
            fileObserver = new FilePickerFileObserver(path, Mask);
            fileObserver.OnFileEvent += (events, s) =>
                {
                    LogDebug(string.Format("FileObserver event received - {0}", events));
                    if ((events & (FileObserverEvents)0x40000000) == (FileObserverEvents)0x40000000)
                    {
                        Console.WriteLine("Folder event");
                    }
                    events &= FileObserverEvents.AllEvents;
                    var eventName = Enum.GetName(typeof(FileObserverEvents), events);
                    Console.WriteLine(eventName);
                    if ((events & Mask) == events)
                        if (Activity != null)
                        {
                            Activity.RunOnUiThread(RefreshFilesList);
                        }

                };
        }