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); }
//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); }
/// <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); }