public void OpenInfoModal()
        {
            CGPoint orgPoint = Utility.GetModalPanelLocation();

            using (NSAutoreleasePool pool = new NSAutoreleasePool()) {
                using (var infoPanelController = new PublicationInfoPanelController(orgPoint)) {
                    infoPanelController.BookInfo = PublicationsDataManager.SharedInstance.CurrentPubliction;
                    infoPanelController.InitializeInfoView();

                    var infoPanel = infoPanelController.Window;
                    infoPanel.MakeFirstResponder(null);

                    NSApplication NSApp = NSApplication.SharedApplication;

                    infoPanel.WindowShouldClose += (t) => true;
                    infoPanel.WillClose         += delegate(object asender, EventArgs e) {
                        NSApp.StopModal();
                    };

                    NSApplication.SharedApplication.RunModalForWindow(infoPanel);
                    infoPanelController.Window.OrderOut(null);
                    infoPanelController.Dispose();

                    AddInfoUpdateState();
                }
            }
        }
Exemple #2
0
        private async void InfoButtonClick(NSObject sender)
        {
            isCanToContent = true;
            CGPoint orgPoint = Utility.GetModalPanelLocation(690.0f, LNRConstants.WindowHeight_MIN);              //658+22

            using (var infoPanelController = new PublicationInfoPanelController(orgPoint, this)) {
                infoController = infoPanelController;
                infoPanelController.BookInfo = BookInfo;
                infoPanelController.InitializeInfoView(UpdateStatus);
                var infoPanel = infoPanelController.Window;
                infoPanel.MakeFirstResponder(null);

                NSApplication NSApp = NSApplication.SharedApplication;

                infoPanel.WindowShouldClose += (t) => true;
                bool isOpenContentPanel = false;

                infoPanel.WillClose += delegate(object asender, EventArgs e) {
                    isOpenContentPanel = infoPanelController.IsOpenContentPanel;
                    UpdateStatus       = infoPanelController.UpdateStatus;
                    NSApp.StopModal();
                };

                NSApp.RunModalForWindow(infoPanel);
                infoPanelController.Window.OrderOut(null);

                RefreshUpdateStatus(UpdateStatus);

                if (isOpenContentPanel)
                {
                    await OpenContentPanel();
                }
            }
            infoController = null;
        }
        void InfoButtonClick(NSObject sender)
        {
            isCanToContent = true;
            isInInfoPanel  = true;
            CGPoint orgPoint = Utility.GetModalPanelLocation();

            using (var infoPanelController = new PublicationInfoPanelController(orgPoint, this)) {
                infoController = infoPanelController;
                //var infoPanelController = new PublicationInfoPanelController (orgPoint,this);
                infoPanelController.BookInfo = BookInfo;
                infoPanelController.InitializeInfoView();
                var infoPanel = infoPanelController.Window;
                infoPanel.MakeFirstResponder(null);

                NSApplication NSApp = NSApplication.SharedApplication;

                infoPanel.WindowShouldClose += (t) => true;
                bool isOpenContentPanel = false;
                int  updateStatus       = 0;
                infoPanel.WillClose += delegate(object asender, EventArgs e) {
                    isOpenContentPanel = infoPanelController.IsOpenContentPanel;
                    updateStatus       = infoPanelController.UpdateStatus;
                    NSApp.StopModal();
                };

                NSApp.RunModalForWindow(infoPanel);

                infoPanelController.Window.OrderOut(null);

                if (updateStatus == 1)
                {
                    UpdateDownloadProgress();
                }
                else if (updateStatus == 2)
                {
                    RefreshPublicationView();
                }

                if (isOpenContentPanel)
                {
                    OpenContentPanel();
                }
            }

            isInInfoPanel  = false;
            infoController = null;
        }