/// <summary>
        /// Activate the AppBar at the given location on the screen
        /// </summary>
        /// <param name="newLocat">Location of the AppBar</param>
        /// <returns>True if AppBar was successfully created</returns>
        public bool ActivateAppBar(ScreenEdge newLocat)
        {
            DeactivateAppBar();

            Func <IEdgeHandler> edgeHandlerFact;

            if (EdgeHandlerFactory.TryGetValue(newLocat, out edgeHandlerFact))
            {
                edgeHandler = edgeHandlerFact();
            }
            else
            {
                return(false);
            }

            var winBounds = Windows.GetRectangle(appbar.hWnd);

            AppBarDimension = edgeHandler.GetCurrentDimension(winBounds);

            appbar = new AppBar(appbar.hWnd);
            if (!appbar.CreateNew())
            {
                return(false);
            }
            CheckDockSize(AppBarDimension);
            SizeToNewValues();

            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;

            AppBarIsActive = true;
            return(true);
        }
 void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
 {
     if (AppBarIsActive)
     {
         appbar.Remove();
         if (!appbar.CreateNew())
         {
             AppBarIsActive = false;
             return;
         }
         CheckDockSize(AppBarDimension);
         SizeToNewValues();
     }
 }