init
This commit is contained in:
28
DataPRO/Users/UserSettings/CategoryAttributeEx.cs
Normal file
28
DataPRO/Users/UserSettings/CategoryAttributeEx.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel;
|
||||
using Users.UserSettings;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Slice.Users.UserSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// this class overloads the categoryattribute to provide a localized string using our string resources
|
||||
/// we also overload it so that we can use an enum to set the attribute
|
||||
/// to be translated the category should exist in the string resources, otherwise you'll get
|
||||
/// ##ResourceNotFound## as your translated string
|
||||
/// </summary>
|
||||
public class CategoryAttributeEx : CategoryAttribute
|
||||
{
|
||||
private readonly PropertyEnums.PropertyCategories _category;
|
||||
public PropertyEnums.PropertyCategories GetCategory() { return _category; }
|
||||
|
||||
protected override string GetLocalizedString(string value)
|
||||
{
|
||||
return StringResources.ResourceManager.GetString(value) ?? "##ResourceNotFound##" + value;
|
||||
}
|
||||
|
||||
public CategoryAttributeEx(PropertyEnums.PropertyCategories category) : base(category.ToString())
|
||||
{
|
||||
_category = category;
|
||||
}
|
||||
}
|
||||
}
|
||||
736
DataPRO/Users/UserSettings/Defaults.cs
Normal file
736
DataPRO/Users/UserSettings/Defaults.cs
Normal file
@@ -0,0 +1,736 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DTS.Common;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Enums.Sensors;
|
||||
using DTS.Common.Storage;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
|
||||
namespace DTS.Slice.Users.UserSettings
|
||||
{
|
||||
public abstract class Defaults
|
||||
{
|
||||
#region Static Methods
|
||||
|
||||
/// <summary>
|
||||
/// this function is designed to create any missing property settings if needed
|
||||
/// this might happen if the database table was just created for instance
|
||||
/// it will create defaults for all the settings in the db, and also settings for all users
|
||||
/// currently it's used by DataPRO.App
|
||||
/// </summary>
|
||||
internal static void CreateAnyMissingUserSettingPropertyDefaults(Defaults userSetting)
|
||||
{
|
||||
//get a list of all known properties
|
||||
var properties = userSetting.GetType().GetProperties();
|
||||
var needToBeAdded = new Dictionary<int, PropertyInfo>();
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
var id = PropertyIdAttribute.GetPropertyId(property);
|
||||
needToBeAdded[id] = property;
|
||||
}
|
||||
//find if the property already exists in the db, if so, no need to add...
|
||||
using (var sql = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
sql.CommandType = CommandType.Text;
|
||||
sql.CommandText = "SELECT [PropertyId] from [DefaultProperties]";
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt32(row["PropertyId"]);
|
||||
if (needToBeAdded.ContainsKey(id))
|
||||
{
|
||||
needToBeAdded.Remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
sql.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
//if we have nothing to add, we are all done
|
||||
if (needToBeAdded.Values.Count <= 0) return;
|
||||
|
||||
//otherwise add the defaults
|
||||
using (var sql = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(DbOperations.BEGIN_STATEMENT);
|
||||
|
||||
using (var needToBeAddedEnumerator = needToBeAdded.GetEnumerator())
|
||||
{
|
||||
var iIndex = 0;
|
||||
while (needToBeAddedEnumerator.MoveNext())
|
||||
{
|
||||
var currentProperty = needToBeAddedEnumerator.Current.Value;
|
||||
sb.AppendFormat(
|
||||
"INSERT INTO [DefaultProperties] ([PropertyId],[PropertyName],[DefaultValue]) VALUES (@1_{0}, @2_{0}, @3_{0});",
|
||||
iIndex);
|
||||
DbOperations.CreateParam(sql, $"@1_{iIndex}", SqlDbType.Int,
|
||||
PropertyIdAttribute.GetPropertyId(currentProperty));
|
||||
DbOperations.CreateParam(sql, $"@2_{iIndex}", SqlDbType.NVarChar,
|
||||
PropertyIdAttribute.GetPropertyIdEnum(currentProperty).ToString());
|
||||
DbOperations.CreateParam(sql, $"@3_{iIndex}", SqlDbType.NVarChar,
|
||||
GetDefaultValueAsString(currentProperty));
|
||||
iIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
sb.Append(DbOperations.COMMIT_STATEMENT);
|
||||
sql.CommandText = sb.ToString();
|
||||
DbOperations.Connection.ExecuteCommand(sql);
|
||||
}
|
||||
finally
|
||||
{
|
||||
sql.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
//finally add settings for any users we have currently
|
||||
CreateMissingUserSettingProperties(needToBeAdded.Values.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// creates missing user settings (for all users)
|
||||
/// </summary>
|
||||
/// <param name="needToBeAdded"></param>
|
||||
internal static void CreateMissingUserSettingProperties(PropertyInfo[] needToBeAdded)
|
||||
{
|
||||
var userIds = new List<int>();
|
||||
using (var sql = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
sql.CommandText = "SELECT ID FROM [Users]";
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt32(row["ID"]);
|
||||
if (!userIds.Contains(id))
|
||||
{
|
||||
userIds.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
sql.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
foreach (var id in userIds)
|
||||
{
|
||||
CreateMissingUserSettingProperties(id, needToBeAdded);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts missing properties, and updates existing ones for given user
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="allProperties"></param>
|
||||
internal static void CreateOrUpdateUserSettingProperties(int id, PropertyInfo[] allProperties)
|
||||
{
|
||||
var existing = new HashSet<int>();
|
||||
|
||||
using (var sql = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
sql.CommandType = CommandType.Text;
|
||||
sql.CommandText = "SELECT PropertyId FROM [UserProperties] WHERE UserId=@1";
|
||||
DbOperations.CreateParam(sql, "@1", SqlDbType.Int, id);
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var propertyId = Convert.ToInt32(row[0]);
|
||||
existing.Add(propertyId);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
sql.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
using (var sql = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
sql.CommandType = CommandType.Text;
|
||||
var index = 0;
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(DbOperations.BEGIN_STATEMENT);
|
||||
|
||||
foreach (var property in allProperties)
|
||||
{
|
||||
var propId = PropertyIdAttribute.GetPropertyId(property);
|
||||
if (existing.Contains(propId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
sb.AppendFormat(
|
||||
"INSERT INTO [UserProperties] ([UserId],[PropertyId], [PropertyValue]) VALUES (@1_{0},@2_{0},@3_{0});",
|
||||
index);
|
||||
|
||||
DbOperations.CreateParam(sql, $"@1_{index}", SqlDbType.Int, id);
|
||||
DbOperations.CreateParam(sql, $"@2_{index}", SqlDbType.Int, propId);
|
||||
DbOperations.CreateParam(sql, $"@3_{index}", SqlDbType.NVarChar,
|
||||
GetDefaultValueAsString(property));
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
sb.Append(DbOperations.COMMIT_STATEMENT);
|
||||
|
||||
sql.CommandText = sb.ToString();
|
||||
DbOperations.Connection.ExecuteCommand(sql);
|
||||
}
|
||||
finally
|
||||
{
|
||||
sql.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
if (existing.Any())
|
||||
{
|
||||
using (var sql = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
var index = 0;
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(DbOperations.BEGIN_STATEMENT);
|
||||
|
||||
foreach (var property in allProperties)
|
||||
{
|
||||
var propId = PropertyIdAttribute.GetPropertyId(property);
|
||||
if (!existing.Contains(propId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
sb.AppendFormat(
|
||||
"UPDATE [UserProperties] SET PropertyValue=@1_{0} WHERE UserId=@2_{0} AND PropertyId=@3_{0};",
|
||||
index);
|
||||
DbOperations.CreateParam(sql, $"@1_{index}", SqlDbType.NVarChar,
|
||||
GetUserSettingValue(id, (PropertyEnums.PropertyIds)propId, true) ?? string.Empty);
|
||||
DbOperations.CreateParam(sql, $"@2_{index}", SqlDbType.Int, id);
|
||||
DbOperations.CreateParam(sql, $"@3_{index}", SqlDbType.Int, propId);
|
||||
index++;
|
||||
}
|
||||
|
||||
sb.Append(DbOperations.COMMIT_STATEMENT);
|
||||
|
||||
sql.CommandText = sb.ToString();
|
||||
sql.CommandType = CommandType.Text;
|
||||
DbOperations.Connection.ExecuteCommand(sql);
|
||||
}
|
||||
finally { sql.Connection.Dispose(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this funtion creates a list of settings for a specific user
|
||||
/// this may happen with a new database, it's called by the
|
||||
/// CreateAnyMissingUserSettingPropertyDefaults function above
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="needToBeAdded"></param>
|
||||
internal static void CreateMissingUserSettingProperties(int id, PropertyInfo[] needToBeAdded)
|
||||
{
|
||||
using (var sql = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
sql.CommandType = CommandType.Text;
|
||||
var index = 0;
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(DbOperations.BEGIN_STATEMENT);
|
||||
|
||||
foreach (var property in needToBeAdded)
|
||||
{
|
||||
sb.AppendFormat(
|
||||
"INSERT INTO [UserProperties] ([UserId],[PropertyId], [PropertyValue]) VALUES (@1_{0},@2_{0},@3_{0});",
|
||||
index);
|
||||
|
||||
DbOperations.CreateParam(sql, $"@1_{index}", SqlDbType.Int, id);
|
||||
DbOperations.CreateParam(sql, $"@2_{index}", SqlDbType.Int,
|
||||
PropertyIdAttribute.GetPropertyId(property));
|
||||
DbOperations.CreateParam(sql, $"@3_{index}", SqlDbType.NVarChar,
|
||||
GetDefaultValueAsString(property));
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
sb.Append(DbOperations.COMMIT_STATEMENT);
|
||||
|
||||
sql.CommandText = sb.ToString();
|
||||
DbOperations.Connection.ExecuteCommand(sql);
|
||||
}
|
||||
finally
|
||||
{
|
||||
sql.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get an invariant version of the value for db storage
|
||||
/// this is used when we create or insert a new default into the db
|
||||
/// </summary>
|
||||
/// <param name="property"></param>
|
||||
/// <returns></returns>
|
||||
internal static string GetDefaultValueAsString(PropertyInfo property)
|
||||
{
|
||||
if (property == null) return "";
|
||||
var attr = (DefaultValueAttribute)property.GetCustomAttribute(typeof(DefaultValueAttribute));
|
||||
if (attr.Value is double d)
|
||||
{
|
||||
return d.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
if (attr.Value is float f)
|
||||
{
|
||||
return f.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
return attr.Value?.ToString() ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gets a collection of all settings for a given user
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
protected static Defaults GetUserSettings(int userId, Defaults settings)
|
||||
{
|
||||
var properties = settings.GetType().GetProperties();
|
||||
//first get all properties as filled out by code
|
||||
foreach (var property in properties)
|
||||
{
|
||||
var d = property.GetCustomAttribute<DefaultValueAttribute>();
|
||||
if (d != null)
|
||||
{
|
||||
property.SetValue(settings, d.Value);
|
||||
}
|
||||
}
|
||||
|
||||
//next make sure we get all the defaults from the db
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_DefaultPropertiesGet.ToString();
|
||||
cmd.Parameters.Add(new SqlParameter("@PropertyId", SqlDbType.Int) { Value = null });
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(cmd))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt32(row["PropertyId"]);
|
||||
var dv = Convert.ToString(row["DefaultValue"]);
|
||||
settings.SetValue(id, dv);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { APILogger.Log("Failed to get Default Property", ex); }
|
||||
finally { cmd.Connection.Dispose(); }
|
||||
}
|
||||
|
||||
//finally get the user specific values
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_UserPropertiesGet.ToString();
|
||||
cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int) { Value = userId });
|
||||
cmd.Parameters.Add(new SqlParameter("@PropertyId", SqlDbType.Int) { Value = null });
|
||||
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(cmd))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt32(row["PropertyId"]);
|
||||
var value = Convert.ToString(row["PropertyValue"]);
|
||||
settings.SetValue(id, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { APILogger.Log("Failed to get User Property", ex); }
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
//if a user setting for a defaults type wasn't found, handle it in the inherited class
|
||||
return settings;
|
||||
}
|
||||
|
||||
protected static Defaults _allUserSettings = null;
|
||||
|
||||
/// <summary>
|
||||
/// sets a specific user setting in the db
|
||||
/// function should handle the invariant nature of values
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="value"></param>
|
||||
public static void SetUserSetting(int userId, PropertyEnums.PropertyIds id, object value)
|
||||
{
|
||||
var sValue = value.ToString();
|
||||
if (value is double d)
|
||||
{
|
||||
sValue = d.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
else if (value is float f)
|
||||
{
|
||||
sValue = f.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_UserPropertiesUpdateInsert.ToString();
|
||||
|
||||
#region params
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int) { Value = userId });
|
||||
cmd.Parameters.Add(new SqlParameter("@PropertyId", SqlDbType.Int) { Value = (int)id });
|
||||
cmd.Parameters.Add(new SqlParameter("@PropertyValue", SqlDbType.NVarChar) { Value = sValue });
|
||||
var errorNumberParam =
|
||||
new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumberParam);
|
||||
var errorMessageParam =
|
||||
new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
|
||||
{
|
||||
Direction = ParameterDirection.Output
|
||||
};
|
||||
cmd.Parameters.Add(errorMessageParam);
|
||||
|
||||
#endregion params
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
if (int.Parse(errorNumberParam.Value.ToString()) != 0)
|
||||
{
|
||||
//errorMessageParam.Value
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { APILogger.Log("Failed to set User Property", ex); }
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { APILogger.LogException(ex); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// inserts a default setting into the db
|
||||
/// written for 18028 Remember test id suffix drop down state
|
||||
/// this is in place of a migration script and updating the db when there's a new user
|
||||
/// setting, instead if a setting is absent we can insert one
|
||||
/// </summary>
|
||||
public static void InsertUserSetting(PropertyEnums.PropertyIds property, string value)
|
||||
{
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandText =
|
||||
"INSERT INTO [DefaultProperties] ([PropertyId],[PropertyName],[DefaultValue]) VALUES (@1,@2,@3)";
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@1", SqlDbType.Int) { Value = (int)property });
|
||||
cmd.Parameters.Add(new SqlParameter("@2", SqlDbType.NVarChar, 255) { Value = property.ToString() });
|
||||
cmd.Parameters.Add(new SqlParameter("@3", SqlDbType.NVarChar, 255) { Value = value });
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
APILogger.Log(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// gets a specific user setting as a bool
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="property"></param>
|
||||
/// <param name="defaultValue">optional parameter allowing inserting a setting if absent</param>
|
||||
/// <returns></returns>
|
||||
public static bool GetUserSettingValueBool(int userId, PropertyEnums.PropertyIds property, bool? defaultValue = false)
|
||||
{
|
||||
var defaultV = false;
|
||||
var val = GetUserSettingValue(userId, property);
|
||||
if (null != defaultValue && null == val)
|
||||
{
|
||||
//if we get here the user supplied a default value for the property
|
||||
//and the property is not in the db, so insert it
|
||||
InsertUserSetting(property, ((bool)defaultValue).ToString());
|
||||
return (bool)defaultValue;
|
||||
}
|
||||
//if the string is empty or null, it won't convert, so just return the default
|
||||
//otherwise return the converted value
|
||||
return string.IsNullOrWhiteSpace(val) ? defaultV : Convert.ToBoolean(val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gets a specific user setting as a double
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="property"></param>
|
||||
/// <returns></returns>
|
||||
public static double GetUserSettingValueDouble(int userId, PropertyEnums.PropertyIds property)
|
||||
{
|
||||
return Convert.ToDouble(GetUserSettingValue(userId, property) ?? "0", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gets a specific user setting as an integer
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="property"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetUserSettingValueInt(int userId, PropertyEnums.PropertyIds property)
|
||||
{
|
||||
return Convert.ToInt32(GetUserSettingValue(userId, property) ?? "0", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a specific user setting as a string
|
||||
/// </summary>
|
||||
/// <param name="userid"></param>
|
||||
/// <param name="property"></param>
|
||||
/// <param name="defaultValue">optional parameter, if specified and the property is missing will insert the property</param>
|
||||
/// <returns></returns>
|
||||
public static string GetUserSettingValueString(int userid, PropertyEnums.PropertyIds property, string defaultValue = null)
|
||||
{
|
||||
return GetUserSettingValue(userid, property, true, defaultValue) ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gets a user setting out of the db, this is an internal function used by all the public
|
||||
/// single setting accessors.
|
||||
/// setting is determined by user settings table, default values table
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="propertyId">numeric id if the property</param>
|
||||
/// <param name="dontUseCache">whether to use cache when retrieving property value</param>
|
||||
/// <param name="defaultValue">optional parameter, if setting is missing will insert property with this default value</param>
|
||||
/// <returns></returns>
|
||||
private static string GetUserSettingValue(int userId,
|
||||
PropertyEnums.PropertyIds propertyId,
|
||||
bool dontUseCache = true,
|
||||
string defaultValue = null)
|
||||
{
|
||||
if (_allUserSettings != null && !dontUseCache)
|
||||
{
|
||||
var properties = _allUserSettings.GetType().GetProperties();
|
||||
foreach (var prop in properties)
|
||||
{
|
||||
var id = PropertyIdAttribute.GetPropertyId(prop);
|
||||
if (id == (int)propertyId) { return GetDefaultValueAsString(prop); }
|
||||
}
|
||||
}
|
||||
//if the user has a specific value set for this property, just return it directly
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_UserPropertiesGet.ToString();
|
||||
cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int) { Value = userId });
|
||||
cmd.Parameters.Add(new SqlParameter("@PropertyId", SqlDbType.Int) { Value = propertyId });
|
||||
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(cmd))
|
||||
{
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
return Convert.ToString(ds.Tables[0].Rows[0]["PropertyValue"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { APILogger.Log("failed to retrieve user setting, ", ex); }
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
//if there exists a specific default value set for this property, return that
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_DefaultPropertiesGet.ToString();
|
||||
cmd.Parameters.Add(new SqlParameter("@PropertyId", SqlDbType.Int) { Value = propertyId });
|
||||
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(cmd))
|
||||
{
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
return Convert.ToString(ds.Tables[0].Rows[0]["DefaultValue"]);
|
||||
}
|
||||
//there's no value, no default value, setting is unknown
|
||||
//if we have a default value go ahead and insert a setting
|
||||
else if (null != defaultValue)
|
||||
{
|
||||
InsertUserSetting(propertyId, defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { APILogger.Log("failed to retrieve default setting, ", ex); }
|
||||
finally { cmd.Connection.Dispose(); }
|
||||
}
|
||||
//FB16165: we can get here if the db connection drops. It's been noted in the logs, so don't crash
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region methods
|
||||
|
||||
/// <summary>
|
||||
/// sets a specific value given a property id
|
||||
/// this is used when deserializing values out of the db
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="dv"></param>
|
||||
protected abstract void SetValue(int id, string dv);
|
||||
|
||||
/// <summary>
|
||||
/// resets all the settings for a user in the db, using the default settings in the db
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public void ResetUserSettings(int userId)
|
||||
{
|
||||
//TODO: move to stored procedure
|
||||
|
||||
//you can do this with one command with SQL, ie like
|
||||
//http://stackoverflow.com/questions/224732/sql-update-from-one-table-to-another-based-on-a-id-match
|
||||
//but since we haven't ditched SQlite yet, lets include support for both by separating it into two statements
|
||||
var properties = new List<Tuple<int, string>>();
|
||||
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_DefaultPropertiesGet.ToString();
|
||||
cmd.Parameters.Add(new SqlParameter("@PropertyId", SqlDbType.Int) { Value = null });
|
||||
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(cmd))
|
||||
{
|
||||
properties.AddRange(from DataRow row in ds.Tables[0].Rows
|
||||
let id = Convert.ToInt32(row["PropertyId"])
|
||||
let value = Convert.ToString(row["DefaultValue"])
|
||||
select new Tuple<int, string>(id, value));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_UserPropertiesUpdateInsert.ToString();
|
||||
|
||||
#region params
|
||||
|
||||
cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int) { Value = userId });
|
||||
cmd.Parameters.Add(
|
||||
new SqlParameter("@PropertyId", SqlDbType.Int) { Value = property.Item1 });
|
||||
cmd.Parameters.Add(
|
||||
new SqlParameter("@PropertyValue", SqlDbType.NVarChar) { Value = property.Item2 });
|
||||
var errorNumberParam =
|
||||
new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
|
||||
cmd.Parameters.Add(errorNumberParam);
|
||||
var errorMessageParam =
|
||||
new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
|
||||
{
|
||||
Direction = ParameterDirection.Output
|
||||
};
|
||||
cmd.Parameters.Add(errorMessageParam);
|
||||
|
||||
#endregion params
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
if (int.Parse(errorNumberParam.Value.ToString()) != 0)
|
||||
{
|
||||
//errorMessageParam.Value
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subcategory example
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class SubCategory1
|
||||
{
|
||||
public string Property1 { get; set; }
|
||||
|
||||
public string Property2 { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class SubCategory2
|
||||
{
|
||||
public string Property3 { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
DataPRO/Users/UserSettings/DescriptionAttributeEx.cs
Normal file
37
DataPRO/Users/UserSettings/DescriptionAttributeEx.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.ComponentModel;
|
||||
using Users.UserSettings;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Slice.Users.UserSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// this class overloads the description attribute to allow us to use an enum
|
||||
/// to set the description and to lookup the description in the string resources
|
||||
/// to be translated the property should have a string resource in the form of PropertyName_Description
|
||||
/// otherwise ##DescriptionNotFound## will be returned as the translated string
|
||||
/// </summary>
|
||||
public class DescriptionAttributeEx : DescriptionAttribute
|
||||
{
|
||||
private readonly PropertyEnums.PropertyIds _propertyId;
|
||||
private readonly string _propertyIdString = null;
|
||||
public DescriptionAttributeEx(PropertyEnums.PropertyIds propertyId)
|
||||
{
|
||||
_propertyId = propertyId;
|
||||
}
|
||||
public DescriptionAttributeEx(string propertyId)
|
||||
{
|
||||
_propertyIdString = propertyId;
|
||||
}
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_propertyIdString))
|
||||
{
|
||||
return StringResources.ResourceManager.GetString(_propertyIdString + "_Description") ?? @"##DescriptionNotFound##" + _propertyIdString;
|
||||
}
|
||||
return StringResources.ResourceManager.GetString(_propertyId + "_Description") ?? @"##DescriptionNotFound##" + _propertyId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
38
DataPRO/Users/UserSettings/DisplayAttributeEx.cs
Normal file
38
DataPRO/Users/UserSettings/DisplayAttributeEx.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.ComponentModel;
|
||||
using Users.UserSettings;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Slice.Users.UserSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// this class overrides the DisplayNameAttribute to provide a translated string name, and also
|
||||
/// to allow us to use an enum to create the attribute
|
||||
/// to be translated a string resource should exist in the form of PropertyName_DisplayName
|
||||
/// otherwise ##DisplayNameNotFound## will be returned
|
||||
/// </summary>
|
||||
public class DisplayAttributeEx : DisplayNameAttribute
|
||||
{
|
||||
private readonly PropertyEnums.PropertyIds _propertyId;
|
||||
|
||||
private readonly string _propertyIdString = null;
|
||||
public DisplayAttributeEx(PropertyEnums.PropertyIds propertyId)
|
||||
{
|
||||
_propertyId = propertyId;
|
||||
}
|
||||
public DisplayAttributeEx(string propertyId)
|
||||
{
|
||||
_propertyIdString = propertyId;
|
||||
}
|
||||
public override string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_propertyIdString))
|
||||
{
|
||||
return StringResources.ResourceManager.GetString(_propertyIdString + "_DisplayName") ?? @"##DisplayNameNotFound##" + _propertyIdString;
|
||||
}
|
||||
return StringResources.ResourceManager.GetString(_propertyId + "_DisplayName") ?? @"##DisplayNameNotFound##" + _propertyId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
DataPRO/Users/UserSettings/OptimizationSettings.cs
Normal file
34
DataPRO/Users/UserSettings/OptimizationSettings.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using DTS.Common.Enums.Hardware;
|
||||
using DTS.Common.Utilities.Xml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Users.UserSettings
|
||||
{
|
||||
public class OptimizationSettings
|
||||
{
|
||||
public List<Setting> Settings { get; set; }
|
||||
public OptimizationSettings()
|
||||
{
|
||||
}
|
||||
public OptimizationSettings(string xmlOptimizationSettings)
|
||||
{
|
||||
Settings = XmlToObject<OptimizationSettings>.FromXml(xmlOptimizationSettings).Settings;
|
||||
}
|
||||
|
||||
public class Setting
|
||||
{
|
||||
public HardwareTypes HardwareType { get; set; }
|
||||
public List<TransferSpeedSampleRate> TransferSpeedSampleRateSettings { get; set; }
|
||||
}
|
||||
public class TransferSpeedSampleRate
|
||||
{
|
||||
public float MaxTransferSpeed { get; set; }
|
||||
public float MinTransferSpeed { get; set; }
|
||||
public double SampleRate { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
386
DataPRO/Users/UserSettings/PropertyEnums.cs
Normal file
386
DataPRO/Users/UserSettings/PropertyEnums.cs
Normal file
@@ -0,0 +1,386 @@
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Slice.Users.UserSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// this class holds enums used for user properties/settings
|
||||
/// </summary>
|
||||
public abstract class PropertyEnums
|
||||
{
|
||||
/// <summary>
|
||||
/// here are all the categories that user settings can come in currently
|
||||
/// this is used to group properties in a propertygrid
|
||||
/// </summary>
|
||||
public enum PropertyCategories
|
||||
{
|
||||
TestInfo,
|
||||
TestDetails,
|
||||
DiagnosticOptions,
|
||||
RealtimeOptions,
|
||||
ArmChecklist,
|
||||
ExportOptions,
|
||||
UploadOptions,
|
||||
UserHistory,
|
||||
ClockSyncOptions,
|
||||
UARTOptions,
|
||||
EmbeddedSensorSampleRateOptions,
|
||||
WakeMethodOptions,
|
||||
EmbeddedSensorTriggerOptions,
|
||||
TestHistoryOptions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// used to order the properties within a category
|
||||
///
|
||||
/// </summary>
|
||||
public enum PropertyOrders
|
||||
{
|
||||
|
||||
//test info
|
||||
AutoExpandInfoSections,
|
||||
AllowAdvanceRecordingModes,
|
||||
AllowTSRAIRRecordingModes,
|
||||
AllowUARTRecordingModes,
|
||||
AllowActiveRamRecordingModes,
|
||||
UseAdvancedStreamingProfiles,
|
||||
DefaultRecordingMode,
|
||||
DefaultNumberOfEvents,
|
||||
DefaultSampleRate,
|
||||
DefaultPreTriggerSeconds,
|
||||
DefaultPostTriggerSeconds,
|
||||
AllowStreamingModes,
|
||||
DefaultStreaming,
|
||||
DefaultAutoArm,
|
||||
DefaultAutoArmRepeatEnable,
|
||||
DefaultAutoArmPreserveDiagnostics,
|
||||
DefaultDownloadROI,
|
||||
DefaultROIStart,
|
||||
DefaultROIEnd,
|
||||
DefaultViewROI,
|
||||
DefaultDownloadAll,
|
||||
DefaultViewAll,
|
||||
DefaultWarnMissingTrigger,
|
||||
DefaultTestSetupTag,
|
||||
|
||||
//test details
|
||||
DefaultCheckoutMode,
|
||||
AlignUDPToPPS,
|
||||
DefaultSuppressMissingSensorsWarning,
|
||||
DefaultSensorCalibrationBehavior,
|
||||
SupressQuitTestWarning,
|
||||
SuppressViewAllRealtime,
|
||||
SupressViewAllViewer,
|
||||
DefaultCommonStatusLine,
|
||||
DefaultTriggerCheckStep,
|
||||
DefaultMeasureSquibResistancesStep,
|
||||
DefaultAutomaticMode,
|
||||
DefaultTestSetupAutomaticProgressDelaySeconds,
|
||||
DefaultWarnOnFailedBattery,
|
||||
DefaultIgnoreShortedStart,
|
||||
DefaultIgnoreShortedTrigger,
|
||||
|
||||
//diagnostic options
|
||||
DefaultRequireAllUnitsPassDiagnostics,
|
||||
DefaultRequireUserConfirmationOnErrors,
|
||||
DefaultAllowMissingSensors,
|
||||
DefaultRequireSensorIdFound,
|
||||
DefaultTestExcitationWarmupSeconds,
|
||||
DefaultTestExcitationTOMWarmupDelayMS,
|
||||
DefaultTestExcitationIEPEWarmupDelayMS,
|
||||
DefaultRunPostTestDiagnostics,
|
||||
DefaultTreeModeDiagnostics,
|
||||
ArmTriggerDiagnosticsRunOnNextStep,
|
||||
|
||||
//RealtimeOptions
|
||||
DefaultViewRealtime,
|
||||
DefaultRealtimeGraphCount,
|
||||
RealtimeChartWidthInSeconds,
|
||||
DefaultUDPStreamProfile,
|
||||
DefaultUDPStreamAddress,
|
||||
DefaultUDPStreamTimeChannelId,
|
||||
DefaultUDPStreamDataChannelId,
|
||||
DefaultUDPStreamTmNSConfig,
|
||||
DefaultIRIGTimeDataPacketIntervalMs,
|
||||
DefaultUDPStreamMaskEUMetaData,
|
||||
//15959 Realtime Sample Rate needs to be per seat instead of site wide
|
||||
RealtimeSampleRateEthernetSLICE,
|
||||
RealtimeSampleRateSLICE6,
|
||||
RealtimeSampleRateUSBSLICE,
|
||||
RealtimeSampleRateTDAS,
|
||||
RealtimeSampleRateTDASSIM,
|
||||
|
||||
//armchecklist
|
||||
DefaultArmCheckListStep,
|
||||
DefaultCheckListBatteryVoltageCheck,
|
||||
DefaultCheckListInputVoltageCheck,
|
||||
ArmChecklistRequiredIfTOM,
|
||||
DefaultCheckListSquibResistanceCheck,
|
||||
DefaultCheckListSensorIdCheck,
|
||||
DefaultCheckListTriggerStartCheck,
|
||||
DefaultCheckListTiltSensorCheck,
|
||||
DefaultCheckListTemperatureCheck,
|
||||
DefaultCheckListClockSyncCheck,
|
||||
DefaultCheckListMustPass,
|
||||
|
||||
//ExportOptions
|
||||
DefaultExport,
|
||||
ExportCSVUnfiltered,
|
||||
ExportCSVFiltered,
|
||||
ExportCSVMV,
|
||||
ExportCSVADC,
|
||||
ExportDiademADC,
|
||||
ExportISOUnFiltered,
|
||||
ExportISOFiltered,
|
||||
ExportTDASADC,
|
||||
ExportToyotaUnfiltered,
|
||||
ExportToyotaFiltered,
|
||||
ExportTSVUnfiltered,
|
||||
ExportTSVFiltered,
|
||||
ExportRDFADC,
|
||||
ExportTDMSADC,
|
||||
ExportChryslerDDAS,
|
||||
ExportHDFUnfiltered,
|
||||
ExportHDFFiltered,
|
||||
ExportHDFMV,
|
||||
ExportHDFADC,
|
||||
ExportXLSXUnfiltered,
|
||||
ExportXLSXFiltered,
|
||||
ExportSomatUnfiltered,
|
||||
ExportSomatFiltered,
|
||||
ExportASC,
|
||||
|
||||
//UploadOptions
|
||||
UploadData,
|
||||
DefaultUploadFolder,
|
||||
DefaultUploadExportsOnly,
|
||||
|
||||
//clock sync
|
||||
DefaultClockSyncProfileMaster,
|
||||
DefaultClockSyncProfileSlave,
|
||||
DefaultPTPDomainID,
|
||||
|
||||
//uart
|
||||
DefaultUARTBaudRate,
|
||||
DefaultUARTDataBits,
|
||||
DefaultUARTStopBits,
|
||||
DefaultUARTParity,
|
||||
DefaultUARTFlowControl,
|
||||
DefaultUARTDataFormat,
|
||||
|
||||
//embedded sensors
|
||||
DefaultEmbeddedLowGLinearAccelerometerSampleRate,
|
||||
DefaultEmbeddedHighGLinearAccelerometerSampleRate,
|
||||
DefaultEmbeddedAngularAccelerometerSampleRate,
|
||||
DefaultEmbeddedAngularAccelerometerAndRateSensorSampleRate,
|
||||
DefaultEmbeddedAtmosphericSensorSampleRate,
|
||||
//power management
|
||||
//wake up
|
||||
DefaultMotionDetectDelayMs,
|
||||
DefaultMotionQualificationPeriodMs,
|
||||
DefaultMotionDetectInactivityS,
|
||||
DefaultTimeSessionDuration,
|
||||
//embedded sensor triggers
|
||||
DefaultEmbeddedHighGLinearAccelerometerTrigger,
|
||||
DefaultEmbeddedHighGLinearAccelerometerTriggerAboveAndBelow,
|
||||
DefaultTimedIntervalTrigger,
|
||||
DefaultIntervalBetweenEventStartsMinutes,
|
||||
DefaultTimedIntervalUnit,
|
||||
DefaultTimedIntervalEventDurationMs,
|
||||
DefaultTimedIntervalNumberOfEvents,
|
||||
DefaultRTCScheduleTrigger,
|
||||
DefaultRTCScheduleStartTime,
|
||||
DefaultRTCScheduleDuration,
|
||||
DefaultStoreTestHistoryInDb,
|
||||
DefaultStoreSensorTestHistoryInDb,
|
||||
DefaultStoreTestSetupXmlInDb
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this is used to define the id for all known properties, which is used
|
||||
/// in serializing/deserializing to the db
|
||||
/// it's also used to handle displayname and description translations
|
||||
/// </summary>
|
||||
public enum PropertyIds
|
||||
{
|
||||
DefaultUploadEnabled = 102,
|
||||
DefaultTestSampleRate = 103,
|
||||
DefaultPostTriggerSeconds = 104,
|
||||
DefaultPreTriggerSeconds = 105,
|
||||
DefaultTriggerCheckStep = 106,
|
||||
DefaultRealtimeGraphCount = 107,
|
||||
DefaultROIStart = 108,
|
||||
DefaultROIEnd = 109,
|
||||
DefaultDownloadROI = 110,
|
||||
DefaultViewROI = 111,
|
||||
DefaultDownloadAll = 112,
|
||||
DefaultViewAll = 113,
|
||||
DefaultRequireAllUnitsPassDiagnostics = 115,
|
||||
DefaultRequireUserConfirmationOnErrors = 116,
|
||||
DefaultAllowMissingSensors = 117,
|
||||
DefaultRunPostTestDiagnostics = 124,
|
||||
DefaultArmCheckListStep = 126,
|
||||
DefaultCheckListInputVoltageCheck = 127,
|
||||
DefaultCheckListBatteryVoltageCheck = 128,
|
||||
DefaultCheckListSquibResistanceCheck = 129,
|
||||
DefaultCheckListSensorIdCheck = 130,
|
||||
DefaultCheckListTriggerStartCheck = 131,
|
||||
DefaultRequireSensorIdFound = 132,
|
||||
DefaultCheckListMustPass = 133,
|
||||
DefaultViewRealtime = 134,
|
||||
DefaultExport = 135,
|
||||
DefaultExportFormat = 137,
|
||||
DefaultCheckListTiltSensorCheck = 138,
|
||||
ExportCSVUnfiltered = 139,
|
||||
ExportCSVFiltered = 140,
|
||||
ExportISOUnFiltered = 141,
|
||||
ExportISOFiltered = 142,
|
||||
ExportSomatUnfiltered = 143,
|
||||
ExportSomatFiltered = 144,
|
||||
ExportTDMSADC = 145,
|
||||
ExportToyotaUnfiltered = 146,
|
||||
ExportToyotaFiltered = 147,
|
||||
ExportTSVUnfiltered = 148,
|
||||
ExportTSVFiltered = 149,
|
||||
ExportTDASADC = 150,
|
||||
ExportRDFADC = 151,
|
||||
ExportChryslerDDAS = 152,
|
||||
ExportHDFUnfiltered = 153,
|
||||
ExportHDFFiltered = 154,
|
||||
ExportHDFMV = 155,
|
||||
ExportHDFADC = 156,
|
||||
ExportXLSXUnfiltered = 157,
|
||||
ExportXLSXFiltered = 158,
|
||||
DefaultCheckoutMode = 159,
|
||||
SupressQuitTestWarning = 160,
|
||||
SuppressViewAllRealtime = 161,
|
||||
SupressViewAllViewer = 162,
|
||||
DefaultCommonStatusLine = 163,
|
||||
DefaultAutomaticMode = 164,
|
||||
DefaultTestSetupAutomaticProgressDelaySeconds = 165,
|
||||
DefaultWarnOnFailedBattery = 166,
|
||||
DefaultUploadFolder = 167,
|
||||
DefaultAutoArm = 168,
|
||||
AllowAdvancedRecordingModes = 169,
|
||||
DefaultRecordingMode = 170,
|
||||
ExportDiademADC = 171,
|
||||
DefaultTestExcitationWarmupSeconds = 172,
|
||||
DefaultCheckListTemperatureCheck = 173,
|
||||
DefaultUploadExportsOnly = 174,
|
||||
ExportCSVMV = 175,
|
||||
ExportCSVADC = 176,
|
||||
DefaultTestExcitationTOMWarmupDelayMS = 177,
|
||||
DefaultTestExcitationIEPEWarmupDelayMS = 178,
|
||||
RealtimeChartWidthInSeconds = 301,
|
||||
DefaultTreeModeDiagnostics = 302,
|
||||
ArmChecklistRequiredIfTOM = 303,
|
||||
DefaultSuppressMissingSensorsWarning = 304,
|
||||
ArmTriggerDiagnosticsRunOnNextStep = 305,
|
||||
DefaultSensorCalibrationBehavior = 306,
|
||||
RealtimeSampleRateEthernetSLICE = 307,
|
||||
RealtimeSampleRateSLICE6 = 308,
|
||||
RealtimeSampleRateUSBSLICE = 309,
|
||||
RealtimeSampleRateTDAS = 310,
|
||||
RealtimeSampleRateTDASSIM = 311,
|
||||
UsersCurrentTestSetup = 401,
|
||||
LastRunTestSetup = 402,
|
||||
LastUsedSampleRate = 403,
|
||||
ApplySensorDataToBlankChannels = 404,
|
||||
ShowOptionsWhenApplyingSensorToBlankChannel = 405,
|
||||
DefaultStreaming = 406,
|
||||
DefaultCheckListClockSyncCheck = 407,
|
||||
DefaultClockSyncProfileMaster = 408,
|
||||
DefaultClockSyncProfileSlave = 409,
|
||||
AllowUARTRecordingModes = 410,
|
||||
DefaultUARTBaudRate = 411,
|
||||
DefaultUARTDataBits = 412,
|
||||
DefaultUARTStopBits = 413,
|
||||
DefaultUARTParity = 414,
|
||||
DefaultUARTFlowControl = 415,
|
||||
DefaultUDPStreamProfile = 416,
|
||||
DefaultUDPStreamTimeChannelId = 417,
|
||||
DefaultUDPStreamDataChannelId = 418,
|
||||
DefaultUDPStreamTmNSConfig = 419,
|
||||
DefaultIRIGTimeDataPacketIntervalMs = 420,
|
||||
DefaultAutoArmRepeatEnable = 421,
|
||||
DefaultAutoArmPreserveDiagnostics = 422,
|
||||
DefaultMeasureSquibResistancesStep = 423,
|
||||
DefaultNumberOfEvents = 424,
|
||||
//17566 Config option to "Auto expand" test info sections.
|
||||
AutoExpandInfoSections = 425,
|
||||
ExpandMainInfo = 426,
|
||||
ExpandTestInfo = 427,
|
||||
ExpandTestDiag = 428,
|
||||
ExpandTestRealtime = 429,
|
||||
ExpandTestClockSync = 430,
|
||||
ExpandTestArmChecklist = 431,
|
||||
ExpandTestUpload = 432,
|
||||
ExpandTestExport = 433,
|
||||
ApplyHardwareAssignmentInHardwareDisco = 434,
|
||||
|
||||
DefaultEmbeddedLowGLinearAccelerometerSampleRate = 435,
|
||||
DefaultEmbeddedHighGLinearAccelerometerSampleRate = 436,
|
||||
DefaultEmbeddedAngularAccelerometerSampleRate = 437,
|
||||
DefaultEmbeddedAngularAccelerometerAndRateSensorSampleRate = 438,
|
||||
DefaultEmbeddedAtmosphericSensorSampleRate = 439,
|
||||
|
||||
DefaultWakeMethod = 441,
|
||||
DefaultMotionDetectDelayMs = 442,
|
||||
DefaultMotionQualificationPeriodMs = 443,
|
||||
DefaultMotionDetectInactivityS = 444,
|
||||
|
||||
DefaultTimeSessionDuration = 447,
|
||||
|
||||
DefaultEmbeddedHighGLinearAccelerometerTrigger = 453,
|
||||
DefaultEmbeddedHighGLinearAccelerometerTriggerAboveAndBelow = 454,
|
||||
DefaultTimedIntervalTrigger = 468,
|
||||
DefaultIntervalBetweenEventStartsMinutes = 469,
|
||||
DefaultTimedIntervalUnit = 470,
|
||||
DefaultTimedIntervalEventDurationMs = 471,
|
||||
DefaultTimedIntervalNumberOfEvents = 472,
|
||||
DefaultRTCScheduleTrigger = 473,
|
||||
DefaultRTCScheduleStartTime = 474,
|
||||
DefaultRTCScheduleDuration = 475,
|
||||
|
||||
DefaultStoreTestHistoryInDb = 476,
|
||||
DefaultStoreSensorTestHistoryInDb = 477,
|
||||
DefaultStoreTestSetupXmlInDb = 478,
|
||||
DefaultWarnMissingTrigger = 479,
|
||||
|
||||
AllowStreamingModes = 480,
|
||||
//whether to remember test id prefix/suffix
|
||||
//18028 Remember test id suffix drop down state
|
||||
StoreTestIdAffixes = 481,
|
||||
TestIdPrefix = 482,
|
||||
TestIdSuffix = 483,
|
||||
|
||||
//18361
|
||||
DefaultUARTDataFormat = 484,
|
||||
//18362
|
||||
DefaultUDPStreamAddress = 485,
|
||||
DefaultUDPStreamMaskEUMetaData = 486,
|
||||
DefaultTestSetupTag = 487,
|
||||
AllowTSRAIRRecordingModes = 488,
|
||||
ExportASC = 489,
|
||||
|
||||
//29835
|
||||
DefaultIgnoreShortedStart = 490,
|
||||
DefaultIgnoreShortedTrigger = 491,
|
||||
|
||||
//31840
|
||||
DefaultUseAdvancedUDPStreamProfiles = 492,
|
||||
//30513
|
||||
DefaultPTPDomainID = 493,
|
||||
//31841
|
||||
AllowActiveRamRecordingModes = 494,
|
||||
//39470
|
||||
AlignUDPToPPS = 495,
|
||||
|
||||
//44881
|
||||
DefaultCANIsFD = 497,
|
||||
DefaultCANArbBaseBitrate = 498,
|
||||
DefaultCANArbBaseSJW = 499,
|
||||
DefaultCANDataBitrate = 500,
|
||||
DefaultCANDataSJW = 501,
|
||||
DefaultCANFileType = 502,
|
||||
}
|
||||
}
|
||||
}
|
||||
53
DataPRO/Users/UserSettings/PropertyIdAttribute.cs
Normal file
53
DataPRO/Users/UserSettings/PropertyIdAttribute.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Slice.Users.UserSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// this PropertyId attribute is a little more complex than some of the other attributes
|
||||
/// it can be associated with an enum or an integer, in the db obviously properties are keyed by
|
||||
/// property id as an integer, but for convenience in code we use the enum form
|
||||
/// this attribute lets you store the property id for a property and get either the id or enum value
|
||||
/// </summary>
|
||||
public class PropertyIdAttribute : Attribute
|
||||
{
|
||||
private readonly PropertyEnums.PropertyIds _propertyId;
|
||||
/// <summary>
|
||||
/// returns the property id from a property
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetPropertyId(System.Reflection.PropertyInfo o)
|
||||
{
|
||||
if (o == null) throw new NullReferenceException("GetPropertyId called on a null reference");
|
||||
|
||||
var attr = o.GetCustomAttributes(typeof(PropertyIdAttribute), false);
|
||||
if (null == attr || 0 == attr.Length)
|
||||
{
|
||||
throw new NullReferenceException("GetPropertyId called on an object with no PropertyIdAttribute, object: " + o);
|
||||
}
|
||||
return (int)((PropertyIdAttribute)attr.First())._propertyId;
|
||||
}
|
||||
/// <summary>
|
||||
/// returns the propertyid (as an enum) from a property
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
/// <returns></returns>
|
||||
public static PropertyEnums.PropertyIds GetPropertyIdEnum(System.Reflection.PropertyInfo o)
|
||||
{
|
||||
if (o == null) throw new NullReferenceException();
|
||||
|
||||
var attr = o.GetCustomAttributes(typeof(PropertyIdAttribute), false);
|
||||
if (null == attr || 0 == attr.Length)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
return ((PropertyIdAttribute)attr.First())._propertyId;
|
||||
}
|
||||
public PropertyIdAttribute(PropertyEnums.PropertyIds propertyId)
|
||||
{
|
||||
_propertyId = propertyId;
|
||||
}
|
||||
}
|
||||
}
|
||||
92
DataPRO/Users/UserSettings/SampleRateConverter.cs
Normal file
92
DataPRO/Users/UserSettings/SampleRateConverter.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using DTS.Common.Settings;
|
||||
|
||||
namespace DTS.Slice.Users.UserSettings
|
||||
{
|
||||
public class SampleRateConverter : DoubleConverter
|
||||
{
|
||||
List<double> _validSampleRateList = new List<double>();
|
||||
private const int SampleRateIndiceCountDefault = 24;
|
||||
private const int SPSINDICE_COUNT = 56;
|
||||
private const string SAMPLERATE_INDEX = "SPSINDEX_";
|
||||
public static int[] AvailableSampleRatesDefault = new int[]
|
||||
{
|
||||
5,
|
||||
50,
|
||||
100,
|
||||
200,
|
||||
250, //TDC rates start here, everything from here to next comment is in default TDC.ini
|
||||
500,
|
||||
1000,
|
||||
2000,
|
||||
2500,
|
||||
5000,
|
||||
8000,
|
||||
10000,
|
||||
12500,
|
||||
20000,
|
||||
25000,
|
||||
40000,
|
||||
50000,
|
||||
60000,
|
||||
75000,
|
||||
100000,
|
||||
150000,
|
||||
300000, //TDC rates end here
|
||||
400000,
|
||||
500000,
|
||||
1000000
|
||||
};
|
||||
public SampleRateConverter()
|
||||
{
|
||||
}
|
||||
//public SampleRateConverter(List<double> validSampleRateList)
|
||||
//{
|
||||
// _validSampleRateList = validSampleRateList;
|
||||
//}
|
||||
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
||||
{
|
||||
var SampleRateIndiceCount = SettingsDB.GetGlobalValueInt(SPSINDICE_COUNT.ToString(), SampleRateIndiceCountDefault);
|
||||
_validSampleRateList.Clear();
|
||||
for (var i = 0; i < SampleRateIndiceCount; i++)
|
||||
{
|
||||
var defaultValue = -1;
|
||||
if (i < AvailableSampleRatesDefault.Length) { defaultValue = AvailableSampleRatesDefault[i]; }
|
||||
var value = SettingsDB.GetGlobalValueInt(SAMPLERATE_INDEX + i.ToString(CultureInfo.InvariantCulture), defaultValue);
|
||||
if (_validSampleRateList.Contains(value)) continue;
|
||||
if (value > 0) { _validSampleRateList.Add(Convert.ToDouble(value)); }
|
||||
}
|
||||
return new StandardValuesCollection(_validSampleRateList.ToArray());
|
||||
}
|
||||
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
return base.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
return base.CanConvertFrom(context, sourceType);
|
||||
}
|
||||
public override bool CanConvertTo(ITypeDescriptorContext context, Type t)
|
||||
{
|
||||
return base.CanConvertTo(context, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
3015
DataPRO/Users/UserSettings/StringResources.Designer.cs
generated
Normal file
3015
DataPRO/Users/UserSettings/StringResources.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
588
DataPRO/Users/UserSettings/StringResources.ja.resx
Normal file
588
DataPRO/Users/UserSettings/StringResources.ja.resx
Normal file
@@ -0,0 +1,588 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="DefaultPostTriggerSeconds_Description" xml:space="preserve">
|
||||
<value>ポストトリガー 記録時間(サーキュラーバッファーモード)または記録時間(レコーダーモード)の設定です。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultPostTriggerSeconds_DisplayName" xml:space="preserve">
|
||||
<value>ポストトリガー 記録時間 / 記録時間 の既定値(秒)</value>
|
||||
</data>
|
||||
<data name="DefaultTestSampleRate_Description" xml:space="preserve">
|
||||
<value>サンプルレート(sps)の設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultTestSampleRate_DisplayName" xml:space="preserve">
|
||||
<value>サンプルレートの既定値(sps)</value>
|
||||
</data>
|
||||
<data name="DefaultTestSettings" xml:space="preserve">
|
||||
<value>Test settings</value>
|
||||
</data>
|
||||
<data name="DefaultUploadEnabled" xml:space="preserve">
|
||||
<value>Upload</value>
|
||||
</data>
|
||||
<data name="test" xml:space="preserve">
|
||||
<value>試験</value>
|
||||
</data>
|
||||
<data name="ArmChecklistRequiredIfTOM_Description" xml:space="preserve">
|
||||
<value>この項目をチェックすると、TOMが存在する場合には「アーム直前診断を使う」のオンオフにかかわらずARM直前診断を実行します。</value>
|
||||
</data>
|
||||
<data name="ArmChecklistRequiredIfTOM_DisplayName" xml:space="preserve">
|
||||
<value>TOMが存在する場合はARM直前診断を実行する (推奨)</value>
|
||||
</data>
|
||||
<data name="ArmTriggerDiagnosticsRunOnNextStep_Description" xml:space="preserve">
|
||||
<value>ダイアグのステップが選択されたらすぐにユーザの入力を待たずに全チャンネルのダイアグを開始します</value>
|
||||
</data>
|
||||
<data name="ArmTriggerDiagnosticsRunOnNextStep_DisplayName" xml:space="preserve">
|
||||
<value>ダイアグのステップが選択されたらすぐに全チャンネルのダイアグを開始する</value>
|
||||
</data>
|
||||
<data name="DefaultAllowMissingSensors_Description" xml:space="preserve">
|
||||
<value>すべてのセンサがみつからない場合に試験を続行できるかの設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultAllowMissingSensors_DisplayName" xml:space="preserve">
|
||||
<value>センサーが見つからない状態を許可</value>
|
||||
</data>
|
||||
<data name="DefaultRequireSensorIdFound_Description" xml:space="preserve">
|
||||
<value>この項目がチェックされていると、センサID照合の時にセンサーIDの登録されているセンサのマニュアルアサインは不可能になります。</value>
|
||||
</data>
|
||||
<data name="DefaultRequireSensorIdFound_DisplayName" xml:space="preserve">
|
||||
<value>センサーIDが登録されている場合はIDを認識しないと進めない</value>
|
||||
</data>
|
||||
<data name="DefaultArmCheckListStep_Description" xml:space="preserve">
|
||||
<value>アーム直前診断を実行するかどうか。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultArmCheckListStep_DisplayName" xml:space="preserve">
|
||||
<value>アーム直前診断を使う</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListBatteryVoltageCheck_Description" xml:space="preserve">
|
||||
<value>アーム直前診断でバッテリー電圧の診断をするかどうか。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListBatteryVoltageCheck_DisplayName" xml:space="preserve">
|
||||
<value>バッテリー電圧診断</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListInputVoltageCheck_Description" xml:space="preserve">
|
||||
<value>アーム直前診断で外部電源電圧の診断をするかどうか。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListInputVoltageCheck_DisplayName" xml:space="preserve">
|
||||
<value>外部電源電圧診断</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListMustPass_Description" xml:space="preserve">
|
||||
<value>この項目がチェックされていると、アーム直前診断ですべてがパスしないとARMができません。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListMustPass_DisplayName" xml:space="preserve">
|
||||
<value>全ユニットがアーム直前診断をパスすることを要求</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListSensorIdCheck_Description" xml:space="preserve">
|
||||
<value>アーム直前診断でセンサIDの照合をするかどうか。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListSensorIdCheck_DisplayName" xml:space="preserve">
|
||||
<value>センサーID照合</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListSquibResistanceCheck_Description" xml:space="preserve">
|
||||
<value>アーム直前診断でスクイブ抵抗値のチェックをするかどうか。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListSquibResistanceCheck_DisplayName" xml:space="preserve">
|
||||
<value>スクイブ抵抗診断(推奨)</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListTriggerStartCheck_Description" xml:space="preserve">
|
||||
<value>この項目サポートされていませんのではチェックをしないでください</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListTriggerStartCheck_DisplayName" xml:space="preserve">
|
||||
<value>(この項目はチェックしないでください)</value>
|
||||
</data>
|
||||
<data name="DefaultDownloadAll_Description" xml:space="preserve">
|
||||
<value>全記録時間のダウンロードを実行する場合にチェックします。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultDownloadAll_DisplayName" xml:space="preserve">
|
||||
<value>全記録時間をダウンロードする</value>
|
||||
</data>
|
||||
<data name="DefaultDownloadROI_Description" xml:space="preserve">
|
||||
<value>指定時間(ROI)のダウンロードを実行する場合にチェックします。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultDownloadROI_DisplayName" xml:space="preserve">
|
||||
<value>指定時間(ROI)をダウンロードする</value>
|
||||
</data>
|
||||
<data name="DefaultExport_Description" xml:space="preserve">
|
||||
<value>データのエクスポートを実行する場合にチェックします。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultExport_DisplayName" xml:space="preserve">
|
||||
<value>データのエクスポートをする</value>
|
||||
</data>
|
||||
<data name="DefaultPreTriggerSeconds_Description" xml:space="preserve">
|
||||
<value>プリトリガー 記録時間の設定です。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultPreTriggerSeconds_DisplayName" xml:space="preserve">
|
||||
<value>プリトリガー 記録時間の既定値(秒)</value>
|
||||
</data>
|
||||
<data name="DefaultRealtimeGraphCount_Description" xml:space="preserve">
|
||||
<value>リアルタイム表示の同時表示チャンネル数の設定です。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultRealtimeGraphCount_DisplayName" xml:space="preserve">
|
||||
<value> グラフの数</value>
|
||||
</data>
|
||||
<data name="DefaultRequireAllUnitsPassDiagnostics_Description" xml:space="preserve">
|
||||
<value>全てのダイアグ項目がパスにならなかった場合、試験を続けられるかの設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultRequireAllUnitsPassDiagnostics_DisplayName" xml:space="preserve">
|
||||
<value>全ユニットがダイアグをパスすることを要求</value>
|
||||
</data>
|
||||
<data name="DefaultRequireUserConfirmationOnErrors_Description" xml:space="preserve">
|
||||
<value>ダイアグまたは試験実施においてエラーは発生した場合、ユーザーに確認を要求するかどうか。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultRequireUserConfirmationOnErrors_DisplayName" xml:space="preserve">
|
||||
<value>エラーの確認をユーザーに要求する</value>
|
||||
</data>
|
||||
<data name="DefaultROIEnd_Description" xml:space="preserve">
|
||||
<value>指定時間の終了時刻の設定です。トリガ前はマイナス、トリガ後はプラスの値になります。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultROIEnd_DisplayName" xml:space="preserve">
|
||||
<value>指定時間 終了(秒)</value>
|
||||
</data>
|
||||
<data name="DefaultROIStart_Description" xml:space="preserve">
|
||||
<value>指定時間の開始時刻の設定です。トリガ前はマイナス、トリガ後はプラスの値になります。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultROIStart_DisplayName" xml:space="preserve">
|
||||
<value>指定時間 開始(秒)</value>
|
||||
</data>
|
||||
<data name="DefaultRunPostTestDiagnostics_Description" xml:space="preserve">
|
||||
<value>試験後ダイアグを実行するかどうかの設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultRunPostTestDiagnostics_DisplayName" xml:space="preserve">
|
||||
<value>試験後ダイアグの実行</value>
|
||||
</data>
|
||||
<data name="DefaultSuppressMissingSensorsWarning_Description" xml:space="preserve">
|
||||
<value>すべてのセンサが接続されていない時の警告の有無を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultSuppressMissingSensorsWarning_DisplayName" xml:space="preserve">
|
||||
<value>すべてのセンサが接続されていない時の警告を表示しない</value>
|
||||
</data>
|
||||
<data name="DefaultTreeModeDiagnostics_Description" xml:space="preserve">
|
||||
<value>ダイアグ結果のデフォルト表示方法。チェックするとツリービュー、チェックしないとテーブル ビューになります。</value>
|
||||
</data>
|
||||
<data name="DefaultTreeModeDiagnostics_DisplayName" xml:space="preserve">
|
||||
<value>ダイアグでツリー ビューを使用する (チェックしないとテーブル ビュー)</value>
|
||||
</data>
|
||||
<data name="DefaultTriggerCheckStep_Description" xml:space="preserve">
|
||||
<value>トリガーチェックを実行するかどうか、新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultTriggerCheckStep_DisplayName" xml:space="preserve">
|
||||
<value>トリガーチェックを実行する</value>
|
||||
</data>
|
||||
<data name="DefaultUploadEnabled_Description" xml:space="preserve">
|
||||
<value>データのアップロードをするかどうかの設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultUploadEnabled_DisplayName" xml:space="preserve">
|
||||
<value>データのアップロードをする</value>
|
||||
</data>
|
||||
<data name="DefaultViewAll_Description" xml:space="preserve">
|
||||
<value>全記録時間の表示を行うかどうかの設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultViewAll_DisplayName" xml:space="preserve">
|
||||
<value>全記録時間の表示</value>
|
||||
</data>
|
||||
<data name="DefaultViewRealtime_Description" xml:space="preserve">
|
||||
<value>リアルタイム表示を行うかどうかの設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultViewRealtime_DisplayName" xml:space="preserve">
|
||||
<value>リアルタイム表示をする</value>
|
||||
</data>
|
||||
<data name="DefaultViewROI_Description" xml:space="preserve">
|
||||
<value>指定時間の表示/非表示設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultViewROI_DisplayName" xml:space="preserve">
|
||||
<value>指定時間の表示</value>
|
||||
</data>
|
||||
<data name="LastRunTestSetup_Description" xml:space="preserve">
|
||||
<value>The last run test setup</value>
|
||||
</data>
|
||||
<data name="LastRunTestSetup_DisplayName" xml:space="preserve">
|
||||
<value>Last run test setup</value>
|
||||
</data>
|
||||
<data name="LastUsedSampleRate_Description" xml:space="preserve">
|
||||
<value>The last used sample rate (per second)</value>
|
||||
</data>
|
||||
<data name="LastUsedSampleRate_DisplayName" xml:space="preserve">
|
||||
<value>Last used sample rate</value>
|
||||
</data>
|
||||
<data name="RealtimeChartWidthInSeconds_Description" xml:space="preserve">
|
||||
<value> 横軸に表示する時間(秒)の設定。</value>
|
||||
</data>
|
||||
<data name="RealtimeChartWidthInSeconds_DisplayName" xml:space="preserve">
|
||||
<value> 横軸に表示する時間(秒)</value>
|
||||
</data>
|
||||
<data name="RealtimeSettings" xml:space="preserve">
|
||||
<value>Realtime settings</value>
|
||||
</data>
|
||||
<data name="TestOptions" xml:space="preserve">
|
||||
<value>Test options</value>
|
||||
</data>
|
||||
<data name="UserHistory" xml:space="preserve">
|
||||
<value>User history</value>
|
||||
</data>
|
||||
<data name="UsersCurrentTestSetup_Description" xml:space="preserve">
|
||||
<value>The active test setup</value>
|
||||
</data>
|
||||
<data name="UsersCurrentTestSetup_DisplayName" xml:space="preserve">
|
||||
<value>Current test setup</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListTiltSensorCheck_Description" xml:space="preserve">
|
||||
<value>アーム直前診断でチルトセンサーのチェックをするかどうか。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListTiltSensorCheck_DisplayName" xml:space="preserve">
|
||||
<value>チルトセンサーのチェック</value>
|
||||
</data>
|
||||
<data name="AllowAdvancedRecordingModes_Description" xml:space="preserve">
|
||||
<value>サーキュラーバッファモード、レコーダーモード以外の記録モードを選択可能にします</value>
|
||||
</data>
|
||||
<data name="AllowAdvancedRecordingModes_DisplayName" xml:space="preserve">
|
||||
<value>アドバンス記録モードを使用可能にする</value>
|
||||
</data>
|
||||
<data name="ArmChecklist" xml:space="preserve">
|
||||
<value>(4) アーム直前診断</value>
|
||||
</data>
|
||||
<data name="DefaultAutoArm_Description" xml:space="preserve">
|
||||
<value>DASをオートアームモードに設定するにはこの項目をチェックしてください。</value>
|
||||
</data>
|
||||
<data name="DefaultAutoArm_DisplayName" xml:space="preserve">
|
||||
<value>DASをオートアームモードに設定する</value>
|
||||
</data>
|
||||
<data name="DefaultAutomaticMode_Description" xml:space="preserve">
|
||||
<value>自動モードを使用するかどうか 新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultAutomaticMode_DisplayName" xml:space="preserve">
|
||||
<value>自動モードを使用する</value>
|
||||
</data>
|
||||
<data name="DefaultCheckoutMode_Description" xml:space="preserve">
|
||||
<value>新規にテストセトアップを作成する時、チェックアウトモードをオンにします。</value>
|
||||
</data>
|
||||
<data name="DefaultCheckoutMode_DisplayName" xml:space="preserve">
|
||||
<value>チェックアウトモード ==スクイブ出力をしない== (通常OFF)</value>
|
||||
</data>
|
||||
<data name="DefaultCommonStatusLine_Description" xml:space="preserve">
|
||||
<value>ステータス信号の相互監視機能の有無、新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultCommonStatusLine_DisplayName" xml:space="preserve">
|
||||
<value>ステータス信号の相互監視(通常ON)</value>
|
||||
</data>
|
||||
<data name="DefaultRecordingMode_Description" xml:space="preserve">
|
||||
<value>記録モードの設定です。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultRecordingMode_DisplayName" xml:space="preserve">
|
||||
<value>記録モード</value>
|
||||
</data>
|
||||
<data name="DefaultTestSetupAutomaticProgressDelaySeconds_Description" xml:space="preserve">
|
||||
<value>自動モードで次のステップに進むまでの待機時間(秒)。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultTestSetupAutomaticProgressDelaySeconds_DisplayName" xml:space="preserve">
|
||||
<value>自動モードで次のステップに進むまでの待機時間(秒)</value>
|
||||
</data>
|
||||
<data name="DefaultUploadFolder_Description" xml:space="preserve">
|
||||
<value>新規テストセトアップにおけるデフォルトアップロードフォルダを設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultUploadFolder_DisplayName" xml:space="preserve">
|
||||
<value>アップロード先フォルダ</value>
|
||||
</data>
|
||||
<data name="DefaultWarnOnFailedBattery_Description" xml:space="preserve">
|
||||
<value>バッテリー異常、バッテリーなしを警告するかどうかの設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultWarnOnFailedBattery_DisplayName" xml:space="preserve">
|
||||
<value>バッテリー異常、バッテリーなしを警告する</value>
|
||||
</data>
|
||||
<data name="DiagnosticOptions" xml:space="preserve">
|
||||
<value>(2) ダイアグオプション</value>
|
||||
</data>
|
||||
<data name="DownloadAndViewOptions" xml:space="preserve">
|
||||
<value>(6) ダウンロード/表示 オプション</value>
|
||||
</data>
|
||||
<data name="ExportChryslerDDAS_Description" xml:space="preserve">
|
||||
<value>Controls whether export DDAS unfiltered EU data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportChryslerDDAS_DisplayName" xml:space="preserve">
|
||||
<value>DDAS EU フィルタ有り </value>
|
||||
</data>
|
||||
<data name="ExportCSVFiltered_Description" xml:space="preserve">
|
||||
<value>CSV EU フィルタ有り のエクスポートを有効にします。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="ExportCSVFiltered_DisplayName" xml:space="preserve">
|
||||
<value>CSV EU フィルタ有り</value>
|
||||
</data>
|
||||
<data name="ExportCSVUnfiltered_Description" xml:space="preserve">
|
||||
<value>CSV EU フィルタ無し のエクスポートを有効にします。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="ExportCSVUnfiltered_DisplayName" xml:space="preserve">
|
||||
<value>CSV EU フィルタ無し</value>
|
||||
</data>
|
||||
<data name="ExportHDFADC_Description" xml:space="preserve">
|
||||
<value>Controls whether export HDF ADC data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportHDFADC_DisplayName" xml:space="preserve">
|
||||
<value>HDF ADC</value>
|
||||
</data>
|
||||
<data name="ExportHDFFiltered_Description" xml:space="preserve">
|
||||
<value>Controls whether export HDF filtered EU </value>
|
||||
</data>
|
||||
<data name="ExportHDFFiltered_DisplayName" xml:space="preserve">
|
||||
<value>HDF EU フィルタ有り </value>
|
||||
</data>
|
||||
<data name="ExportHDFMV_Description" xml:space="preserve">
|
||||
<value>Controls whether export HDF mV data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportHDFMV_DisplayName" xml:space="preserve">
|
||||
<value>HDF mV</value>
|
||||
</data>
|
||||
<data name="ExportHDFUnfiltered_Description" xml:space="preserve">
|
||||
<value>Controls whether export HDF unfiltered EU data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportHDFUnfiltered_DisplayName" xml:space="preserve">
|
||||
<value>HDF EU フィルタ無し</value>
|
||||
</data>
|
||||
<data name="ExportISOFiltered_Description" xml:space="preserve">
|
||||
<value>ISO形式 EU フィルタ有り のエクスポートを有効にします。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="ExportISOFiltered_DisplayName" xml:space="preserve">
|
||||
<value>ISO EU フィルタ有り</value>
|
||||
</data>
|
||||
<data name="ExportISOUnFiltered_Description" xml:space="preserve">
|
||||
<value>ISO形式 EU フィルタ無し のエクスポートを有効にします。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="ExportISOUnFiltered_DisplayName" xml:space="preserve">
|
||||
<value>ISO EU フィルタ無し</value>
|
||||
</data>
|
||||
<data name="ExportOptions" xml:space="preserve">
|
||||
<value>(7) エクスポートの設定</value>
|
||||
</data>
|
||||
<data name="ExportRDFADC_Description" xml:space="preserve">
|
||||
<value>Controls whether export RDF ADC data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportRDFADC_DisplayName" xml:space="preserve">
|
||||
<value>RDF ADC</value>
|
||||
</data>
|
||||
<data name="ExportSomatFiltered_Description" xml:space="preserve">
|
||||
<value>Controls whether export Somat filtered data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportSomatFiltered_DisplayName" xml:space="preserve">
|
||||
<value>Somat filtered EU</value>
|
||||
</data>
|
||||
<data name="ExportSomatUnfiltered_Description" xml:space="preserve">
|
||||
<value>Controls whether export Somat unfiltered data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportSomatUnfiltered_DisplayName" xml:space="preserve">
|
||||
<value>Somat EU フィルタ無し</value>
|
||||
</data>
|
||||
<data name="ExportTDASADC_Description" xml:space="preserve">
|
||||
<value>Controls whether export TDAS ADCdata is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportTDASADC_DisplayName" xml:space="preserve">
|
||||
<value>TDAS ADC</value>
|
||||
</data>
|
||||
<data name="ExportTDMSADC_Description" xml:space="preserve">
|
||||
<value>Controls whether export TDMS ADC data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportTDMSADC_DisplayName" xml:space="preserve">
|
||||
<value>TDMS ADC</value>
|
||||
</data>
|
||||
<data name="ExportToyotaFiltered_Description" xml:space="preserve">
|
||||
<value>Controls whether export TTS EU filtered EU data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportToyotaFiltered_DisplayName" xml:space="preserve">
|
||||
<value>TTS EU フィルタ無し</value>
|
||||
</data>
|
||||
<data name="ExportToyotaUnfiltered_Description" xml:space="preserve">
|
||||
<value>Controls whether export TTS unfiltered EU data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportToyotaUnfiltered_DisplayName" xml:space="preserve">
|
||||
<value>(この項目は使用しません)</value>
|
||||
</data>
|
||||
<data name="ExportTSVFiltered_Description" xml:space="preserve">
|
||||
<value>Controls whether export TSV filtered EU data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportTSVFiltered_DisplayName" xml:space="preserve">
|
||||
<value>TSV EU フィルタ有り</value>
|
||||
</data>
|
||||
<data name="ExportTSVUnfiltered_Description" xml:space="preserve">
|
||||
<value>Controls whether export TSV unfiltered EU data is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportTSVUnfiltered_DisplayName" xml:space="preserve">
|
||||
<value>TSV EU フィルタ無し</value>
|
||||
</data>
|
||||
<data name="ExportXLSXFiltered_Description" xml:space="preserve">
|
||||
<value>Microsoft Excel (XLSX) EU フィルタ有り のエクスポートを有効にします。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="ExportXLSXFiltered_DisplayName" xml:space="preserve">
|
||||
<value>XLSX EU フィルタ有り</value>
|
||||
</data>
|
||||
<data name="ExportXLSXUnfiltered_Description" xml:space="preserve">
|
||||
<value>Microsoft Excel (XLSX) EU フィルタ無し のエクスポートを有効にします。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="ExportXLSXUnfiltered_DisplayName" xml:space="preserve">
|
||||
<value>XLSX EU フィルタ無し</value>
|
||||
</data>
|
||||
<data name="RealtimeOptions" xml:space="preserve">
|
||||
<value>(3) リアルタイム設定</value>
|
||||
</data>
|
||||
<data name="RecordingOptions" xml:space="preserve">
|
||||
<value>(5) 記録設定</value>
|
||||
</data>
|
||||
<data name="SuppressViewAllRealtime_Description" xml:space="preserve">
|
||||
<value>リアルタイムモードを終了する時の警告の有無、新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="SuppressViewAllRealtime_DisplayName" xml:space="preserve">
|
||||
<value>リアルタイムモードを終了する時に警告を表示しない</value>
|
||||
</data>
|
||||
<data name="SupressQuitTestWarning_Description" xml:space="preserve">
|
||||
<value>試験を中断する時の警告の有無、新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="SupressQuitTestWarning_DisplayName" xml:space="preserve">
|
||||
<value>試験を中断する時に警告を表示しない</value>
|
||||
</data>
|
||||
<data name="SupressViewAllViewer_Description" xml:space="preserve">
|
||||
<value>データ表示を終了する時の警告の有無、新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="SupressViewAllViewer_DisplayName" xml:space="preserve">
|
||||
<value>データ表示を終了する時に警告を表示しない</value>
|
||||
</data>
|
||||
<data name="TestInfo" xml:space="preserve">
|
||||
<value>(1) 試験情報</value>
|
||||
</data>
|
||||
<data name="UploadOptions" xml:space="preserve">
|
||||
<value>(8) アップロードの設定</value>
|
||||
</data>
|
||||
<data name="ExportDiademADC_Description" xml:space="preserve">
|
||||
<value>Controls whether export ADC is enabled by default for new test setups</value>
|
||||
</data>
|
||||
<data name="ExportDiademADC_DisplayName" xml:space="preserve">
|
||||
<value>DIAdem ADC</value>
|
||||
</data>
|
||||
<data name="DefaultTestExcitationWarmupSeconds_Description" xml:space="preserve">
|
||||
<value>センサウォームアップ時間の設定。新規テストセトアップにおけるデフォルト値を設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultTestExcitationWarmupSeconds_DisplayName" xml:space="preserve">
|
||||
<value>センサーウォーム アップ(秒) < suggested</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListTemperatureCheck_Description" xml:space="preserve">
|
||||
<value>アーム直前診断で温度のチェックをするかどうか。新規テストセトアップにおけるデフォルト値を設定します</value>
|
||||
</data>
|
||||
<data name="DefaultCheckListTemperatureCheck_DisplayName" xml:space="preserve">
|
||||
<value>温度のチェック</value>
|
||||
</data>
|
||||
<data name="DefaultUploadExportsOnly_Description" xml:space="preserve">
|
||||
<value>アップロードの時、すべてのテストファイルをアップロードするかエクスポートされたファイルのみアップロードするかを設定します。</value>
|
||||
</data>
|
||||
<data name="DefaultUploadExportsOnly_DisplayName" xml:space="preserve">
|
||||
<value>エクスポートファイルのみアップロードする</value>
|
||||
</data>
|
||||
</root>
|
||||
1104
DataPRO/Users/UserSettings/StringResources.resx
Normal file
1104
DataPRO/Users/UserSettings/StringResources.resx
Normal file
File diff suppressed because it is too large
Load Diff
1291
DataPRO/Users/UserSettings/TestSetupDefaults.cs
Normal file
1291
DataPRO/Users/UserSettings/TestSetupDefaults.cs
Normal file
File diff suppressed because it is too large
Load Diff
182
DataPRO/Users/UserSettings/UserHistory.cs
Normal file
182
DataPRO/Users/UserSettings/UserHistory.cs
Normal file
@@ -0,0 +1,182 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using DTS.Common.Storage;
|
||||
|
||||
// ReSharper disable RedundantEmptyDefaultSwitchBranch
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Slice.Users.UserSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// user specific properties, stored in db
|
||||
///
|
||||
/// these are all the user specific settings we are storing in the db currently as generic settings
|
||||
/// we have a few user specific settings like last used hardware that are stored in other places, that maybe
|
||||
/// should be stored here as well
|
||||
///
|
||||
/// it's possible to retrieve all the settings at once (more efficient, only one db query), or retrieve settings individually
|
||||
/// one by one using the static accessors
|
||||
/// each setting has a default specified both in code and in the db.
|
||||
/// when retrieving a setting we fall back to the default if a user specific value is not found
|
||||
/// if the default setting in the db is not found, we can further fall back to the default specified in code
|
||||
///
|
||||
/// in the db we have a table that lists all the settings with their fall back default value
|
||||
/// we have a separate table that stores the user specific values for any of those settings, which may or may not match the fall
|
||||
/// back default value
|
||||
///
|
||||
/// the data should always be stored in invariant form in the db
|
||||
/// DisplayName, Description attributes translate so the properties can be displayed in a property grid
|
||||
/// </summary>
|
||||
public class UserHistory
|
||||
{
|
||||
|
||||
#region properties
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.UserHistory)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.UsersCurrentTestSetup)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.UsersCurrentTestSetup)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.UsersCurrentTestSetup)]
|
||||
[DefaultValue("")]
|
||||
[ReadOnly(true)]
|
||||
public string UsersCurrentTestSetup { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.UserHistory)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.LastRunTestSetup)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.LastRunTestSetup)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.LastRunTestSetup)]
|
||||
[DefaultValue("")]
|
||||
[ReadOnly(true)]
|
||||
public string LastRunTestSetup { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.UserHistory)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.LastUsedSampleRate)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.LastUsedSampleRate)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.LastUsedSampleRate)]
|
||||
[DefaultValue(20000D)]
|
||||
[ReadOnly(true)]
|
||||
public double LastUsedSampleRate { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.UserHistory)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.ApplySensorDataToBlankChannels)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.ApplySensorDataToBlankChannels)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.ApplySensorDataToBlankChannels)]
|
||||
[DefaultValue(true)]
|
||||
[ReadOnly(true)]
|
||||
public bool ApplySensorDataToBlankChannels { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.UserHistory)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.ApplyHardwareAssignmentInHardwareDisco)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.ApplyHardwareAssignmentInHardwareDisco)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.ApplyHardwareAssignmentInHardwareDisco)]
|
||||
[DefaultValue(true)]
|
||||
[ReadOnly(true)]
|
||||
[Browsable(false)]
|
||||
public bool ApplyHardwareAssignmentInHardwareDisco { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.UserHistory)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.ShowOptionsWhenApplyingSensorToBlankChannel)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.ShowOptionsWhenApplyingSensorToBlankChannel)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.ShowOptionsWhenApplyingSensorToBlankChannel)]
|
||||
[DefaultValue(true)]
|
||||
[ReadOnly(true)]
|
||||
public bool ShowOptionsWhenApplyingSensorToBlankChannel { get; set; }
|
||||
|
||||
#endregion properties
|
||||
|
||||
#region Static Methods
|
||||
/// <summary>
|
||||
/// this function is designed to create any missing property settings if needed
|
||||
/// this might happen if the database table was just created for instance
|
||||
/// it will create defaults for all the settings in the db, and also settings for all users
|
||||
/// currently it's used by DataPRO.App
|
||||
/// </summary>
|
||||
public static void CreateAnyMissingUserHistory()
|
||||
{
|
||||
//get a list of all known properties
|
||||
var userHistory = new UserHistory();
|
||||
var properties = userHistory.GetType().GetProperties();
|
||||
var needToBeAdded = new Dictionary<int, PropertyInfo>();
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
var id = PropertyIdAttribute.GetPropertyId(property);
|
||||
needToBeAdded[id] = property;
|
||||
}
|
||||
//find if the property already exists in the db, if so, no need to add...
|
||||
using (var sql = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
sql.CommandText = "SELECT [PropertyId] from [DefaultProperties]";
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt32(row["PropertyId"]);
|
||||
if (needToBeAdded.ContainsKey(id))
|
||||
{
|
||||
needToBeAdded.Remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
sql.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
//if we have nothing to add, we are all done
|
||||
if (needToBeAdded.Values.Count <= 0) return;
|
||||
|
||||
//otherwise add the defaults
|
||||
using (var sql = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(DbOperations.BEGIN_STATEMENT);
|
||||
|
||||
using (var needToBeAddedEnumerator = needToBeAdded.GetEnumerator())
|
||||
{
|
||||
var iIndex = 0;
|
||||
while (needToBeAddedEnumerator.MoveNext())
|
||||
{
|
||||
var currentProperty = needToBeAddedEnumerator.Current.Value;
|
||||
sb.AppendFormat(
|
||||
"INSERT INTO [DefaultProperties] ([PropertyId],[PropertyName],[DefaultValue]) VALUES (@1_{0}, @2_{0}, @3_{0});",
|
||||
iIndex);
|
||||
DbOperations.CreateParam(sql, string.Format("@1_{0}", iIndex), SqlDbType.Int,
|
||||
PropertyIdAttribute.GetPropertyId(currentProperty));
|
||||
DbOperations.CreateParam(sql, string.Format("@2_{0}", iIndex), SqlDbType.NVarChar,
|
||||
PropertyIdAttribute.GetPropertyIdEnum(currentProperty).ToString());
|
||||
DbOperations.CreateParam(sql, string.Format("@3_{0}", iIndex), SqlDbType.NVarChar,
|
||||
TestSetupDefaults.GetDefaultValueAsString(currentProperty));
|
||||
iIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
sb.Append(DbOperations.COMMIT_STATEMENT);
|
||||
sql.CommandText = sb.ToString();
|
||||
DbOperations.Connection.ExecuteCommand(sql);
|
||||
}
|
||||
finally
|
||||
{
|
||||
sql.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
//finally add settings for any users we have currently
|
||||
TestSetupDefaults.CreateMissingUserSettingProperties(needToBeAdded.Values.ToArray());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region methods
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
741
DataPRO/Users/UserSettings/UserSettings.cs
Normal file
741
DataPRO/Users/UserSettings/UserSettings.cs
Normal file
@@ -0,0 +1,741 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using DTS.Storage;
|
||||
// ReSharper disable RedundantEmptyDefaultSwitchBranch
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Slice.Users.UserSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// user specific properties, stored in db
|
||||
///
|
||||
/// these are all the user specific settings we are storing in the db currently as generic settings
|
||||
/// we have a few user specific settings like last used hardware that are stored in other places, that maybe
|
||||
/// should be stored here as well
|
||||
///
|
||||
/// it's possible to retrieve all the settings at once (more efficient, only one db query), or retrieve settings individually
|
||||
/// one by one using the static accessors
|
||||
/// each setting has a default specified both in code and in the db.
|
||||
/// when retrieving a setting we fall back to the default if a user specific value is not found
|
||||
/// if the default setting in the db is not found, we can further fall back to the default specified in code
|
||||
///
|
||||
/// in the db we have a table that lists all the settings with their fall back default value
|
||||
/// we have a separate table that stores the user specific values for any of those settings, which may or may not match the fall
|
||||
/// back default value
|
||||
///
|
||||
/// the data should always be stored in invariant form in the db
|
||||
/// DisplayName, Description attributes translate so the properties can be displayed in a property grid
|
||||
/// </summary>
|
||||
public class UserSettings
|
||||
{
|
||||
|
||||
#region properties
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultUploadEnabled)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultUploadEnabled)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultUploadEnabled)]
|
||||
[DefaultValue(false)]
|
||||
public bool UploadDefault { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultTestSampleRate)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultTestSampleRate)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultTestSampleRate)]
|
||||
[DefaultValue(10000D)]
|
||||
public double DefaultSampleRate { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultPostTriggerSeconds)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultPostTriggerSeconds)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultPostTriggerSeconds)]
|
||||
[DefaultValue(1D)]
|
||||
public double DefaultPostTriggerSeconds { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultPreTriggerSeconds)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultPreTriggerSeconds)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultPreTriggerSeconds)]
|
||||
[DefaultValue(1D)]
|
||||
public double DefaultPreTriggerSeconds { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultTriggerCheckStep)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultTriggerCheckStep)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultTriggerCheckStep)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultTriggerCheckStep { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultRealtimeGraphCount)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultRealtimeGraphCount)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultRealtimeGraphCount)]
|
||||
[DefaultValue(6)]
|
||||
public int DefaultRealtimeGraphCount { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultROIStart)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultROIStart)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultROIStart)]
|
||||
[DefaultValue(-1D)]
|
||||
public double DefaultROIStart { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultROIEnd)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultROIEnd)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultROIEnd)]
|
||||
[DefaultValue(1D)]
|
||||
public double DefaultROIEnd { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultDownloadROI)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultDownloadROI)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultDownloadROI)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultDownloadROI { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultViewROI)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultViewROI)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultViewROI)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultViewROI { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultDownloadAll)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultDownloadAll)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultDownloadAll)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultDownloadAll { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultViewAll)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultViewAll)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultViewAll)]
|
||||
[DefaultValue(false)]
|
||||
public bool DefaultViewAll { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultRequireAllUnitsPassDiagnostics)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultRequireAllUnitsPassDiagnostics)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultRequireAllUnitsPassDiagnostics)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultRequireAllUnitsPassDiagnostics { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultRequireUserConfirmationOnErrors)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultRequireUserConfirmationOnErrors)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultRequireUserConfirmationOnErrors)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultRequireUserConfirmationOnErrors { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultAllowMissingSensors)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultAllowMissingSensors)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultAllowMissingSensors)]
|
||||
[DefaultValue(false)]
|
||||
public bool DefaultAllowMissingSensors { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultRunPostTestDiagnostics)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultRunPostTestDiagnostics)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultRunPostTestDiagnostics)]
|
||||
[DefaultValue(false)]
|
||||
public bool DefaultRunPostTestDiagnostics { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultArmCheckListStep)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultArmCheckListStep)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultArmCheckListStep)]
|
||||
[DefaultValue(false)]
|
||||
public bool DefaultArmCheckListStep { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultCheckListInputVoltageCheck)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListInputVoltageCheck)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListInputVoltageCheck)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultCheckListInputVoltageCheck { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultCheckListBatteryVoltageCheck)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListBatteryVoltageCheck)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListBatteryVoltageCheck)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultCheckListBatteryVoltageCheck { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultCheckListSquibResistanceCheck)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListSquibResistanceCheck)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListSquibResistanceCheck)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultCheckListSquibResistanceCheck { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultCheckListSensorIdCheck)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListSensorIdCheck)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListSensorIdCheck)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultCheckListSensorIdCheck { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultCheckListTriggerStartCheck)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListTriggerStartCheck)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListTriggerStartCheck)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultCheckListTriggerStartCheck { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultCheckListTiltSensorCheck)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListTiltSensorCheck)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListTiltSensorCheck)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultCheckListTiltSensorCheck { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultAllowSensorIdToBlankChannel)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultAllowSensorIdToBlankChannel)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultAllowSensorIdToBlankChannel)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultAllowSensorIdToBlankChannel { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultCheckListMustPass)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListMustPass)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultCheckListMustPass)]
|
||||
[DefaultValue(false)]
|
||||
public bool DefaultChecklistMustPass { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultViewRealtime)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultViewRealtime)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultViewRealtime)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultViewRealtime { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultExport)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultExport)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultExport)]
|
||||
[DefaultValue(false)]
|
||||
public bool DefaultExport { get; set; }
|
||||
|
||||
[DefaultValue(0)]
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.DefaultTestSettings)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultExportFormat)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultExportFormat)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultExportFormat)]
|
||||
public int DefaultExportFormat { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.RealtimeSettings)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.RealtimeChartWidthInSeconds)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.RealtimeChartWidthInSeconds)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.RealtimeChartWidthInSeconds)]
|
||||
[DefaultValue(2)]
|
||||
public double RealtimeChartWidthInSeconds { get; set; }
|
||||
|
||||
[DefaultValue(true)]
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.TestOptions)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultTreeModeDiagnostics)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultTreeModeDiagnostics)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultTreeModeDiagnostics)]
|
||||
public bool DefaultTreeModeDiagnostics { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.TestOptions)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.ArmChecklistRequiredIfTOM)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.ArmChecklistRequiredIfTOM)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.ArmChecklistRequiredIfTOM)]
|
||||
[DefaultValue(true)]
|
||||
public bool ArmChecklistRequiredIfTOM { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.TestOptions)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.DefaultSuppressMissingSensorsWarning)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.DefaultSuppressMissingSensorsWarning)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.DefaultSuppressMissingSensorsWarning)]
|
||||
[DefaultValue(true)]
|
||||
public bool DefaultSuppressMissingSensorsWarning { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.TestOptions)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.ArmTriggerDiagnosticsRunOnNextStep)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.ArmTriggerDiagnosticsRunOnNextStep)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.ArmTriggerDiagnosticsRunOnNextStep)]
|
||||
[DefaultValue(false)]
|
||||
public bool ArmTriggerDiagnosticsRunOnNextStep { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.UserHistory)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.UsersCurrentTestSetup)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.UsersCurrentTestSetup)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.UsersCurrentTestSetup)]
|
||||
[DefaultValue("")]
|
||||
[ReadOnly(true)]
|
||||
public string UsersCurrentTestSetup { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.UserHistory)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.LastRunTestSetup)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.LastRunTestSetup)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.LastRunTestSetup)]
|
||||
[DefaultValue("")]
|
||||
[ReadOnly(true)]
|
||||
public string LastRunTestSetup { get; set; }
|
||||
|
||||
[CategoryAttributeEx(PropertyEnums.PropertyCategories.UserHistory)]
|
||||
[PropertyId(PropertyEnums.PropertyIds.LastUsedSampleRate)]
|
||||
[DescriptionAttributeEx(PropertyEnums.PropertyIds.LastUsedSampleRate)]
|
||||
[DisplayAttributeEx(PropertyEnums.PropertyIds.LastUsedSampleRate)]
|
||||
[DefaultValue(20000D)]
|
||||
[ReadOnly(true)]
|
||||
public double LastUsedSampleRate { get; set; }
|
||||
|
||||
/*
|
||||
* Subcategory example
|
||||
*/
|
||||
|
||||
//[Category("Category1")]
|
||||
//public SubCategory1 Subcategory1 { get; set; }
|
||||
|
||||
//[Category("Category1")]
|
||||
//public SubCategory2 Subcategory2 { get; set; }
|
||||
|
||||
#endregion properties
|
||||
|
||||
#region Static Methods
|
||||
/// <summary>
|
||||
/// this function is designed to create any missing property settings if needed
|
||||
/// this might happen if the database table was just created for instance
|
||||
/// it will create defaults for all the settings in the db, and also settings for all users
|
||||
/// currently it's used by DataPRO.App
|
||||
/// </summary>
|
||||
public static void CreateAnyMissingUserSettingPropertyDefaults()
|
||||
{
|
||||
//get a list of all known properties
|
||||
var userSetting = new UserSettings();
|
||||
var properties = userSetting.GetType().GetProperties();
|
||||
var needToBeAdded = new Dictionary<int, PropertyInfo>();
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
var id = PropertyIdAttribute.GetPropertyId(property);
|
||||
needToBeAdded[id] = property;
|
||||
}
|
||||
//find if the property already exists in the db, if so, no need to add...
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
sql.CommandText = "SELECT [PropertyId] from [DefaultProperties]";
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt32(row["PropertyId"]);
|
||||
if (needToBeAdded.ContainsKey(id))
|
||||
{
|
||||
needToBeAdded.Remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//if we have nothing to add, we are all done
|
||||
if (needToBeAdded.Values.Count <= 0) return;
|
||||
|
||||
//otherwise add the defaults
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(DbOperations.BEGIN_STATEMENT);
|
||||
|
||||
var needToBeAddedEnumerator = needToBeAdded.GetEnumerator();
|
||||
int iIndex = 0;
|
||||
while (needToBeAddedEnumerator.MoveNext())
|
||||
{
|
||||
var currentProperty = needToBeAddedEnumerator.Current.Value;
|
||||
sb.AppendFormat("INSERT INTO [DefaultProperties] ([PropertyId],[PropertyName],[DefaultValue]) VALUES (@1_{0}, @2_{0}, @3_{0});", iIndex);
|
||||
DbOperations.CreateParam(sql, string.Format("@1_{0}", iIndex), SqlDbType.Int, PropertyIdAttribute.GetPropertyId(currentProperty));
|
||||
DbOperations.CreateParam(sql, string.Format("@2_{0}", iIndex), SqlDbType.NVarChar, PropertyIdAttribute.GetPropertyIdEnum(currentProperty).ToString());
|
||||
DbOperations.CreateParam(sql, string.Format("@3_{0}", iIndex), SqlDbType.NVarChar, GetDefaultValueAsString(currentProperty));
|
||||
iIndex++;
|
||||
}
|
||||
|
||||
sb.Append(DbOperations.COMMIT_STATEMENT);
|
||||
sql.CommandText = sb.ToString();
|
||||
DbOperations.Connection.ExecuteCommand(sql);
|
||||
}
|
||||
//finally add settings for any users we have currently
|
||||
CreateMissingUserSettingProperties(needToBeAdded.Values.ToArray());
|
||||
}
|
||||
/// <summary>
|
||||
/// creates missing user settings (for all users)
|
||||
/// </summary>
|
||||
/// <param name="needToBeAdded"></param>
|
||||
private static void CreateMissingUserSettingProperties(PropertyInfo[] needToBeAdded)
|
||||
{
|
||||
var userIds = new List<int>();
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
sql.CommandText = "SELECT ID FROM [DataPROUsers]";
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt32(row["ID"]);
|
||||
if (!userIds.Contains(id))
|
||||
{
|
||||
userIds.Add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var id in userIds)
|
||||
{
|
||||
CreateMissingUserSettingProperties(id, needToBeAdded);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this funtion creates a list of settings for a specific user
|
||||
/// this may happen with a new database, it's called by the
|
||||
/// CreateAnyMissingUserSettingPropertyDefaults function above
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="needToBeAdded"></param>
|
||||
internal static void CreateMissingUserSettingProperties(int id, PropertyInfo[] needToBeAdded)
|
||||
{
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
var index = 0;
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(DbOperations.BEGIN_STATEMENT);
|
||||
|
||||
foreach (var property in needToBeAdded)
|
||||
{
|
||||
sb.AppendFormat(
|
||||
"INSERT INTO [UserProperties] ([UserId],[PropertyId], [PropertyValue]) VALUES (@1_{0},@2_{0},@3_{0});",
|
||||
index);
|
||||
|
||||
DbOperations.CreateParam(sql, string.Format("@1_{0}", index), SqlDbType.Int, id);
|
||||
DbOperations.CreateParam(sql, string.Format("@2_{0}", index), SqlDbType.Int,
|
||||
PropertyIdAttribute.GetPropertyId(property));
|
||||
DbOperations.CreateParam(sql, string.Format("@3_{0}", index), SqlDbType.NVarChar,
|
||||
GetDefaultValueAsString(property));
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
sb.Append(DbOperations.COMMIT_STATEMENT);
|
||||
|
||||
sql.CommandText = sb.ToString();
|
||||
DbOperations.Connection.ExecuteCommand(sql);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get an invariant version of the value for db storage
|
||||
/// this is used when we create or insert a new default into the db
|
||||
/// </summary>
|
||||
/// <param name="property"></param>
|
||||
/// <returns></returns>
|
||||
private static string GetDefaultValueAsString(PropertyInfo property)
|
||||
{
|
||||
if (property == null) return "";
|
||||
var attr = (DefaultValueAttribute)property.GetCustomAttribute(typeof(DefaultValueAttribute));
|
||||
|
||||
if (attr.Value is double)
|
||||
{
|
||||
return ((double) attr.Value).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
if (attr.Value is float)
|
||||
{
|
||||
return ((float) attr.Value).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
return attr.Value.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// gets a collection of all settings for a given user
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public static UserSettings GetUserSettings(int userId)
|
||||
{
|
||||
var settings = new UserSettings();
|
||||
|
||||
var properties = settings.GetType().GetProperties();
|
||||
//first get all properties as filled out by code
|
||||
foreach (var property in properties)
|
||||
{
|
||||
var d = property.GetCustomAttribute<DefaultValueAttribute>();
|
||||
if (d != null)
|
||||
{
|
||||
property.SetValue(settings, d.Value);
|
||||
}
|
||||
}
|
||||
|
||||
//next make sure we get all the defaults from the db
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
sql.CommandText = "SELECT [PropertyId], [DefaultValue] from [DefaultProperties]";
|
||||
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt32(row["PropertyId"]);
|
||||
var dv = Convert.ToString(row["DefaultValue"]);
|
||||
settings.SetValue(id, dv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//finally get the user specific values
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
sql.CommandText = "SELECT [PropertyId], [PropertyValue] FROM [UserProperties] WHERE [UserId]=@1";
|
||||
DbOperations.CreateParam(sql, "@1", SqlDbType.Int, userId);
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var id = Convert.ToInt32(row["PropertyId"]);
|
||||
var value = Convert.ToString(row["PropertyValue"]);
|
||||
settings.SetValue(id, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
/// <summary>
|
||||
/// sets a specific user setting in the db
|
||||
/// function should handle the invariant nature of values
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="value"></param>
|
||||
public static void SetUserSetting(int userId, PropertyEnums.PropertyIds id, object value)
|
||||
{
|
||||
var sValue = value.ToString();
|
||||
if (value is double)
|
||||
{
|
||||
sValue = ((double)value).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
else if (value is float)
|
||||
{
|
||||
sValue = ((float)value).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
sql.CommandText = "UPDATE [UserProperties] SET [PropertyValue]=@1 WHERE [UserId]=@2 AND [PropertyId]=@3";
|
||||
DbOperations.CreateParam(sql, "@1", SqlDbType.NVarChar, sValue);
|
||||
DbOperations.CreateParam(sql, "@2", SqlDbType.Int, userId);
|
||||
DbOperations.CreateParam(sql, "@3", SqlDbType.Int, (int)id);
|
||||
DbOperations.Connection.ExecuteCommand(sql);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// gets a specific user setting as a bool
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="property"></param>
|
||||
/// <returns></returns>
|
||||
public static bool GetUserSettingValueBool(int userId, PropertyEnums.PropertyIds property)
|
||||
{
|
||||
return Convert.ToBoolean(GetUserSettingValue(userId, property));
|
||||
}
|
||||
/// <summary>
|
||||
/// gets a specific user setting as a double
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="property"></param>
|
||||
/// <returns></returns>
|
||||
public static double GetUserSettingValueDouble(int userId, PropertyEnums.PropertyIds property)
|
||||
{
|
||||
return Convert.ToDouble(GetUserSettingValue(userId, property), CultureInfo.InvariantCulture);
|
||||
}
|
||||
/// <summary>
|
||||
/// gets a specific user setting as an integer
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="property"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetUserSettingValueInt(int userId, PropertyEnums.PropertyIds property)
|
||||
{
|
||||
return Convert.ToInt32(GetUserSettingValue(userId, property), CultureInfo.InvariantCulture);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a specific user setting as a string
|
||||
/// </summary>
|
||||
/// <param name="userid"></param>
|
||||
/// <param name="property"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetUserSettingValueString(int userid, PropertyEnums.PropertyIds property)
|
||||
{
|
||||
return GetUserSettingValue(userid, property);
|
||||
}
|
||||
/// <summary>
|
||||
/// gets a user setting out of the db, this is an internal function used by all the public
|
||||
/// single setting accessors.
|
||||
/// setting is determined by user settings table, default values table
|
||||
/// </summary>
|
||||
/// <param name="userid"></param>
|
||||
/// <param name="property"></param>
|
||||
/// <returns></returns>
|
||||
private static string GetUserSettingValue(int userid, PropertyEnums.PropertyIds property)
|
||||
{
|
||||
//if the user has a specific value set for this property, just return it directly
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
sql.CommandText = "SELECT [PropertyValue] FROM [UserProperties] WHERE [UserId]=@1 AND [PropertyId]=@2";
|
||||
DbOperations.CreateParam(sql, "@1", SqlDbType.Int, userid);
|
||||
DbOperations.CreateParam(sql, "@2", SqlDbType.Int, (int)property);
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
return Convert.ToString(ds.Tables[0].Rows[0]["PropertyValue"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//if there exists a specific default value set for this property, return that
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
sql.CommandText = "SELECT [DefaultValue] FROM [DefaultProperties] WHERE [PropertyId] =@1";
|
||||
DbOperations.CreateParam(sql, "@1", SqlDbType.Int, (int)property);
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
return Convert.ToString(ds.Tables[0].Rows[0]["DefaultValue"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//we could return the default value in code here, but we don't expect to get here, so
|
||||
//we can treat this as an exception for now
|
||||
throw new NullReferenceException(property.ToString());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region methods
|
||||
/// <summary>
|
||||
/// sets a specific value given a property id
|
||||
/// this is used when deserializing values out of the db
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="dv"></param>
|
||||
protected void SetValue(int id, string dv)
|
||||
{
|
||||
var property = (PropertyEnums.PropertyIds)id;
|
||||
|
||||
switch (property)
|
||||
{
|
||||
case PropertyEnums.PropertyIds.ArmChecklistRequiredIfTOM: ArmChecklistRequiredIfTOM = Convert.ToBoolean(dv); break;
|
||||
case PropertyEnums.PropertyIds.ArmTriggerDiagnosticsRunOnNextStep: ArmTriggerDiagnosticsRunOnNextStep = Convert.ToBoolean(dv); break;
|
||||
case PropertyEnums.PropertyIds.DefaultAllowMissingSensors: DefaultAllowMissingSensors = Convert.ToBoolean(dv); break;
|
||||
case PropertyEnums.PropertyIds.DefaultAllowSensorIdToBlankChannel: DefaultAllowSensorIdToBlankChannel = Convert.ToBoolean(dv); break;
|
||||
case PropertyEnums.PropertyIds.DefaultArmCheckListStep: DefaultArmCheckListStep = Convert.ToBoolean(dv); break;
|
||||
case PropertyEnums.PropertyIds.DefaultCheckListBatteryVoltageCheck: DefaultCheckListBatteryVoltageCheck = Convert.ToBoolean(dv); break;
|
||||
case PropertyEnums.PropertyIds.DefaultUploadEnabled: UploadDefault = Convert.ToBoolean(dv); break;
|
||||
case PropertyEnums.PropertyIds.DefaultTestSampleRate: DefaultSampleRate = Convert.ToDouble(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultPostTriggerSeconds: DefaultPostTriggerSeconds = Convert.ToDouble(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultPreTriggerSeconds: DefaultPreTriggerSeconds = Convert.ToDouble(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultTriggerCheckStep: DefaultTriggerCheckStep = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultRealtimeGraphCount: DefaultRealtimeGraphCount = Convert.ToInt32(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultROIStart: DefaultROIStart = Convert.ToDouble(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultROIEnd: DefaultROIEnd = Convert.ToDouble(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultDownloadROI: DefaultDownloadROI = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultViewROI: DefaultViewROI = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultDownloadAll: DefaultDownloadAll = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultViewAll: DefaultViewAll = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultRequireAllUnitsPassDiagnostics: DefaultRequireAllUnitsPassDiagnostics = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultRequireUserConfirmationOnErrors: DefaultRequireUserConfirmationOnErrors = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultRunPostTestDiagnostics: DefaultRunPostTestDiagnostics = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultCheckListInputVoltageCheck: DefaultCheckListInputVoltageCheck = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultCheckListSquibResistanceCheck: DefaultCheckListSquibResistanceCheck = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultCheckListSensorIdCheck: DefaultCheckListSensorIdCheck = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultCheckListTriggerStartCheck: DefaultCheckListTriggerStartCheck = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultCheckListTiltSensorCheck: DefaultCheckListTiltSensorCheck = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultCheckListMustPass: DefaultChecklistMustPass = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultViewRealtime: DefaultViewRealtime = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultExport: DefaultExport = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultExportFormat: DefaultExportFormat = Convert.ToInt32(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.RealtimeChartWidthInSeconds: RealtimeChartWidthInSeconds = Convert.ToDouble(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultTreeModeDiagnostics: DefaultTreeModeDiagnostics = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.DefaultSuppressMissingSensorsWarning: DefaultSuppressMissingSensorsWarning = Convert.ToBoolean(dv, CultureInfo.InvariantCulture); break;
|
||||
case PropertyEnums.PropertyIds.UsersCurrentTestSetup: UsersCurrentTestSetup = dv; break;
|
||||
case PropertyEnums.PropertyIds.LastRunTestSetup: LastRunTestSetup = dv; break;
|
||||
case PropertyEnums.PropertyIds.LastUsedSampleRate: LastUsedSampleRate = Convert.ToDouble(dv, CultureInfo.InvariantCulture); break;
|
||||
default:
|
||||
break;//ignore unknown property, just just ignore it
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// resets all the settings for a user in the db, using the default settings in the db
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public void ResetUserSettings(int userId)
|
||||
{
|
||||
//you can do this with one command with SQL, ie like
|
||||
//http://stackoverflow.com/questions/224732/sql-update-from-one-table-to-another-based-on-a-id-match
|
||||
//but since we haven't ditched SQlite yet, lets include support for both by separating it into two statements
|
||||
var properties = new List<Tuple<int, string>>();
|
||||
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
sql.CommandText = "SELECT [PropertyId],[DefaultValue] from [DefaultProperties]";
|
||||
using (var ds = DbOperations.Connection.QueryDataSet(sql))
|
||||
{
|
||||
properties.AddRange(from DataRow row in ds.Tables[0].Rows let id = Convert.ToInt32(row["PropertyId"]) let value = Convert.ToString(row["DefaultValue"]) select new Tuple<int, string>(id, value));
|
||||
}
|
||||
}
|
||||
|
||||
using (var sql = DbOperations.GetCommand())
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(DbOperations.BEGIN_STATEMENT);
|
||||
|
||||
for (var i = 0; i < properties.Count; i ++)
|
||||
{
|
||||
sb.AppendFormat("UPDATE [UserProperties] SET [PropertyValue]=@1_{0} WHERE [PropertyId]=@2_{0} AND [UserId]=@3_{0};",i);
|
||||
|
||||
DbOperations.CreateParam(sql, string.Format("@1_{0}", i), SqlDbType.NVarChar, properties[i].Item2);
|
||||
DbOperations.CreateParam(sql, string.Format("@2_{0}", i), SqlDbType.Int, properties[i].Item1);
|
||||
DbOperations.CreateParam(sql, string.Format("@3_{0}",i), SqlDbType.Int, userId);
|
||||
}
|
||||
|
||||
sb.Append(DbOperations.COMMIT_STATEMENT);
|
||||
sql.CommandText = sb.ToString();
|
||||
DbOperations.Connection.ExecuteCommand(sql);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subcategory example
|
||||
/// http://stackoverflow.com/questions/9379353/category-hierarchy-in-winforms-propertygrid
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class SubCategory1
|
||||
{
|
||||
public String Property1 { get; set; }
|
||||
|
||||
public String Property2 { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class SubCategory2
|
||||
{
|
||||
public String Property3 { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user