private void FormatSourceFields(CitationFormat format)
        {
            DataSourceSourceFields.FieldInfo.Clear();
            foreach (var fieldInfo in format.Fields)
            {
                if (fieldInfo.Name.ToLower() != "title")
                {
                    DataSourceSourceFields.FieldInfo.Add(
                        new DataSourceOutlineViewSourceFieldsInfo(
                            fieldInfo
                            )
                        );
                }
            }

            OutlineViewSourceFields.ReloadData();
        }
        void ReleaseDesignerOutlets()
        {
            if (TableViewKeywords != null)
            {
                TableViewKeywords.Dispose();
                TableViewKeywords = null;
            }

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

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

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

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

            if (TextFieldTitle != null)
            {
                TextFieldTitle.Dispose();
                TextFieldTitle = null;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TextFieldTitle.EditingEnded += (sender, e) => _title = TextFieldTitle.StringValue;

            string[]   citationFormatsStr = GlobalResources.CitationFormatsFormatted;
            NSString[] citationValues     = new NSString[citationFormatsStr.Length];
            for (int i = 0; i < citationValues.Length; ++i)
            {
                citationValues[i] = new NSString(citationFormatsStr[i]);
            }

            foreach (var kwdGroup in GlobalResources.OpenLibrary.KeywordGroupsFormatted)
            {
                DataSourceKeywords.Keywords.Add(new Tuple <string, string>(kwdGroup, ""));
            }

            ComboBoxFormats.Add(citationValues);

            OutlineViewSourceFields.DataSource = DataSourceSourceFields;
            OutlineViewSourceFields.Delegate   = new DelegateOutlineViewSourceFields(DataSourceSourceFields);

            OutlineViewSourceFields.OnRowDelete += (sender, e) =>
            {
                var index = e.SelectedRow;
                foreach (var fieldGroup in DataSourceSourceFields.FieldInfo)
                {
                    if (!fieldGroup.IsExpandable)
                    {
                        --index;
                    }

                    else
                    {
                        foreach (var field in fieldGroup.Fields)
                        {
                            --index;
                            if (index == 0)
                            {
                                fieldGroup.Fields.Remove(field);
                                break;
                            }
                        }
                    }

                    if (index == 0)
                    {
                        break;
                    }
                }

                OutlineViewSourceFields.ReloadData();
            };

            TableViewKeywords.DataSource = DataSourceKeywords;
            TableViewKeywords.Delegate   = new DelegateTableViewKeywords(DataSourceKeywords);

            ComboBoxFormats.SelectItem(0);
            FormatSourceFields(GlobalResources.GetFormat("Print"));
        }