예제 #1
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;
        }
예제 #2
0
        // Action method binded in MainMenu.xib to "Preferences..." menu item.
        //App menu
        partial void ShowPreferencesWindow(NSObject sender)
        {
            var preferenceWindowController = new PreferenceWindowController();

            NSWindow window = preferenceWindowController.Window;

            NSApp.RunModalForWindow(window);
            window.OrderOut(null);
        }
        private void actionMenuItem()
        {
            NSApp.BeginSheet(simpleSheet, this.Window);
            NSApp.RunModalForWindow(simpleSheet);
            // sheet is up here.....

            // when StopModal is called will continue here ....
            NSApp.EndSheet(simpleSheet);
            simpleSheet.OrderOut(this);
        }
예제 #4
0
        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;
        }
        internal static void ShowSigninSheet()
        {
            NSApplication    NSApp      = NSApplication.SharedApplication;
            NSWindow         gameWindow = NSApp.MainWindow;
            SigninController controller = new SigninController();

            NSWindow window = controller.Window;

            NSApp.BeginInvokeOnMainThread(delegate {
                Guide.isVisible = true;
                NSApp.BeginSheet(window, gameWindow);
                NSApp.RunModalForWindow(window);
                // sheet is up here.....

                NSApp.EndSheet(window);
                window.OrderOut(gameWindow);
                Guide.isVisible = false;
            });
        }
예제 #6
0
        public string GetPassword(MainWindowController sender)
        {
            NSWindow window = this.Window;

            cancelled = false;


            NSApp.BeginSheet(window, sender.Window); //,null,null,IntPtr.Zero);
            NSApp.RunModalForWindow(window);
            // sheet is up here.....

            // when StopModal is called will continue here ....
            NSApp.EndSheet(window);
            window.OrderOut(this);



            var pwd = passwordTextField.StringValue;

            //password = NSMutableCharacterSet.FromString(editFields);

            return(pwd);
        }
예제 #7
0
        //strongly typed window accessor
        //public new TableEdit Window {
        //	get { return (TableEdit)base.Window; }
        //}

        public NSMutableDictionary edit(NSDictionary startingValues, TestWindowController sender)
        {
            NSWindow window = this.Window;

            cancelled = false;

            var editFields = editForm.Cells;

            if (startingValues != null)
            {
                savedFields = NSMutableDictionary.FromDictionary(startingValues);

                editFields[FIRST_NAME].StringValue = startingValues[TestWindowController.FIRST_NAME].ToString();
                editFields[LAST_NAME].StringValue  = startingValues[TestWindowController.LAST_NAME].ToString();
                editFields[PHONE].StringValue      = startingValues[TestWindowController.PHONE].ToString();
            }
            else
            {
                // we are adding a new entry,
                // make sure the form fields are empty due to the fact that this controller is recycled
                // each time the user opens the sheet -
                editFields[FIRST_NAME].StringValue = string.Empty;
                editFields[LAST_NAME].StringValue  = string.Empty;
                editFields[PHONE].StringValue      = string.Empty;
            }

            NSApp.BeginSheet(window, sender.Window);             //,null,null,IntPtr.Zero);
            NSApp.RunModalForWindow(window);
            // sheet is up here.....

            // when StopModal is called will continue here ....
            NSApp.EndSheet(window);
            window.OrderOut(this);

            return(savedFields);
        }
        internal static void ShowSigninSheet()
        {
            NSApplication NSApp      = NSApplication.SharedApplication;
            NSWindow      gameWindow = NSApp.MainWindow;

            SigninController controller = new SigninController();

            NSWindow window = controller.Window;

            // Something has happened with BeginSheet and needs to be looked into.
            // Until then just use modal for now.
            var frame    = window.Frame;
            var location = new PointF(gameWindow.Frame.Bottom, gameWindow.Frame.Left);

            location = new PointF(gameWindow.Frame.Location.X, gameWindow.Frame.Location.Y);

            window.SetFrameOrigin(location);
            NSApp.BeginInvokeOnMainThread(delegate {
                Guide.isVisible = true;
//				NSApp.BeginSheet (window, gameWindow);
                NSApp.RunModalForWindow(window);
//				// sheet is up here.....
//
//				NSApp.EndSheet (window);
                window.OrderOut(gameWindow);
                Guide.isVisible = false;
//
            });
            //window.MakeKeyAndOrderFront(gameWindow);
//				SignedInGamer sig = new SignedInGamer();
//				sig.DisplayName = "MonoMac Gamer";
//				sig.Gamertag = "MonoMac Gamer";
//				sig.InternalIdentifier = Guid.NewGuid();
//
//				Gamer.SignedInGamers.Add(sig);
        }
예제 #9
0
        /// <summary>
        /// Edit the specified source and sender.
        /// </summary>
        /// <param name='source'>
        /// Source.
        /// </param>
        /// <param name='sender'>
        /// Sender.
        /// </param>
        public EntryModel Edit(EntryModel entry, MainWindowController sender)
        {
            NSWindow window = this.Window;

            cancelled = false;

            //var editFields = editForm.Cells;

            if (entry != null)
            {
                originalEntry = entry.Entry.CloneDeep();

//            m_vStrings = source.Entry.Strings.CloneDeep();
//            m_vBinaries = source.Entry.Binaries.CloneDeep();
//            m_vHistory = source.Entry.History.CloneDeep();

                TitleTextField.StringValue    = entry.Title;
                UserNameTextField.StringValue = entry.UserName;

                PasswordSecureTextField.StringValue = PwDefs.HiddenPassword;
                PasswordClearTextField.StringValue  = entry.Password;

                UrlTextField.StringValue       = entry.Url;
                NotesTextField.StringValue     = entry.Notes;
                ExpireCheckBox.State           = entry.Expires ? NSCellStateValue.On : NSCellStateValue.Off;
                ExpireTimeDatePicker.DateValue = entry.ExpireDate;
            }
            else
            {
                entry       = new EntryModel();
                entry.Entry = new PwEntry(true, true);
                entry.IsNew = true;

                // we are adding a new entry,
                // make sure the form fields are empty due to the fact that this controller is recycled
                // each time the user opens the sheet -
                TitleTextField.StringValue          = string.Empty;
                UserNameTextField.StringValue       = string.Empty;
                PasswordSecureTextField.StringValue = string.Empty;
                PasswordClearTextField.StringValue  = string.Empty;
                UrlTextField.StringValue            = string.Empty;
                NotesTextField.StringValue          = string.Empty;
                ExpireCheckBox.State           = NSCellStateValue.Off;
                ExpireTimeDatePicker.DateValue = null;
            }

            NSApp.BeginSheet(window, sender.Window);
            NSApp.RunModalForWindow(window);
            // sheet is up here.....

            // when StopModal is called will continue here ....
            Console.WriteLine("Edit - exit from Edit");
            NSApp.EndSheet(window);
            window.OrderOut(this);


            //EntryModel saved = new EntryModel();
            entry.Title      = TitleTextField.StringValue;
            entry.UserName   = UserNameTextField.StringValue;
            entry.Password   = PasswordSecureTextField.StringValue;
            entry.Url        = UrlTextField.StringValue;
            entry.Notes      = NotesTextField.StringValue;
            entry.Expires    = ExpireCheckBox.State == NSCellStateValue.On;
            entry.ExpireDate = NSDateToDateTime(ExpireTimeDatePicker.DateValue);

            return(entry);
        }