CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets for: Athens Springer
C#
/// <summary>
/// State flag which indicates whether the grid is in edit
/// mode or not.
/// </summary>
public bool IsEditing { get; set; }
 
private void OnBeginEdit(object sender, DataGridBeginningEditEventArgs e)
{
  IsEditing = true;
  //in case we are in the middle of a drag/drop operation, cancel it...
by Athens Springer   June 29, 2011 @ 7:57am
114 Views
no comments
 
XML
<Popup
  x:Name="popup1"
  IsHitTestVisible="False"
  Placement="RelativePoint"
  PlacementTarget="{Binding ElementName=me}"
  AllowsTransparency="True">
  <Border
    BorderBrush="{DynamicResource CellBorderBrush}"
    BorderThickness="2"
    Background="White"
by Athens Springer   June 29, 2011 @ 7:56am
102 Views
no comments
 
XML
<Style.Triggers>
  <Trigger Property="IsEnabled" Value="false">
    <Setter Property="Background" Value="#EEEEEE" />
  </Trigger>
 
  <MultiTrigger>
    <MultiTrigger.Conditions>
      <Condition Property="HasItems" Value="false" />
      <Condition Property="Width" Value="Auto" />
    </MultiTrigger.Conditions>
by Athens Springer   June 28, 2011 @ 3:29pm
158 Views
no comments
 
C#
// DRAG
 
private void List_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    // Store the mouse position
    startPoint = e.GetPosition(null);
}
 
