Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
// <copyright file="StateMachineStateQuery.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Activities.Statements.Tracking
{
using System.Activities.Tracking;
/// <summary>
/// When added to the Queries, subscribes to state machine state execution records.
/// </summary>
public sealed class StateMachineStateQuery : CustomTrackingQuery
{
/// <summary>
/// Constructor of StateMachineTrackingQuery.
/// </summary>
public StateMachineStateQuery()
{
base.Name = StateMachineStateRecord.StateMachineStateRecordName;
}
/// <summary>
/// Gets the name that distinguishes this tracking record.
/// </summary>
public new string Name
{
get
{
// By adding the 'new' keyword, the Name property appears to be overriden
// and become a Get only property
return base.Name;
}
}
}
}

View File

@@ -0,0 +1,110 @@
//------------------------------------------------------------------------------
// <copyright file="StateMachineStateRecord.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Activities.Statements.Tracking
{
using System;
using System.Activities.Statements;
using System.Activities.Tracking;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime;
using System.Runtime.Serialization;
/// <summary>
/// Represents a tracking record that is created when an state machine instance transitions to a state.
/// </summary>
[Fx.Tag.XamlVisible(false)]
[DataContract]
public sealed class StateMachineStateRecord : CustomTrackingRecord
{
internal static readonly string StateMachineStateRecordName = "System.Activities.Statements.StateMachine";
private const string StateKey = "currentstate";
private const string StateMachineKey = "stateMachine";
/// <summary>
/// Initializes a new instance of the StateMachineStateRecord class.
/// </summary>
public StateMachineStateRecord()
: this(StateMachineStateRecordName)
{
}
// Disable the user from arbitrary specifying a name for StateMachine specific tracking record.
internal StateMachineStateRecord(string name)
: base(name)
{
}
internal StateMachineStateRecord(string name, TraceLevel level)
: base(name, level)
{
}
internal StateMachineStateRecord(Guid instanceId, string name, TraceLevel level)
: base(instanceId, name, level)
{
}
private StateMachineStateRecord(StateMachineStateRecord record)
: base(record)
{
}
/// <summary>
/// Gets the display name of the State Machine activity that contains the state.
/// </summary>
public string StateMachineName
{
get
{
if (Data.ContainsKey(StateMachineKey))
{
return Data[StateMachineKey].ToString();
}
return string.Empty;
}
internal set
{
Data[StateMachineKey] = value;
}
}
/// <summary>
/// Gets the display name of executing state when the record is generated.
/// </summary>
[DataMember]
public string StateName
{
get
{
if (Data.ContainsKey(StateKey))
{
return Data[StateKey].ToString();
}
return string.Empty;
}
internal set
{
Data[StateKey] = value;
}
}
/// <summary>
/// Creates a copy of the StateMachineTrackingRecord. (Overrides CustomTrackingRecord.Clone().)
/// </summary>
/// <returns>A copy of the StateMachineTrackingRecord instance.</returns>
protected internal override TrackingRecord Clone()
{
return new StateMachineStateRecord(this);
}
}
}