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


C# Watcher.Start方法代码示例

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


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

示例1: WatcherApplicationContext

        public WatcherApplicationContext()
        {
            InitializeContext();

            _watcher = new Watcher()
                           {
                               EventTriggered = WatcherTriggered
                           };
            _watcher.Start();
        }
开发者ID:kal444,项目名称:event-log-watcher,代码行数:10,代码来源:WatcherApplicationContext.cs

示例2: Main

        static void Main()
        {
            var watcher = new Watcher();

            watcher.Start();

            // wait for events
            System.Threading.Thread.Sleep(60 * 1000);

            watcher.Stop();
        }
开发者ID:kal444,项目名称:event-log-watcher,代码行数:11,代码来源:Program.cs

示例3: Main

    public static void Main(string[] args)
    {
        try {
            bool scalfolding = false;
            foreach (string arg in args) {
                if (arg.StartsWith("-")) {
                    if (arg == "-h") {
                        Usage(true);
                    } else if (arg == "-v") {
                        Bijou.Verbose = true;
                    } else if (arg == "-w") {
                        Bijou.Watcher = true;
                    } else if (arg == "-c") {
                        Bijou.Clear = true;
                    } else if (arg == "-d") {
                        Bijou.Debug = true;
                    } else if (arg == "-i") {
                        Bijou.Index = true;
                    } else if (arg == "-m") {
                        Bijou.Home = true;
                    } else if (arg == "-s") {
                        scalfolding = true;
                    } else if (arg.StartsWith("-o")) {
                        string[] tokens = arg.Split(':');
                        if (tokens.Length == 2) {
                            if (tokens[1] == "content" || tokens[1] == "template") {
                                Bijou.SiteFolder = tokens[1];
                            } else {
                                Console.WriteLine("Bijou Reserved Folder: Please specify a folder name that is not 'content' or 'template'.");
                            }
                        } else {
                            Console.WriteLine("Please specify folder name along with -o option (using -o:path format).");
                        }
                    } else if (arg.StartsWith("-r")) {
                        string[] tokens = arg.Split(':');
                        if (tokens.Length == 2) {
                            Bijou.WebRoot = "/" + tokens[1];
                        } else {
                            Console.WriteLine("Please specify folder name along with -r option (using -o:path format).");
                        }
                    } else {
                        Console.WriteLine(string.Format("'{0}' option is not supported. Please use -h for help.", args[0] ));
                    }
        } else {
            Bijou.Folder = arg;
        }
        }

        //System.Diagnostics.Debugger.Break(); /*DEBUGGER*/

        if (scalfolding) FileUtils.CreateScafolding(Bijou.Folder);

        if (Bijou.Clear) {
            string siteFolder = (Bijou.SiteFolder == "/site") ? "site" : Bijou.SiteFolder;
            Console.WriteLine("Starting fresh. Clearing the '{0}' folder.", siteFolder);
            Directory.Delete(siteFolder, true);
        } else {
                CreateSite();

                if (Bijou.Watcher) {
                    //Bijou.StartWatcher();
                    Watcher watcher = new Watcher();
                    watcher.Start();
                }
            }

        } catch (Exception e) {
        Console.WriteLine(e.ToString());
        }
    }
开发者ID:xesrochers,项目名称:bijou,代码行数:70,代码来源:Bijou.cs


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