private void List_MouseMove(object sender, MouseEventArgs e)
{
by Athens Springer   June 28, 2011 @ 7:14am
Tags: WPF, Drag/Drop
276 Views
no comments
 
C#
public class DelegateCommand : ICommand
{
    private readonly Predicate<object> _canExecute;
    private readonly Action<object> _execute;
 
    public event EventHandler CanExecuteChanged;
 
    public DelegateCommand(Action<object> execute) 
                   : this(execute, null)
    {
by Athens Springer   June 28, 2011 @ 7:09am
Tags: C#, WPF, MVVM
152 Views
no comments
 
C#
private static readonly log4net.ILog _logger
            = log4net.LogManager.GetLogger(
                    System.Reflection.MethodBase.GetCurrentMethod()
                     .DeclaringType);
by Athens Springer   October 22, 2010 @ 8:03pm
183 Views
no comments
 
C#
public static decimal Accumulate(IEnumerable e)
{
   decimal sum = 0;
 
   foreach (Account a in e)
      sum += a.Balance;
 
   return sum;
}
by Athens Springer   October 15, 2010 @ 12:35pm
129 Views
no comments
 
C#
public int CryptoHash(string strValue)
{
    int hashCode = 0;
    if (strValue ! = null)
    {
        byte[ ] encodedUnHashedString = Encoding. Unicode. GetBytes(strValue) ;
        byte[ ] key = new byte[ 16] ;
        RandomNumberGenerator. Create( ). GetBytes(key);
        MACTripleDES hashingObj = new MACTripleDES(key) ;
        byte[ ] code = hashingObj. ComputeHash(encodedUnHashedString) ;
by Athens Springer   January 25, 2010 @ 7:17am
Tags: C#, Hash
159 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Text;
by Athens Springer   January 22, 2010 @ 8:33am
334 Views
no comments
 
C#
/// <summary>
/// Static class that provides services to serialize and deserialize an IDynamiteXml.
/// </summary>
public static class DynamiteXmlLogic
{
    /// <summary>
    /// Service to serialize an IDynamiteXml implementing object.
    /// Use the Deserialize method of this class to get the IDynamiteXml back.
    /// </summary>
    /// <param name="DynamiteXml">
by Athens Springer   December 17, 2009 @ 10:42pm
189 Views
no comments
 
C#
    public class Tail
    {
        public static Action<T> RecursiveAction<T>(Action<T> a)
        {
            var methodInfo = Recursive(a.Method);
 
            Action<T> action = p =>
            {
                var t = methodInfo.DeclaringType;
                t.InvokeMember(methodInfo.Name, BindingFlags.InvokeMethod, null, t, new object[] { p });
by Athens Springer   December 17, 2009 @ 10:40pm
Tags: Recursion
270 Views
no comments
 
C#
[XmlRoot("dictionary")]
public class XmlSerializableDictionary<TKey, TValue>
   : Dictionary<TKey, TValue>, IXmlSerializable {
 
   #region Constructors
   public XmlSerializableDictionary() : base() { }
 
   public XmlSerializableDictionary(IDictionary<TKey, TValue> dictionary) : base(dictionary) { }
 
   public XmlSerializableDictionary(IEqualityComparer<TKey> comparer) : base(comparer) { }
by Athens Springer   December 17, 2009 @ 10:34pm
319 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using LinqExtender.Configuration.Serialization;
 
namespace LinqExtender.Configuration
{
    /// <summary>
by Athens Springer   December 17, 2009 @ 10:14pm
185 Views
no comments
 
C#
using LinqExtender.Configuration.Serialization;
 
namespace LinqExtender.Configuration
{
    /// <summary>
    /// Fluent generic entry point for configuration settings.
    /// </summary>
    /// <typeparam name="T">query object</typeparam>
    public class Extender<T> : IClassSettings<T>
    {
by Athens Springer   December 17, 2009 @ 10:13pm
Tags: LINQ
161 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
using System.Linq;
using LinqExtender.Attributes;
using LinqExtender.Configuration.Serialization;
using LinqExtender.Interfaces;
 
namespace LinqExtender
by Athens Springer   December 17, 2009 @ 10:10pm
Tags: LINQ
528 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Collections;
using System.Reflection;
using LinqExtender.Collection;
using LinqExtender.Interfaces;
by Athens Springer   December 17, 2009 @ 10:09pm
Tags: LINQ
163 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using LinqExtender.Interfaces;
 
namespace LinqExtender
{
    /// <summary>
    /// Generates a new object from existing one using the user's setup.
by Athens Springer   December 17, 2009 @ 8:59pm
Tags: LINQ
345 Views
no comments
 
Data units of msec resolution = 0.000301 usec
10 typeof(string)                       : count: 10000    0.285 +- 0%    msec
10 typeof(string).TypeHandle            : count: 10000    0.030 +- 3%    msec
10 anObj.GetType() == type              : count: 10000    0.444 +- 6%    msec
10 Type.GetTypeHandle(obj).Equals(tHnd) : count: 10000    0.589 +- 1%    msec
10 anObj.GetType() == typeof(string)    : count: 10000    0.057 +- 2%    msec
10 (anObj is string)                    : count: 10000    0.113 +- 10%   msec
by Athens Springer   October 30, 2009 @ 9:14am
418 Views
no comments
 
C#
[ClassInterface(ClassInterfaceType.None), ComDefaultInterface(typeof(_ILGenerator)), ComVisible(true)]
public class ILGenerator : _ILGenerator
{
    // Fields
    internal const int DefaultExceptionArraySize = 8;
    internal const int DefaultFixupArraySize = 0x40;
    internal const int DefaultLabelArraySize = 0x10;
    internal const int defaultSize = 0x10;
    internal __ExceptionInfo[] m_currExcStack;
    internal int m_currExcStackCount;
by Athens Springer   October 29, 2009 @ 1:04pm
Tags:
271 Views
no comments
 
C#
[ClassInterface(ClassInterfaceType.None), ComDefaultInterface(typeof(_MethodRental)), ComVisible(true), HostProtection(SecurityAction.LinkDemand, MayLeakOnAbort=true)]
public sealed class MethodRental : _MethodRental
{
    // Fields
    public const int JitImmediate = 1;
    public const int JitOnDemand = 0;
 
    // Methods
    private MethodRental()
    {
by Athens Springer   October 29, 2009 @ 1:03pm
321 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate