当前位置: 首页>>代码示例>>C#>>正文


C# Watcher.ForceRefresh方法代码示例

本文整理汇总了C#中Watcher.ForceRefresh方法的典型用法代码示例。如果您正苦于以下问题:C# Watcher.ForceRefresh方法的具体用法?C# Watcher.ForceRefresh怎么用?C# Watcher.ForceRefresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Watcher的用法示例。


在下文中一共展示了Watcher.ForceRefresh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        public static void Main(string[] args)
        {
            var watcher =
                new Watcher(
                    Environment.CurrentDirectory,
                    (s) => System.Console.WriteLine("Dir created " + s),
                    (s) => System.Console.WriteLine("Dir deleted " + s),
                    (s) => System.Console.WriteLine("File created " + s),
                    (s) => System.Console.WriteLine("File changed " + s),
                    (s) => System.Console.WriteLine("File deleted " + s));
            watcher.ErrorNotifier((path, ex) => { System.Console.WriteLine("{0}\n{1}", path, ex); });

            // Print strategy
            System.Console.WriteLine(
                "Will poll continuously: {0}",
                watcher.Settings.ContinuousPolling);
            System.Console.WriteLine(
                "Poll frequency: {0} milliseconds",
                watcher.Settings.PollFrequency);

            System.Console.WriteLine(
                "Evented directory create: {0}",
                watcher.Settings.CanDetectEventedDirectoryCreate);
            System.Console.WriteLine(
                "Evented directory delete: {0}",
                watcher.Settings.CanDetectEventedDirectoryDelete);
            System.Console.WriteLine(
                "Evented directory rename: {0}",
                watcher.Settings.CanDetectEventedDirectoryRename);
            System.Console.WriteLine(
                "Evented file create: {0}",
                watcher.Settings.CanDetectEventedFileCreate);
            System.Console.WriteLine(
                "Evented file change: {0}",
                watcher.Settings.CanDetectEventedFileChange);
            System.Console.WriteLine(
                "Evented file delete: {0}",
                watcher.Settings.CanDetectEventedFileDelete);
            System.Console.WriteLine(
                "Evented file rename: {0}",
                watcher.Settings.CanDetectEventedFileRename);

            watcher.Watch();
            var command = System.Console.ReadLine();
            if (command == "refresh")
                watcher.ForceRefresh();
            watcher.StopWatching();
        }
开发者ID:rhwy,项目名称:FSWatcher,代码行数:48,代码来源:Program.cs


注:本文中的Watcher.ForceRefresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。