本文整理汇总了C#中Runtime类的典型用法代码示例。如果您正苦于以下问题:C# Runtime类的具体用法?C# Runtime怎么用?C# Runtime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Runtime类属于命名空间,在下文中一共展示了Runtime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupKinect
private void SetupKinect()
{
if (Runtime.Kinects.Count == 0)
{
this.Title = "No Kinect connected";
}
else
{
//use first Kinect
nui = Runtime.Kinects[0];
//Initialize to do skeletal tracking
nui.Initialize(RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor | RuntimeOptions.UseDepthAndPlayerIndex);
//add event to receive skeleton data
nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady);
//to experiment, toggle TransformSmooth between true & false and play with parameters
nui.SkeletonEngine.TransformSmooth = true;
TransformSmoothParameters parameters = new TransformSmoothParameters();
// parameters used to smooth the skeleton data
parameters.Smoothing = 0.3f;
parameters.Correction = 0.3f;
parameters.Prediction = 0.4f;
parameters.JitterRadius = 0.7f;
parameters.MaxDeviationRadius = 0.2f;
nui.SkeletonEngine.SmoothParameters = parameters;
}
}
示例2: CreateLockFileTargetLibrary
public static LockFileTargetLibrary CreateLockFileTargetLibrary(Runtime.Project projectDependency,
RestoreContext context)
{
var targetFrameworkInfo = projectDependency.GetCompatibleTargetFramework(context.FrameworkName);
var lockFileLib = new LockFileTargetLibrary
{
Name = projectDependency.Name,
Version = projectDependency.Version,
TargetFramework = targetFrameworkInfo.FrameworkName, // null TFM means it's incompatible
Type = "project"
};
var dependencies = projectDependency.Dependencies.Concat(targetFrameworkInfo.Dependencies);
foreach (var dependency in dependencies)
{
if (dependency.LibraryRange.IsGacOrFrameworkReference)
{
lockFileLib.FrameworkAssemblies.Add(
LibraryRange.GetAssemblyName(dependency.LibraryRange.Name));
}
else
{
lockFileLib.Dependencies.Add(new PackageDependency(
dependency.LibraryRange.Name,
dependency.LibraryRange.VersionRange));
}
}
return lockFileLib;
}
示例3: Platform
static Platform()
{
var p = (int) Environment.OSVersion.Platform;
OS = ((p == 4) || (p == 6) || (p == 128)) ? OS.Unix : OS.Windows;
Runtime = (Type.GetType("Mono.Runtime") == null) ? Runtime.Mono : Runtime.DotNet;
}
示例4:
//public ArrayList PayLoad
//{
// get { return _payLoad; }
//}
//public ArrayList PayLoadCompilationInfo
//{
// get { return _payLoadCompilationInformation; }
//}
#region ICompactSerializable Members
void Runtime.Serialization.ICompactSerializable.Deserialize(Runtime.Serialization.IO.CompactReader reader)
{
data = (HashVector)reader.ReadObject();
transferCompleted = reader.ReadBoolean();
//_payLoadCompilationInformation = reader.ReadObject() as ArrayList;
this.sendDataSize = reader.ReadInt64();
}
示例5: RetryForExceptionAsync
/// <summary>
/// Return true if the request should be retried. Implements additional checks
/// specific to S3 on top of the checks in DefaultRetryPolicy.
/// </summary>
/// <param name="executionContext">Request context containing the state of the request.</param>
/// <param name="exception">The exception thrown by the previous request.</param>
/// <returns>Return true if the request should be retried.</returns>
public override async Task<bool> RetryForExceptionAsync(Runtime.IExecutionContext executionContext, Exception exception)
{
var syncResult = RetryForExceptionSync(executionContext, exception);
if (syncResult.HasValue)
{
return syncResult.Value;
}
else
{
var serviceException = exception as AmazonServiceException;
string correctedRegion = null;
AmazonS3Uri s3BucketUri;
if (AmazonS3Uri.TryParseAmazonS3Uri(executionContext.RequestContext.Request.Endpoint, out s3BucketUri))
{
var credentials = executionContext.RequestContext.ImmutableCredentials;
correctedRegion = await BucketRegionDetector.DetectMismatchWithHeadBucketFallbackAsync(s3BucketUri, serviceException, credentials).ConfigureAwait(false);
}
if (correctedRegion == null)
{
return base.RetryForException(executionContext, exception);
}
else
{
// change authentication region of request and signal the handler to sign again with the new region
executionContext.RequestContext.Request.AuthenticationRegion = correctedRegion;
executionContext.RequestContext.IsSigned = false;
return true;
}
}
}
示例6: InstallBuilder
public InstallBuilder(Runtime.Project project, IPackageBuilder packageBuilder, Reports buildReport)
{
_project = project;
_packageBuilder = packageBuilder;
_buildReport = buildReport;
IsApplicationPackage = project.Commands.Any();
}
示例7: Main
public static void Main(string[] args)
{
var runtime = new Runtime();
runtime.Initialize(RuntimeOptions.UseSkeletalTracking);
var observer = runtime.SkeletonFrameReadyAsObservable();
}
示例8: AddKinectViewer
private void AddKinectViewer(Runtime runtime)
{
var kinectViewer = new KinectDiagnosticViewer();
kinectViewer.kinectDepthViewer.MouseLeftButtonDown += new MouseButtonEventHandler(kinectDepthViewer_MouseLeftButtonDown);
kinectViewer.Kinect= runtime;
viewerHolder.Items.Add(kinectViewer);
}
示例9: PrintGoal
private void PrintGoal (Runtime.Goal goal, string type)
{
sb.Append (type);
sb.Append (new string (' ', 4 * goal.Level));
Runtime.SolutionTreePrinter.Print (goal, sb);
sb.AppendLine();
}
示例10: Project
public Project(Runtime.Project runtimeProject)
{
ProjectFile = runtimeProject.ProjectFilePath;
ProjectDirectory = runtimeProject.ProjectDirectory;
Files = runtimeProject.Files.SourceFiles.Concat(
runtimeProject.Files.ResourceFiles.Values.Concat(
runtimeProject.Files.PreprocessSourceFiles.Concat(
runtimeProject.Files.SharedFiles))).Concat(
new string[] { runtimeProject.ProjectFilePath })
.ToList();
var projectLockJsonPath = Path.Combine(runtimeProject.ProjectDirectory, LockFileReader.LockFileName);
var lockFileReader = new LockFileReader();
if (File.Exists(projectLockJsonPath))
{
var lockFile = lockFileReader.Read(projectLockJsonPath);
ProjectDependencies = lockFile.ProjectLibraries.Select(dep => GetProjectRelativeFullPath(dep.Path)).ToList();
}
else
{
ProjectDependencies = new string[0];
}
}
示例11: Init
public void Init(Ioctls ioctls, Core core, Runtime runtime)
{
ioctls.maAudioDataCreateFromResource = delegate(int _mime, int _data, int _offset, int _length, int _flags)
{
return MoSync.Constants.MA_AUDIO_ERR_INVALID_SOUND_FORMAT;
};
ioctls.maAudioDataDestroy = delegate(int _audioData)
{
return MoSync.Constants.MA_AUDIO_ERR_OK;
};
ioctls.maAudioInstanceCreate = delegate(int _audioData)
{
return MoSync.Constants.MA_AUDIO_ERR_INVALID_DATA;
};
ioctls.maAudioInstanceDestroy = delegate(int _audioInstance)
{
return MoSync.Constants.MA_AUDIO_ERR_OK;
};
ioctls.maAudioPlay = delegate(int _audioInstance)
{
return MoSync.Constants.MA_AUDIO_ERR_OK;
};
}
示例12: Deserialize
public void Deserialize(Runtime.Serialization.IO.CompactReader reader)
{
_cacheCleared = reader.ReadBoolean();
_itemAdded = reader.ReadBoolean();
_itemRemoved = reader.ReadBoolean();
_itemUpdated = reader.ReadBoolean();
}
示例13: Init
public void Init(Ioctls ioctls, Core core, Runtime runtime)
{
// ioctls.maAudioDataCreateFromFile = delegate(int _mime, int _filename, int _flags)
// {
// return MoSync.Constants.MA_AUDIO_ERR_INVALID_SOUND_FORMAT;
// };
ioctls.maAudioDataCreateFromResource = delegate(int _mime, int _data, int _offset, int _length, int _flags)
{
return MoSync.Constants.IOCTL_UNAVAILABLE;
};
ioctls.maAudioDataDestroy = delegate(int _audioData)
{
return MoSync.Constants.IOCTL_UNAVAILABLE;
};
ioctls.maAudioInstanceCreate = delegate(int _audioData)
{
return MoSync.Constants.IOCTL_UNAVAILABLE;
};
ioctls.maAudioInstanceDestroy = delegate(int _audioInstance)
{
return MoSync.Constants.IOCTL_UNAVAILABLE;
};
ioctls.maAudioPlay = delegate(int _audioInstance)
{
return MoSync.Constants.IOCTL_UNAVAILABLE;
};
}
示例14: buttonStart_Click
private void buttonStart_Click(object sender, EventArgs e)
{
_nui = Runtime.Kinects.FirstOrDefault();
if (_nui != null)
{
if (buttonStart.Text == Resources.Form1_buttonStart_Click_Start)
{
buttonStart.Text = Resources.Form1_buttonStart_Click_Stop;
_nui.Initialize(RuntimeOptions.UseColor);
_nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
_nui.VideoFrameReady += FrameReady;
}
else if (buttonStart.Text == Resources.Form1_buttonStart_Click_Stop)
{
buttonStart.Text = Resources.Form1_buttonStart_Click_Start;
_nui.Uninitialize();
}
}
else
{
var dr = MessageBox.Show(Resources.Form1_buttonStart_Click_Please_connect_a_Microsoft_Kinect_to_the_computer,
Resources.Form1_buttonStart_Click_Error, MessageBoxButtons.RetryCancel);
if (dr == DialogResult.Retry)
{
buttonStart_Click(sender, e);
}
}
}
示例15: SetupKinect
private void SetupKinect()
{
// Check to see if there are any Kinect devices connected.
if (Runtime.Kinects.Count == 0)
{
MessageBox.Show("No Kinect connected");
}
else
{
// Use first Kinect.
kinectRuntime = Runtime.Kinects[0];
// Initialize to return skeletal data.
kinectRuntime.Initialize(RuntimeOptions.UseSkeletalTracking);
// Attach to the event to receive skeleton frame data.
kinectRuntime.SkeletonFrameReady += KinectRuntime_SkeletonFrameReady;
kinectRuntime.SkeletonEngine.TransformSmooth = true;
TransformSmoothParameters parameters = new TransformSmoothParameters();
parameters.Smoothing = 0.5f;
parameters.Correction = 0.3f;
parameters.Prediction = 0.2f;
parameters.JitterRadius = .2f;
parameters.MaxDeviationRadius = 0.5f;
kinectRuntime.SkeletonEngine.SmoothParameters = parameters;
kinectRuntime.NuiCamera.ElevationAngle = 0;
}
}