void ReleaseDesignerOutlets()
        {
            if (GeneratedPassword != null)
            {
                GeneratedPassword.Dispose();
                GeneratedPassword = null;
            }

            if (MasterKey != null)
            {
                MasterKey.Dispose();
                MasterKey = null;
            }

            if (SitesTable != null)
            {
                SitesTable.Dispose();
                SitesTable = null;
            }

            if (UserName != null)
            {
                UserName.Dispose();
                UserName = null;
            }
        }
        public void NewDocument()
        {
            FileNameOK = false;
            Config.Clear();

            // Reset display
            SitesTable.ReloadData();
            UserName.StringValue  = Config.UserName;
            MasterKey.StringValue = "";
        }
        // Helper
        void LoadSettings()
        {
            if (null == UserName)
            {
                return;
            }

            // Load file
            FileNameOK = NSUserDefaults.StandardUserDefaults.BoolForKey("LastFileNameOK");
            if (FileNameOK)
            {
                FileName = NSUserDefaults.StandardUserDefaults.StringForKey("LastFileName");

                try
                {
                    using (var s = File.OpenRead(FileName))
                    {
                        Config.Load(s);
                    }
                }
                catch (Exception ex)
                {
                    var alert = new NSAlert
                    {
                        MessageText = "Failed to open file " + ex.Message
                    };
                    alert.AddButton("OK");
                    alert.RunModal();

                    Config.Clear();
                    FileNameOK = false;
                }

                SitesTable.ReloadData();
                UserName.StringValue = Config.UserName;
            }
        }