init
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
namespace DTS.Common.Enums.DBExport
|
||||
{
|
||||
public enum TestObjectFields
|
||||
{
|
||||
s_GUID,
|
||||
TEST_OBJECT,
|
||||
TEXT_L1,
|
||||
TEXT_L2,
|
||||
VERSION,
|
||||
DATE,
|
||||
REMARKS,
|
||||
EXPIRED,
|
||||
SORTKEY,
|
||||
LAST_CHANGE,
|
||||
LAST_CHANGE_TEXT,
|
||||
HISTORY
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Practices.Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The CancelProcess event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>This event is used by the services to display the current status.</remarks>
|
||||
///
|
||||
public class CancelProcessEvent : CompositePresentationEvent<CancelProcess> { }
|
||||
|
||||
/// <summary>
|
||||
/// The CancelProces is used by <see cref="CancelProcessEvent">CancelProcessEvent</see> event to cancel current process.
|
||||
/// </summary>
|
||||
public class CancelProcess
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this object is busy.
|
||||
/// </summary>
|
||||
public bool IsBusy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id of the process.
|
||||
/// </summary>
|
||||
public int ProcessId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace DTS.Common.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Display enum description instead of enum value
|
||||
/// http://brianlagunas.com/a-better-way-to-data-bind-enums-in-wpf/
|
||||
/// </summary>
|
||||
public class EnumDescriptionTypeConverter : EnumConverter
|
||||
{
|
||||
public EnumDescriptionTypeConverter(Type type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the source data before passing it to the target for display in the UI.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to be converted</param>
|
||||
/// <param name="context">The source data being passed to the target.</param>
|
||||
/// <param name="culture">The culture of the conversion.</param>
|
||||
/// <param name="destinationType">The System.Type of data expected by the target dependency property.</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType != typeof(string)) return base.ConvertTo(context, culture, value, destinationType);
|
||||
if (value == null) return string.Empty;
|
||||
var fi = value.GetType().GetField(value.ToString());
|
||||
if (fi == null) return string.Empty;
|
||||
var attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
if (!attributes.Any() || string.IsNullOrEmpty(attributes[0].Description)) return value.ToString();
|
||||
var s = Strings.Strings.ResourceManager.GetString(attributes[0].Description);
|
||||
return string.IsNullOrWhiteSpace(s) ? attributes[0].Description : s;
|
||||
}
|
||||
public static string GetEnumDescription(Enum value)
|
||||
{
|
||||
var fi= value.GetType().GetField(value.ToString());
|
||||
DescriptionAttribute[] attributes =
|
||||
(DescriptionAttribute[])fi.GetCustomAttributes
|
||||
(typeof(DescriptionAttribute), false);
|
||||
if (attributes.Length > 0)
|
||||
{
|
||||
var s = Strings.Strings.ResourceManager.GetString(attributes[0].Description);
|
||||
if( !string.IsNullOrWhiteSpace(s)){ return s; }
|
||||
return attributes[0].Description;
|
||||
}
|
||||
return value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user