/// <summary> /// Remove Blur Effects /// </summary> /// <param name="win">parent window</param> public static void ClearEffect(this System.Windows.Window win) { // Back changed effective objects win.Dispatcher.Invoke(new Action(delegate { win.Effect = effectBuffer; }), System.Windows.Threading.DispatcherPriority.Normal); win.Dispatcher.Invoke(new Action(delegate { win.OpacityMask = brushBuffer; }), System.Windows.Threading.DispatcherPriority.Normal); win.Dispatcher.Invoke(new Action(delegate { win.Focus(); }), System.Windows.Threading.DispatcherPriority.Normal); }
/// <summary> /// Remove Blur Effects /// </summary> /// <param name="win">parent window</param> public static void ClearEffect(this System.Windows.Window win) { // in windows 10, the dispatcher way doesn't seem to work anymore if (Environment.OSVersion.Version.Major >= 10) { win.Effect = null; win.OpacityMask = null; win.Focus(); } else { // Back changed effective objects win.Dispatcher.Invoke(new Action(delegate { win.Effect = effectBuffer; }), System.Windows.Threading.DispatcherPriority.Normal); win.Dispatcher.Invoke(new Action(delegate { win.OpacityMask = brushBuffer; }), System.Windows.Threading.DispatcherPriority.Normal); win.Dispatcher.Invoke(new Action(delegate { win.Focus(); }), System.Windows.Threading.DispatcherPriority.Normal); } }
public static System.Windows.Window createMainWindow(Type window, bool dialogBox = false) { System.Windows.Window temp = views.Find(name => name.GetType().Equals(window)); if (temp == null) { temp = (System.Windows.Window)Activator.CreateInstance(window); views.Add(temp); } temp.Closed += onClose; if (dialogBox) { temp.ShowDialog(); } else { temp.Show(); } temp.Focus(); return(temp); }