edit utilities
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="AddPersonButton.xaml.cs" company="BTU/IIT">
|
||||
// <copyright file="AddPersonButton.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
@@ -18,26 +18,26 @@ namespace CampusAppWP8.Utility.Lui.Button
|
||||
/// <remarks>Stubbfel, 12.09.2013.</remarks>
|
||||
public class AddPersonButton : System.Windows.Controls.Button
|
||||
{
|
||||
/// <summary>The icon.</summary>
|
||||
private static BitmapImage icon = new BitmapImage(new Uri(Icons.AddContact, UriKind.Relative));
|
||||
|
||||
/// <summary>Initializes a new instance of the AddPersonButton class.</summary>
|
||||
/// <remarks>Stubbfel, 12.09.2013.</remarks>
|
||||
public AddPersonButton()
|
||||
: base()
|
||||
{
|
||||
this.Content = new Image
|
||||
{
|
||||
Source = icon
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>The person identifier property.</summary>
|
||||
public static readonly DependencyProperty PersonIdProperty = DependencyProperty.Register("PersonID", typeof(object), typeof(AddPersonButton), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>The function index property.</summary>
|
||||
public static readonly DependencyProperty FunctionIndexProperty = DependencyProperty.Register("FunctionIndex", typeof(object), typeof(AddPersonButton), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>The icon.</summary>
|
||||
private static BitmapImage icon = new BitmapImage(new Uri(Icons.AddContact, UriKind.Relative));
|
||||
|
||||
/// <summary>Initializes a new instance of the AddPersonButton class.</summary>
|
||||
/// <remarks>Stubbfel, 12.09.2013.</remarks>
|
||||
public AddPersonButton()
|
||||
: base()
|
||||
{
|
||||
this.Content = new Image
|
||||
{
|
||||
Source = icon
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the identifier of the person.</summary>
|
||||
/// <value>The identifier of the person.</value>
|
||||
public object PersonId
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace CampusAppWP8.Utility.Lui.MessageBoxes
|
||||
/// <summary>Shows the main model information message box.</summary>
|
||||
/// <remarks>Stubbfel, 10.09.2013.</remarks>
|
||||
/// <param name="text">custom text for the box.</param>
|
||||
/// <returns>.</returns>
|
||||
/// <returns>result of the UserInteraction</returns>
|
||||
public static MessageBoxResult ShowMainModelInfoMessageBox(string text)
|
||||
{
|
||||
return MessageBox.Show(text, AppResources.MsgBox_InfoHeader, MessageBoxButton.OK);
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using CampusAppWP8.Resources;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Class provides some special StringMethods
|
||||
@@ -23,6 +23,9 @@ namespace CampusAppWP8.Utility
|
||||
/// </summary>
|
||||
private static readonly string HtmlTagPattern = "<.*?>";
|
||||
|
||||
/// <summary>The mail valid regular expression.</summary>
|
||||
private static readonly string EMailValidRegex = @"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
@@ -33,7 +36,7 @@ namespace CampusAppWP8.Utility
|
||||
/// <param name="inputString">String with Html-Tags</param>
|
||||
/// <returns>String without Html-Tags</returns>
|
||||
public static string StripHTML(string inputString)
|
||||
{
|
||||
{
|
||||
string result = Regex.Replace(inputString, HtmlTagPattern, string.Empty);
|
||||
return System.Net.HttpUtility.HtmlDecode(result);
|
||||
}
|
||||
@@ -48,11 +51,10 @@ namespace CampusAppWP8.Utility
|
||||
return str.ToString() + "\n";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method remove(TrimEND!) an Newline to a string
|
||||
/// </summary>
|
||||
/// <param name="str">input string</param>
|
||||
/// <returns>input string - newline</returns
|
||||
/// <summary>Method remove(TrimEND!) an Newline to a string.</summary>
|
||||
/// <remarks>Stubbfel, 12.09.2013.</remarks>
|
||||
/// <param name="str">input string.</param>
|
||||
/// <returns>input string - newline.</returns>
|
||||
public static string RemoveNewLine(string str)
|
||||
{
|
||||
return str.TrimEnd('\n');
|
||||
@@ -67,10 +69,10 @@ namespace CampusAppWP8.Utility
|
||||
// Return true if strIn is in valid e-mail format.
|
||||
try
|
||||
{
|
||||
return Regex.IsMatch(strIn,
|
||||
@"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" +
|
||||
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$",
|
||||
RegexOptions.IgnoreCase);
|
||||
return Regex.IsMatch(
|
||||
strIn,
|
||||
StringManager.EMailValidRegex,
|
||||
RegexOptions.IgnoreCase);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -78,11 +80,11 @@ namespace CampusAppWP8.Utility
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates uni telefon number.</summary>
|
||||
/// <remarks>Stubbfel, 04.09.2013.</remarks>
|
||||
/// <param name="input">The input.</param>
|
||||
/// <returns>The new uni telefon number.</returns>
|
||||
public static string CreateUniTelefonNumber(string input)
|
||||
/// <summary>Creates uni telefon number.</summary>
|
||||
/// <remarks>Stubbfel, 04.09.2013.</remarks>
|
||||
/// <param name="input">The input.</param>
|
||||
/// <returns>The new uni telefon number.</returns>
|
||||
public static string CreateUniTelefonNumber(string input)
|
||||
{
|
||||
string result = null;
|
||||
if (input.Length < 5)
|
||||
@@ -95,7 +97,7 @@ namespace CampusAppWP8.Utility
|
||||
}
|
||||
|
||||
Regex regexObj = new Regex(@"[^\d]");
|
||||
result = regexObj.Replace(result.TrimStart('0'), "");
|
||||
result = regexObj.Replace(result.TrimStart('0'), string.Empty);
|
||||
result = Constants.DeTelPrefix + result;
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user