本文整理汇总了C#中System.Arguments.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# Arguments.ContainsKey方法的具体用法?C# Arguments.ContainsKey怎么用?C# Arguments.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Arguments
的用法示例。
在下文中一共展示了Arguments.ContainsKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main( string[] arguments )
{
var args = new Arguments ( arguments );
AndroidDebugBridge bridge = AndroidDebugBridge.CreateBridge(Path.Combine ( Environment.GetEnvironmentVariable ( "ANDROID_SDK" ), "platform-tools\\adb.exe" ),true);
foreach ( var item in Enum.GetNames ( typeof ( Actions ) ) ) {
var actionName = item.Replace ( '_', '-' ).ToLower().Trim();
if ( args.ContainsKey ( actionName ) ) {
Actions action = (Actions)Enum.Parse ( typeof ( Actions ), item, true );
switch ( action ) {
case Actions.Devices:
GetDevices ( );
break;
case Actions.Monitor:
bridge.DeviceChanged += delegate ( object sender, DeviceEventArgs e ) {
System.Console.WriteLine ( "Changed: {0}\t{1}", e.Device.SerialNumber, e.Device.State );
};
bridge.DeviceConnected += delegate ( object sender, DeviceEventArgs e ) {
System.Console.WriteLine ( "{0}\t{1}", e.Device.SerialNumber, e.Device.State );
};
bridge.DeviceDisconnected += delegate ( object sender, DeviceEventArgs e ) {
System.Console.WriteLine ( "{0}\t{1}", e.Device.SerialNumber, e.Device.State );
};
System.Console.ReadLine ( );
break;
case Actions.Start_Server:
StartServer ( );
break;
case Actions.Kill_Server:
break;
default:
break;
}
try {
AndroidDebugBridge.DisconnectBridge ( );
bridge.Stop ( );
} catch ( IOException e ) {
System.Console.WriteLine ( e.ToString ( ) );
// ignore
}
return;
}
}
PrintUsage ( );
}