本文整理汇总了C#中StatusChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# StatusChangedEventArgs类的具体用法?C# StatusChangedEventArgs怎么用?C# StatusChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StatusChangedEventArgs类属于命名空间,在下文中一共展示了StatusChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KinectSensors_StatusChanged
private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
{
switch (e.Status)
{
case KinectStatus.Connected:
if (this.Kinect == null)
{
this.Kinect = e.Sensor;
}
break;
case KinectStatus.Disconnected:
if (this.Kinect == e.Sensor)
{
this.Kinect = null;
this.Kinect = KinectSensor.KinectSensors
.FirstOrDefault(x => x.Status == KinectStatus.Connected);
if (this.Kinect == null)
{
MessageBox.Show("This application requires a Kinect sensor");
this.Close();
}
}
break;
//Handle all other statuses according to needs
}
}
示例2: KinectSensors_StatusChanged
private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
{
switch (e.Status)
{
case KinectStatus.Connected:
if (this.Kinect == null)
{
this.Kinect = e.Sensor;
}
break;
case KinectStatus.Disconnected:
if (this.Kinect == e.Sensor)
{
this.Kinect = null;
this.Kinect = KinectSensor.KinectSensors
.FirstOrDefault(x => x.Status == KinectStatus.Connected);
if (this.Kinect == null)
{
//Notify the user that the sensor is disconnected
}
}
break;
//Handle all other statuses according to needs
}
}
示例3: KinectSensors_StatusChanged
/// <summary>
/// Handles the StatusChanged event of the KinectSensors control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="Microsoft.Kinect.StatusChangedEventArgs"/> instance containing the event data.</param>
void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
{
if (e.Status == KinectStatus.Connected)
{
//OpenKinect(e.Sensor);
}
}
示例4: Kinects_StatusChanged
private void Kinects_StatusChanged(object sender, StatusChangedEventArgs e)
{
switch (e.Status)
{
case KinectStatus.Connected:
var foundViewer = FindViewer(e.KinectRuntime);
if (foundViewer != null)
{
foundViewer.Kinect = e.KinectRuntime; //will cause a uninit, init
}
else if (viewerHolder.Items.Count < maxKinectCount)
{
AddKinectViewer(e.KinectRuntime);
}
break;
case KinectStatus.Disconnected:
if (Runtime.Kinects.Count >= maxKinectCount)
{
UpdateRuntimeOfKinectViewerToNextKinect(e.KinectRuntime);
}
else
{
RemoveKinectViewer(e.KinectRuntime);
}
break;
default:
if (e.Status.HasFlag(KinectStatus.Error))
{
DisableOrAddKinectViewer(e.KinectRuntime);
}
break;
}
UpdateUIBasedOnKinectCount();
}
示例5: HandleServiceStatusChanged
void HandleServiceStatusChanged (object sender, StatusChangedEventArgs e)
{
// handle when the service has finished being added
if (e.WasAdded) {
ExpandFirstOrUnconfiguredSection ();
}
}
示例6: Kinects_StatusChanged
void Kinects_StatusChanged(object sender, StatusChangedEventArgs e)
{
switch (e.Status)
{
case KinectStatus.Connected:
if (kinectSensor == null)
{
kinectSensor = e.Sensor;
Initialize();
}
break;
case KinectStatus.Disconnected:
if (kinectSensor == e.Sensor)
{
Clean();
MessageBox.Show("Kinect was disconnected");
}
break;
case KinectStatus.NotReady:
break;
case KinectStatus.NotPowered:
if (kinectSensor == e.Sensor)
{
Clean();
MessageBox.Show("Kinect is no more powered");
}
break;
default:
MessageBox.Show("Unhandled Status: " + e.Status);
break;
}
}
示例7: KinectSensors_StatusChanged
/// <summary>
/// Kinectの接続状態が変わった時に呼び出される
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void KinectSensors_StatusChanged( object sender, StatusChangedEventArgs e )
{
// デバイスが接続された
if ( e.Status == KinectStatus.Connected ) {
Start( e );
}
// デバイスが切断された
else if ( e.Status == KinectStatus.Disconnected ) {
Stop( e );
}
// ACが抜けてる
else if ( e.Status == KinectStatus.NotPowered ) {
Stop( e );
MessageBox.Show( "電源ケーブルを接続してください" );
}
// Kinect for Xbox 360
else if ( e.Status == KinectStatus.DeviceNotSupported ) {
MessageBox.Show( "Kinect for Xbox 360 はサポートされません" );
}
// USBの帯域が足りない
else if ( e.Status == KinectStatus.InsufficientBandwidth ) {
MessageBox.Show( "USBの帯域が足りません" );
}
}
示例8: KinectSensorsStatusChanged
void KinectSensorsStatusChanged(object sender, StatusChangedEventArgs e)
{
switch (e.Status)
{
case KinectStatus.Disconnected:
if (_kinectSensor == e.Sensor)
{
Clean();
Message = "Kinect disconnected";
}
break;
case KinectStatus.Connected:
_kinectSensor = e.Sensor;
Initialize();
break;
case KinectStatus.NotPowered:
Message = "Kinect is not powered";
Clean();
break;
case KinectStatus.NotReady:
Message = "Kinect is not ready";
break;
case KinectStatus.Initializing:
Message = "Initializing";
break;
default:
Message = string.Concat("Status: ", e.Status);
break;
}
}
示例9: OnKinectStatusChanged
private void OnKinectStatusChanged(object sender, StatusChangedEventArgs e)
{
switch (e.Status)
{
case KinectStatus.Connected:
if (Kinect == null)
{
Kinect = e.KinectRuntime;
Setup();
}
break;
case KinectStatus.Disconnected:
if (Kinect == e.KinectRuntime)
{
Uninitialize();
MessageBox.Show("Kinect was disconnected.");
}
break;
case KinectStatus.NotReady:
break;
default:
MessageBox.Show("Unhandled Status: " + e.Status);
break;
}
}
示例10: KinectStatusChange
/// <summary>
/// A Debug function that gets called whenever the Kinect's state change. Since a state change
/// is usually a bad thing, this event handler will mainly print out diagnostic data.
/// </summary>
/// <param name="sender">The sending object</param>
/// <param name="e">Contains data on the sensor</param>
protected void KinectStatusChange(object sender, StatusChangedEventArgs e)
{
Console.WriteLine("[Client] Kinect's status changed!");
Console.WriteLine("[Client] Kinect is running: {0}", e.Sensor.IsRunning);
Console.WriteLine("[Client] Kinect Skeletal stream is enabled: {0}", e.Sensor.SkeletonStream.IsEnabled);
Console.WriteLine("[Client] Kinect status: {0}", e.Sensor.Status);
Console.WriteLine("[Client] Kinect device connection ID: {0}", e.Sensor.DeviceConnectionId);
}
示例11: Sensor_StatusChanged
/// <summary>
/// Listens to status changes.
/// Updates statuses as they change
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Sensor_StatusChanged(object sender, StatusChangedEventArgs e)
{
deviceStatusArgs.CurrentStatus = GetStatus(e.Status);
deviceStatusArgs.OriginalDeviceStatus = e.Status.ToString();
Device_StatusChanged(deviceStatusArgs);
sensor = null; // Because the Kinect SDK bugs when the Kinect is unplugged and plugged back in
// it is important to set the sensor to null so that a new instance is created in the Record method
// The bug message is "The Kinect is not ready" if the sensor's instance stays the same after it is plugged back
}
示例12: KinectSensors_StatusChanged
void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
{
if (kinectError != null)
{
MainWindow.animateSlide(kinectError, true, true);
if (initialisingSpinner != null)
{
MainWindow.animateSlide(initialisingSpinner, true, true);
initialisingSpinner = null;
}
}
if (e.Status == KinectStatus.Connected)
{
MainWindow.restartMoto();
}
else
{
MainWindow.animateFade(imgDimmer, 0, 0.5);
kinectError = MainWindow.generateError(e.Status);
MainCanvas.Children.Add(kinectError);
MainWindow.animateSlide(kinectError);
if (e.Status == KinectStatus.Initializing)
{
//Spinny, turny progress animation
initialisingSpinner = new Image();
initialisingSpinner.Source = new BitmapImage(new Uri(
"/Moto;component/images/loading.png", UriKind.Relative));
MainCanvas.Children.Add(initialisingSpinner);
initialisingSpinner.Width = 150;
initialisingSpinner.Height = 150;
MainWindow.animateSlide(initialisingSpinner);
MainWindow.animateSpin(initialisingSpinner);
Canvas.SetTop(initialisingSpinner, 230);
Canvas.SetLeft(initialisingSpinner, (MainCanvas.ActualWidth / 2) - (initialisingSpinner.Width / 2));
//Add a "Moto will restart soon" message
restartMsg = new Image();
restartMsg.Source = new BitmapImage(new Uri(
"/Moto;component/images/kinect-fault/restart.png", UriKind.Relative));
MainCanvas.Children.Add(restartMsg);
restartMsg.Width = 465;
restartMsg.Height = 37;
MainWindow.animateSlide(restartMsg);
Canvas.SetTop(restartMsg, 200);
Canvas.SetLeft(restartMsg, (MainCanvas.ActualWidth / 2) - (restartMsg.Width / 2));
}
else if (e.Status == KinectStatus.Disconnected)
{
MainWindow.stopKinect(MainWindow.sensor);
}
}
}
示例13: KinectSensors_StatusChanged
//Statusfarbe "Kinect angeschlossen"=blau Fehler=rot "Initialisieren"=schwarz
void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
{
if (StatusGerman(e.Status.ToString()) == "Initialisieren...")
this.ViewModel.SensorColor = "Black";
else if(StatusGerman(e.Status.ToString()) != "Kinect angeschlossen")
this.ViewModel.SensorColor = "Red";
else
this.ViewModel.SensorColor = "Green";
this.ViewModel.SensorStatus = StatusGerman(e.Status.ToString());
//this.ViewModel.SensorStatus = e.Status.ToString();
}
示例14: KinectSensors_StatusChanged
void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
{
if (kinectSensor == e.Sensor)
{
if (e.Status == KinectStatus.Disconnected || e.Status == KinectStatus.NotPowered)
{
kinectSensor = null;
DiscoverKinectSensor();
}
}
}
示例15: KinectSensors_StatusChanged
/// <summary>
/// Handles the StatusChanged event of the KinectSensors control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="Microsoft.Kinect.StatusChangedEventArgs"/> instance containing the event data.</param>
void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
{
this.Title = e.Status.ToString();
if (e.Status == KinectStatus.Connected)
{
this.StartKinect();
}
else
{
this.StopKinect();
}
}
开发者ID:gopisivakanth,项目名称:Kinect_Controlled_Robotic_Arm_group10_cs308_2012,代码行数:18,代码来源:MainWindow.xaml.cs