本文整理汇总了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();
}
示例2: Main
static void Main()
{
var watcher = new Watcher();
watcher.Start();
// wait for events
System.Threading.Thread.Sleep(60 * 1000);
watcher.Stop();
}
示例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());
}
}