Class PreviewPluginBase
Base class for Preview provide plugins. This class contains some useful helper functions, and implements the Template Method pattern. Derived classes need to implement the InnerGetPreview(PreviewData) method, and can use the TryGetIntHint(string, out int) and similar methods to obtain values from the Preview hint.
Inheritance
Inherited Members
Namespace: SuperOffice.CRM.Previews
Assembly: SoDataBase.dll
Syntax
public abstract class PreviewPluginBase
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.Constructors
PreviewPluginBase()
Base class for Preview provide plugins. This class contains some useful helper functions, and implements the Template Method pattern. Derived classes need to implement the InnerGetPreview(PreviewData) method, and can use the TryGetIntHint(string, out int) and similar methods to obtain values from the Preview hint.
Declaration
protected PreviewPluginBase()
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.Fields
ImageHint
Base class for Preview provide plugins. This class contains some useful helper functions, and implements the Template Method pattern. Derived classes need to implement the InnerGetPreview(PreviewData) method, and can use the TryGetIntHint(string, out int) and similar methods to obtain values from the Preview hint.
Declaration
public const string ImageHint = "images"
Field Value
Type | Description |
---|---|
string |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.SimpleHint
Base class for Preview provide plugins. This class contains some useful helper functions, and implements the Template Method pattern. Derived classes need to implement the InnerGetPreview(PreviewData) method, and can use the TryGetIntHint(string, out int) and similar methods to obtain values from the Preview hint.
Declaration
public const string SimpleHint = "simple"
Field Value
Type | Description |
---|---|
string |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.UpdatedHint
Base class for Preview provide plugins. This class contains some useful helper functions, and implements the Template Method pattern. Derived classes need to implement the InnerGetPreview(PreviewData) method, and can use the TryGetIntHint(string, out int) and similar methods to obtain values from the Preview hint.
Declaration
public const string UpdatedHint = "updated"
Field Value
Type | Description |
---|---|
string |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.Properties
Hints
The raw hints dictionary
Declaration
protected Dictionary<string, List<string>> Hints { get; }
Property Value
Type | Description |
---|---|
Dictionary<string, List<string>> |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.Methods
FormatDescriptionText(string)
Remove blank lines from a string and make sure the length of the string does not exceed 256 characters. This method should be used to format the Text property of an entity like Appointment, Sale and Project, because the length of the text property is unlimited.
Declaration
protected static string FormatDescriptionText(string text)
Parameters
Type | Name | Description |
---|---|---|
string | text | String to process |
Returns
Type | Description |
---|---|
string | Result with no blank lines and maximum 256 characters long |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.GetPreview(Dictionary<string, List<string>>, PreviewData)
Implements the interface method; caches this hints and calls the inner method
Declaration
public PreviewData GetPreview(Dictionary<string, List<string>> hints, PreviewData previewData)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<string, List<string>> | hints | Preview hints |
PreviewData | previewData |
Returns
Type | Description |
---|---|
PreviewData | Preview text, or string.Empty |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.GetRawValues(string)
Get raw hint values, based on the hint name
Declaration
protected List<string> GetRawValues(string hintName)
Parameters
Type | Name | Description |
---|---|---|
string | hintName | Hint key to look for |
Returns
Type | Description |
---|---|
List<string> | List of raw values, or null if the hint did not exist |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.InnerGetPreview(PreviewData)
Subclass contract: derived class must implement their Preview logicin this method.
Declaration
protected abstract PreviewData InnerGetPreview(PreviewData previewData)
Parameters
Type | Name | Description |
---|---|---|
PreviewData | previewData |
Returns
Type | Description |
---|---|
PreviewData | Preview text, or an empty string |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
MakeImageHint(string, int)
Utility method for creating an image hint with the correct syntax, from a key and id combination. This method will automatically take into account the WantImages property of the current instance.
Declaration
protected string MakeImageHint(string key, int id)
Parameters
Type | Name | Description |
---|---|---|
string | key | Key name, for instance person_id. This key must be something that is recognized by the image streaming service. |
int | id | ID for the given key |
Returns
Type | Description |
---|---|
string | Image hint |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.RemoveBlankLines(string)
Remove blank lines from a string, and convert \r\n to just \n. If the remainder of the string after processing is just \n, an empty string will be returned as the final result; otherwise we just remove single or multiple blank lines.
Declaration
protected static string RemoveBlankLines(string text)
Parameters
Type | Name | Description |
---|---|---|
string | text | String to process |
Returns
Type | Description |
---|---|
string | Result with no blank lines |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.TryGetBoolHint(string, out bool)
Search the hints dictionary (this is an O(1) operation) for the given hint, and try to parse it as a bool. False is the result if the key is not found or has an invalid format. The return value is true if the hint is found and is parseable as a bool. Strings accepted are as for TryParse(string, out bool). If more than one hint of the same name exists, the value of the first one will be used.
Declaration
protected bool TryGetBoolHint(string hintName, out bool result)
Parameters
Type | Name | Description |
---|---|---|
string | hintName | Hint key to look for |
bool | result | Out: found value, or false |
Returns
Type | Description |
---|---|
bool | True if the hint is found and is valid |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.TryGetDateHint(string, out DateTime)
Search the hints dictionary (this is an O(1) operation) for the given hint, and try to parse it as a datetime. DateTime.MinValue is the result if the key is not found or has an invalid format. The return value is true iff the hint is found and is parseable as a datetime. Both the invariant and current cultures are used, in that order. If more than one hint of the same name exists, the value of the first one will be used.
Declaration
protected bool TryGetDateHint(string hintName, out DateTime result)
Parameters
Type | Name | Description |
---|---|---|
string | hintName | Hint key to look for |
DateTime | result | Out: found value, or false |
Returns
Type | Description |
---|---|
bool | True if the hint is found and is valid |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.TryGetIntHint(string, out int)
Search the hints dictionary (this is an O(1) operation) for the given hint, and try to parse it as an int. Zero is the result if the key is not found or has an invalid format. The return value is true iff the hint is found and is parseable as an int. Formats accepted are as for SuperOffice.Util.CultureDataFormatter.TryParse. If more than one hint of the same name exists, the value of the first one will be used.
Declaration
protected bool TryGetIntHint(string hintName, out int result)
Parameters
Type | Name | Description |
---|---|---|
string | hintName | Hint key to look for |
int | result | Out: found value, or 0 |
Returns
Type | Description |
---|---|
bool | True if the hint is found and is valid |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.TryGetStringHint(string, out string)
Search the hints dictionary (this is an O(1) operation) for the given hint. The return value is true iff the hint is found. If more than one hint of the same name exists, the value of the first one will be used.
Declaration
protected bool TryGetStringHint(string hintName, out string result)
Parameters
Type | Name | Description |
---|---|---|
string | hintName | Hint key to look for |
string | result | Out: found value, or null |
Returns
Type | Description |
---|---|
bool | True if the hint is found and is valid |
Remarks
The Preview hints are accessible through the Hints property, but clients should usually find the provided access methods sufficient. TryGetIntHint(string, out int), TryGetStringHint(string, out string) and TryGetBoolHint(string, out bool) look for and parse the given type of key, and return a bool value that specifies whether the given key was found.
WantImages and WantSimple are boolean properties that give the result of a search for 'images=true' and 'simple=true', to promote a common way of specifying these two properties. The class implements the IPreviewProviderPlugin and thereby also the IPlugin interfaces. Derived classes need to be marked with the PreviewProviderPluginAttribute attribute, specifying a provider name (please prefix with your company to help make it unique and recognizable), and optionally a priority. The attribute is also used to register hint keys; the derived class will be called only for requests matching at least one key.