public override void FinishedLaunching(NSObject notification) { mainWindowController = new MainWindowController(); mainWindowController.Window.MakeKeyAndOrderFront(this); }
/// <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; }
/// <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); }
public override void FinishedLaunching(NSObject notification) { mainWindowController = new MainWindowController (); mainWindowController.Window.MakeKeyAndOrderFront (this); }