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


C# SparseArray.put方法代码示例

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


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

示例1: handleActivationIntent

		private void handleActivationIntent(Intent intent)
		{
			// When application is activated from ProfessionalAudio system it
			// receives SapaAppInfo object describing it.
			// To obtain this object static method getSapaAppInfo() is to be used.
			SapaAppInfo info = SapaAppInfo.getAppInfo(intent);

			if (info != null)
			{
				string callerPackageName = intent.getStringExtra("com.samsung.android.sdk.professionalaudio.key.callerpackagename");
				if (callerPackageName == null)
				{
					callerPackageName = "unknown";
				}
				mCallerPackageNameList[info.App.InstanceId] = callerPackageName;
				Log.d(TAG, "info.getApp.getInstanceId() " + info.App.InstanceId);
				if (!this.mAppInfoList.ContainsKey(info.App.InstanceId))
				{
					this.mAppInfoList[info.App.InstanceId] = info;
				}
				try
				{
					// Actions are being set in SapaAppInfo representing this
					// application.
					mActionArray = new SparseArray<SapaActionInfo>();
					mActionArray.put(0, new SapaActionInfo(MainActivity.ACTION_PLAY, R.drawable.ctrl_btn_play_default, this.PackageName));
					mActionArray.put(1, new SapaActionInfo(MainActivity.ACTION_STOP, R.drawable.ctrl_btn_stop_default, this.PackageName, true, false));
					info.Actions = mActionArray;

					// Native part is being initialised.
					SapaProcessor sapaProcessor = new SapaProcessor(this, null, new SapaProcessorStateListener(this, info.App));
					this.mSapaService.register(sapaProcessor);
					sapaProcessor.activate();
					this.mProcessorList[info.App.InstanceId] = sapaProcessor;

					// Information about ports is being set in SapaAppInfo
					// representing this app.
					// It can not be done before activating SapaProcessor.
					info.PortFromSapaProcessor = sapaProcessor;

					// Application needs to declare that it was successfully
					// activated.
					Log.d(TAG, "addactiveapp " + info.App.InstanceId);
					this.mSapaAppService.addActiveApp(info);
				}
				catch (SapaConnectionNotSetException e)
				{
					Log.e(TAG, "App could not be added to active as connection has not been made.");

				}
				catch (InstantiationException e)
				{
					Log.e(TAG, "SapaService can not be instantiate...");
					Console.WriteLine(e.ToString());
					Console.Write(e.StackTrace);
				}
			}
			if (mActionsList != null && info != null && info.App != null)
			{
				this.mActionsList[info.App.InstanceId] = new ActionsPack(this, info.App);
			}
		}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:62,代码来源:MainService.cs

