tbf/Common/IParamsProvider.cs

76 lines
2.2 KiB
C#
Raw Permalink Normal View History

///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Common
{
public interface IParamsProvider
{
/// <summary>
/// Get XML Serializer
/// </summary>
XmlSerializer GetSerializer();
string ComponentName { get; }
/// <summary>
/// Number of parameters
/// </summary>
int ParamsCount();
/// <summary>
/// Returns a parameter name
/// </summary>
/// <param name="ix">Zero based index of the parameter</param>
string ParamName(int ix);
/// <summary>
/// Returns a list of possible values of one parameter (ComboBox when editing) or null (Textbox when editing).
/// </summary>
/// <param name="ix">Zero based index of the parameter</param>
ICollection<string> ParamValues(int ix);
/// <summary>
/// Returns a parameter value in the string form
/// </summary>
/// <param name="ix">Zero based index of the parameter</param>
string ToString(int ix);
/// <summary>
/// Initialize values of all parameters
/// </summary>
void InitializeAll();
/// <summary>
/// Validates the string representation of a parameter
/// </summary>
/// <param name="ix">Zero based index of the parameter</param>
/// <param name="strValue">String representation of the parameter</param>
/// <param name="message">Warning message in case the string is wrong or null</param>
/// <returns>true = string is OK, false = string is wrong (see 'message')</returns>
bool ValidateParam(int ix, string strValue, out string message);
/// <summary>
/// Update the parameter from a string
/// </summary>
/// <param name="ix">Zero based index of the parameter</param>
/// <param name="strValue">String representation of the parameter</param>
CfgUpdateFlags UpdateParam(int ix, string strValue);
/// <summary>
/// Updates DB entities for related parameters
/// </summary>
/// <returns>true when successful</returns>
bool UpdateEmbeddedDbEntity();
/// <summary>
/// Creates an object copy
/// </summary>
/// <returns></returns>
IParamsProvider Clone();
}
}