Ejemplo n.º 1
0
        private void EditEntry()
        {
            // setup the edit sheet controller if one hasn't been setup already
            if (editWindowController == null)
            {
                editWindowController = new EditWindowController();
            }

            EntriesDataSource ds       = (EntriesTableView.DataSource as EntriesDataSource);
            EntryModel        selected = ds.Items [EntriesTableView.SelectedRow];

            // get the current selected object and start the edit sheet
            EntryModel newValues = editWindowController.Edit(selected, this);

            Console.WriteLine("EditEntry - returned from editWindowController");
            Console.WriteLine("EditEntry - editWindowController.Cancelled = " + editWindowController.Cancelled.ToString(CultureInfo.InvariantCulture));

            if (!editWindowController.Cancelled)
            {
                // save updated data
                databaseCommands.SaveEntry(newValues, newValues.Entry);
                dbNeedsTobeSaved = true;

                //               // remove the current selection and replace it with the newly edited one
                //               var currentObjects = myTableArray.SelectedObjects;
                //               myTableArray.Remove(currentObjects);
                //
                //               // make sure to add the new entry at the same selection location as before
                //               myTableArray.Insert(newValues, savedSelectionIndex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Copies to clipboard selected item password.
        /// </summary>
        private void CopyToClipboardSelectedItemPassword()
        {
            EntriesDataSource ds       = (EntriesTableView.DataSource as EntriesDataSource);
            EntryModel        selected = ds.Items[EntriesTableView.SelectedRow];

            string passwordToCopy = selected.Password;

            NSPasteboard pasteBoard = NSPasteboard.GeneralPasteboard;

            pasteBoard.DeclareTypes(new string[] { NSPasteboard.NSStringType }, null);
            pasteBoard.SetStringForType(passwordToCopy, NSPasteboard.NSStringType);

            //Console.WriteLine("Pasted: " + pasteBoard.GetStringForType(NSPasteboard.NSStringType));
        }