using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows;
using System.Diagnostics.CodeAnalysis;
using System.Windows.Input;
using Com.Piwigo.Wpf.Command;
namespace Com.Piwigo.Wpf.Helper
{
public class AppHelper
{
private static bool? _isInDesignMode;
///
/// Gets a value indicating whether the control is in design mode (running in Blend
/// or Visual Studio).
///
public static bool IsInDesignModeStatic
{
get
{
if (!_isInDesignMode.HasValue)
{
var prop = DesignerProperties.IsInDesignModeProperty;
_isInDesignMode
= (bool)DependencyPropertyDescriptor
.FromProperty(prop, typeof(FrameworkElement))
.Metadata.DefaultValue;
}
return _isInDesignMode.Value;
}
}
///
/// Gets a value indicating whether the control is in design mode (running under Blend
/// or Visual Studio).
///
[SuppressMessage(
"Microsoft.Performance",
"CA1822:MarkMembersAsStatic",
Justification = "Non static member needed for data binding")]
public bool IsInDesignMode
{
get
{
return IsInDesignModeStatic;
}
}
static public void ExecuteCommand(object parameter) where T : AsyncCommand
{
AsyncCommand cmd = PwgCmdProvider.GetByType();
if (cmd.CanExecute(parameter))
{
cmd.Execute(parameter);
}
}
}
}