Responder Overview > Responder Customizations > Responder Reports > Input Controls |
Input controls may be used by reports and queries in Archive Explorer. These allow you to request information from the user and provide the user an interface in which to input data. You can use the existing input controls that reside in Miner.Data.Decoration, or you can create your own custom control by implementing Miner.Data.Decoration.IUserInput.
The following code sample demonstrates how to create an input control. This control takes an incident ID.
C# Sample |
Copy Code
|
---|---|
using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using Miner.Resource; using Miner.Data.Access; using Miner.Data.Decoration; using Miner.Responder.Shared; namespace Miner.Responder.ArchiveExplorer.Filters { public class IncidentIDInput : System.Windows.Forms.UserControl , IUserInput { #region Constructor public IncidentIDInput() { InitializeComponent(); textBox.MaxLength = 9; } #endregion #region IUserInput Implementation /// <summary> /// Initializes this user input control. /// </summary> /// <param name="dataSet"></param> public void Initialize(IDictionary properties) { if (properties != null) { if (properties.Contains(_IncidentID)) { textBox.Text = properties[_IncidentID].ToString(); } } } /// <summary> /// Gets the user inputs that were entered in this control. /// </summary> public IDictionary Properties { get { IDictionary properties = new Hashtable(); if (!SetIntegerProperty(textBox, properties, _IncidentID)) return null; return properties; } } /// <summary> /// Gets a description based on the user inputs. /// </summary> public string Description { get { StringBuilder builder = new StringBuilder(); if (textBox.Text != string.Empty) { builder.Append("Incident ID = "); builder.Append(textBox.Text); } return builder.ToString(); } } #endregion #region Private Instance Constants private const string _IncidentID = "IncidentID"; #endregion #region Private Instance Methods private bool SetIntegerProperty(Infragistics.Win.UltraWinEditors.UltraTextEditor textBox, IDictionary properties, string key) { bool result = true; if (textBox.Text == string.Empty) { properties[key] = textBox.Text; } else if (IsInteger(textBox.Text)) { properties[key] = Convert.ToInt32(textBox.Text); } else { Messaging.MsgUser(Miner.Responder.ArchiveExplorer.Properties.Resources.MsgInputNotValid); result = false; textBox.Clear(); } return result; } private bool IsInteger(string text) { foreach(char c in text) { if(!Char.IsNumber(c)) return false; } return true; } #endregion } } |