示例2: showInformationDialog

		/// <summary>
		/// Shows the camera device information into dialog.
		/// </summary>
		private void showInformationDialog()
		{

			StringBuilder builder = new StringBuilder();

			builder.Append("<html><body><pre>");
			if (mCharacteristics != null)
			{
				builder.Append(string.Format("Camera Id: {0}\n", mCameraId));

				// Check supported hardware level.
				SparseArray<string> level = new SparseArray<string>();
				level.put(SCameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL, "Full");
				level.put(SCameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED, "Limited");
				level.put(SCameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY, "Legacy");

				builder.Append(string.Format("Supported H/W Level: {0}\n", level.get(mCharacteristics.get(SCameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL))));

				// Available characteristics tag.
				builder.Append("\nCharacteristics [\n");
//JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET:
//ORIGINAL LINE: for(com.samsung.android.sdk.camera.SCameraCharacteristics.Key<?> key : mCharacteristics.getKeys())
				foreach (SCameraCharacteristics.Key<?> key in mCharacteristics.Keys)
				{
					if (mCharacteristics.get(key) is int[])
					{
						builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.ToString((int[])mCharacteristics.get(key))));
					}
					else if (mCharacteristics.get(key) is Range[])
					{
						builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.deepToString((Range[])mCharacteristics.get(key))));
					}
					else if (mCharacteristics.get(key) is Size[])
					{
						builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.deepToString((Size[]) mCharacteristics.get(key))));
					}
					else if (mCharacteristics.get(key) is float[])
					{
						builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.ToString((float[])mCharacteristics.get(key))));
					}
					else if (mCharacteristics.get(key) is StreamConfigurationMap)
					{
						builder.Append(string.Format("\t{0} --> [\n", key.Name));
						{
							StreamConfigurationMap streamConfigurationMap = mCharacteristics.get(SCameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
							SparseArray<string> formatMap = new SparseArray<string>();
							formatMap.put(ImageFormat.JPEG, "JPEG");
							if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
							{
								formatMap.put(ImageFormat.PRIVATE, "PRIVATE");
								formatMap.put(ImageFormat.DEPTH16, "DEPTH16");
								formatMap.put(ImageFormat.DEPTH_POINT_CLOUD, "DEPTH_POINT_CLOUD");
							}
							formatMap.put(ImageFormat.NV16, "NV16");
							formatMap.put(ImageFormat.NV21, "NV21");
							formatMap.put(ImageFormat.RAW10, "RAW10");
							formatMap.put(ImageFormat.RAW_SENSOR, "RAW_SENSOR");
							formatMap.put(ImageFormat.RGB_565, "RGB_565");
							formatMap.put(ImageFormat.UNKNOWN, "UNKNOWN");
							formatMap.put(ImageFormat.YUV_420_888, "420_888");
							formatMap.put(ImageFormat.YUY2, "YUY2");
							formatMap.put(ImageFormat.YV12, "YV12");
							formatMap.put(PixelFormat.RGBA_8888, "RGBA_8888");

							foreach (int format in streamConfigurationMap.OutputFormats)
							{
								builder.Append(string.Format("\t\t{0}(0x{1:x}) --> {2}\n", formatMap.get(format), format, Arrays.deepToString(streamConfigurationMap.getOutputSizes(format))));
								if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
								{
									builder.Append(string.Format("\t\tHigh Resolution {0}(0x{1:x}) --> {2}\n", formatMap.get(format), format, Arrays.deepToString(streamConfigurationMap.getHighResolutionOutputSizes(format))));
								}
							}

							builder.Append(string.Format("\n\t\tHigh speed video fps --> {0}\n", Arrays.deepToString(streamConfigurationMap.HighSpeedVideoFpsRanges)));
							builder.Append(string.Format("\t\tHigh speed video size --> {0}\n", Arrays.deepToString(streamConfigurationMap.HighSpeedVideoSizes)));

							if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
							{
								builder.Append(string.Format("\n\t\tInput formats [\n"));
								foreach (int format in streamConfigurationMap.InputFormats)
								{
									builder.Append(string.Format("\t\t\t{0}(0x{1:x}) --> {2}\n", formatMap.get(format), format, Arrays.deepToString(streamConfigurationMap.getInputSizes(format))));
								}
							}

							builder.Append(string.Format("\t\t]\n"));

						}
						builder.Append("\t]\n");
					}
					else if (mCharacteristics.get(key) is BlackLevelPattern)
					{
						BlackLevelPattern pattern = mCharacteristics.get(SCameraCharacteristics.SENSOR_BLACK_LEVEL_PATTERN);
						int[] patternArray = new int[BlackLevelPattern.COUNT];
						pattern.copyTo(patternArray, 0);

						builder.Append(string.Format("\t{0} --> {1}\n", key.Name, Arrays.ToString(patternArray)));
//.........这里部分代码省略.........
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:101,代码来源:Sample_Single.cs

示例3: onServiceConnected

		public override void onServiceConnected()
		{
			Log.d(TAG, "onServiceConnected");
			try
			{
				if (this.mMyInfo == null)
				{
					mMyInfo = mSapaAppService.getInstalledApp(this.PackageName);
				}
				if (mMyInfo != null)
				{

					//Actions are being set in SapaAppInfo representing this application.
					mActionArray = new SparseArray<SapaActionInfo>();
					mActionArray.put(0, new SapaActionInfo(COMMAND_SHUSH, R.drawable.ctrl_btn_stop_default, PackageName));
					mMyInfo.Actions = mActionArray;

					//Native part is being initialised.
					Sapa sapa = new Sapa();
					sapa.initialize(this);
					mSapaService = new SapaService();
					mSapaProcessor = new SapaProcessor(this, null, new SapaProcessorStateListener(this, mMyInfo.App));
					mSapaService.register(mSapaProcessor);
					mSapaProcessor.activate();

					//Information about ports is being set in SapaAppInfo representing this app.
					//It can not be done before activating SapaProcessor.
					mMyInfo.PortFromSapaProcessor = mSapaProcessor;

					//Application needs to declare that it was successfully activated.
					if (mSapaAppService != null)
					{
						this.mSapaAppService.addActiveApp(this.mMyInfo);
					}
				}
			}
			catch (SapaConnectionNotSetException e)
			{
				Log.e(TAG, "App could not be added to active as connection has not been made.");
			}
			catch (System.ArgumentException e)
			{
				Log.e(TAG, "Initialisation of Sapa is not possible due to invalid context of application");
			}
			catch (SsdkUnsupportedException e)
			{
				Log.e(TAG, "Initialisation of Sapa is not possible as Sapa is not available on the device");
			}
			catch (InstantiationException e)
			{
				Log.e(TAG, "SapaService can not be instantiate");
			}
		}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:53,代码来源:MainService.cs


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