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();
        }
        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"));
        }