ParameterDic is a Dictionary<string, object>, it store state information for the current ScriptRunner run, accessing property in ParameterDic is same as using Dictionary.



To makes it easier to use ParameterDic contains a number of property defined, it's also possible to access it through accesser (e.g. dic"property"):
public class ParameterDic : Dictionary<string, object>
{
     public static ParameterDic FromParameterPair(params ParameterPair[] ppairs)
     public static ParameterDic FromNameValueCollection(NameValueCollection col, string[] paramToFetch)
     public void AddOrUpdate(string key, object value)
     public void LoadParameterDic(ParameterDic pd)
     public ParameterDic Clone()
     public bool IsHandled { get; set; }
     public object Parameter { get; set; }
     public CancellationToken CancellationToken { get; set; }
     public Exception Error { get; set; }
}


When using in UI, there's a few more frequently used property,, so UIParameterDic is created
public class UIParameterDic : ParameterDic
{
    public string EventName { get; set; }
    public RoutedEventArgs EventArgs { get; set; }
    public Object OriginalSource { get; set; }
    public Object Sender { get; set; }
    public IUIInput Input { get; set; }
}   

UIParameterDic can be accessed using ParameterDic.AsUIParameterDic() extension method.

Most ParameterDic are created using it's constructor (new ParameterDic()), but internally, some of the class uses IParameterDicConverter to reuse code: ParameterDicConverter static class defined a number of IParameterDicConverter.
public interface IParameterDicConverter
{
    ParameterDic Convert(object parameter, params object[] additionalParameters);
    object ConvertBack(ParameterDic pd, params object[] additionalParameters);
}

Last edited Mar 7, 2014 at 11:51 AM by lycj, version 2

Comments

No comments yet.