using System;
using System.Collections.Generic;
using System.Text;
namespace Be.Windows.Forms
{
static class Util
{
///
/// Contains true, if we are in design mode of Visual Studio
///
private static bool _designMode;
///
/// Initializes an instance of Util class
///
static Util()
{
// design mode is true if host process is: Visual Studio, Visual Studio Express Versions (C#, VB, C++) or SharpDevelop
var designerHosts = new List() { "devenv", "vcsexpress", "vbexpress", "vcexpress", "sharpdevelop" };
using (var process = System.Diagnostics.Process.GetCurrentProcess())
{
var processName = process.ProcessName.ToLower();
_designMode = designerHosts.Contains(processName);
}
}
///
/// Gets true, if we are in design mode of Visual Studio
///
///
/// In Visual Studio 2008 SP1 the designer is crashing sometimes on windows forms.
/// The DesignMode property of Control class is buggy and cannot be used, so use our own implementation instead.
///
public static bool DesignMode
{
get
{
return _designMode;
}
}
}
}