public void RemoveDashboardFloatMenu(bool forceHide = false)
 {
     if (floatMenu != null)
     {
         floatMenu.RemoveFromSuperview();
         floatMenu.Dispose();
         floatMenu = null;
     }
 }
        public DashboardMenuView AddDashboardFloatMenu()
        {
            UIWindow subWindow = UIApplication.SharedApplication.Windows[0];

            // floatMenu
            floatMenu                 = new DashboardMenuView();
            floatMenu.Frame           = new CGRect(subWindow.Frame.Width - floatMenu.Frame.Width, subWindow.Frame.Bottom, floatMenu.Frame.Width, floatMenu.Frame.Height);
            floatMenu.Layer.ZPosition = 100;
            subWindow.AddSubview(floatMenu);

            return(floatMenu);
        }
        public override void ViewWillDisappear(bool animated)
        {
            base.ViewWillDisappear(animated);

            if (floatMenu != null)
            {
                floatMenu.RemoveFromSuperview();
                floatMenu.Dispose();
                floatMenu = null;
            }

            UIDevice.CurrentDevice.EndGeneratingDeviceOrientationNotifications();
            if (rotationNotification != null)
            {
                NSNotificationCenter.DefaultCenter.RemoveObserver(this, new NSString("UIDeviceOrientationDidChangeNotification"), null);
            }
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            //for rotation
            UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications();
            rotationNotification = NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIDeviceOrientationDidChangeNotification"), DeviceOrientationDidChange);

            this.NavigationController.NavigationBar.SetBackgroundImage(UIImage.FromBundle("Assets/Backgrounds/navbar.png").CreateResizableImage(new UIEdgeInsets(0, 1, 0, 1)), UIBarMetrics.Default);
            this.NavigationController.InteractivePopGestureRecognizer.Enabled = false;

            BookUpdater.RegisterASIDelegate(this);

            if (isFirst)
            {
                InitializeControls();

                // Update new status
                UpdateBookStatus();
            }
            else
            {
                ExpandCollapseDashboard(false, false);
            }

            // floatMenu
            floatMenu                   = AppDelegate.Current.AddDashboardFloatMenu();
            floatMenu.SortEvent        += HandleSortEvent;
            floatMenu.CollapseEvent    += HandleCollapseEvent;
            floatMenu.ExpandEvent      += HandleExpandEvent;
            floatMenu.GoToFirstEvent   += HandleGoToFirstEvent;
            floatMenu.GoToCurrentEvent += HandleGoToCurrentEvent;

            // Reload data
            LoadData();

            isFirst = false;
        }