public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            InitializeTable(_previewTable);

            this.WillClose += (object sender, EventArgs e) => 
            { 
                SaveSettings();
                NSApplication.SharedApplication.StopModal(); 
            };

            _buttonOK.Activated += (object sender, EventArgs e) => 
            {
                (WindowController as RemoveTextForHearingImpairedController).OkPressed(new Subtitle());
                Close();
            };  

            _buttonCancel.Activated += (object sender, EventArgs e) => 
            {
                Close();
            };  
            
            SetSettings();


            var l = Configuration.Settings.Language.RemoveTextFromHearImpaired;
            Title = l.Title;

            _removeBetweenSquare.Title = l.SquareBrackets;
            _removeBetweenSquare.Activated += GeneratePreview;

            _removeBetweenPara.Title = l.Parentheses;
            _removeBetweenPara.Activated += GeneratePreview;

            _removeBetweenCurly.Title = l.Brackets;
            _removeBetweenCurly.Activated += GeneratePreview;

            _removeBetweenQuest.Title = l.QuestionMarks;
            _removeBetweenQuest.Activated += GeneratePreview;

            _removeBetweenCust.Title = string.Empty;
            _removeBetweenCust.Activated += GeneratePreview;

            _removeBetweenOnlyIfOnSeperateLine.Title = l.OnlyIfInSeparateLine;
            _removeBetweenOnlyIfOnSeperateLine.Activated += GeneratePreview;

            _removeTextBeforeColon.Title = l.RemoveTextBeforeColon;
            _removeTextBeforeColon.Activated += GeneratePreview;

            _removeTextBeforeColonOnlyUppercase.Title = l.OnlyIfTextIsUppercase;
            _removeTextBeforeColonOnlyUppercase.Activated += GeneratePreview;

            _removeTextBeforeColonOnlySeperateLine.Title = l.OnlyIfInSeparateLine;
            _removeTextBeforeColonOnlySeperateLine.Activated += GeneratePreview;

            _removeLineIfUppercase.Title = l.RemoveTextIfAllUppercase;
            _removeLineIfUppercase.Activated += GeneratePreview;

            _removeLineIfContains.Title = l.RemoveTextIfContains;
            _removeLineIfContains.Activated += GeneratePreview;

            _removeInterjections.Title = l.RemoveInterjections;
            _removeInterjections.Activated += GeneratePreview;

            var list = new List<NSString>()
            {
                new NSString("¶"),
                new NSString("♪"),
                new NSString("♫")
            };
            _removeBetweenCustLeft.RemoveAll();
            _removeBetweenCustRight.RemoveAll();
            foreach (var ns in list)
            {
                _removeBetweenCustLeft.Add(ns);
                _removeBetweenCustRight.Add(ns);
            }
            _removeBetweenCustLeft.Select(list[0]);
            _removeBetweenCustRight.Select(list[0]);

            list = new List<NSString>()
            {
                new NSString("¶"),
                new NSString("♪"),
                new NSString("♫"),
                new NSString("♪, ♫")
            };
            _removeLineIfContainsText.RemoveAll();
            foreach (var ns in list)
            {
                _removeLineIfContainsText.Add(ns);
            }
            _removeLineIfContainsText.Select(list[0]);


            _editInterjections.Title = l.EditInterjections;
            _editInterjections.Activated += (object sender, EventArgs e) => 
            {
                using(var controller = new EditInterjectionsController())
                {
                    controller.Window.ReleasedWhenClosed = true;
                    NSApplication.SharedApplication.RunModalForWindow(controller.Window); // window's WillClose event stops modal
                    if (controller.WasOkPressed)
                    {
                            GeneratePreview(null, null);
                    }
                }       
            };

            _andForCustom.StringValue = l.And;


            GeneratePreview(null, null);
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            InitializeTable(_previewTable);

            this.WillClose += (object sender, EventArgs e) =>
            {
                SaveSettings();
                NSApplication.SharedApplication.StopModal();
            };

            _buttonOK.Activated += (object sender, EventArgs e) =>
            {
                (WindowController as RemoveTextForHearingImpairedController).OkPressed(new Subtitle());
                Close();
            };

            _buttonCancel.Activated += (object sender, EventArgs e) =>
            {
                Close();
            };

            SetSettings();


            var l = Configuration.Settings.Language.RemoveTextFromHearImpaired;

            Title = l.Title;

            _removeBetweenSquare.Title      = l.SquareBrackets;
            _removeBetweenSquare.Activated += GeneratePreview;

            _removeBetweenPara.Title      = l.Parentheses;
            _removeBetweenPara.Activated += GeneratePreview;

            _removeBetweenCurly.Title      = l.Brackets;
            _removeBetweenCurly.Activated += GeneratePreview;

            _removeBetweenQuest.Title      = l.QuestionMarks;
            _removeBetweenQuest.Activated += GeneratePreview;

            _removeBetweenCust.Title      = string.Empty;
            _removeBetweenCust.Activated += GeneratePreview;

            _removeBetweenOnlyIfOnSeperateLine.Title      = l.OnlyIfInSeparateLine;
            _removeBetweenOnlyIfOnSeperateLine.Activated += GeneratePreview;

            _removeTextBeforeColon.Title      = l.RemoveTextBeforeColon;
            _removeTextBeforeColon.Activated += GeneratePreview;

            _removeTextBeforeColonOnlyUppercase.Title      = l.OnlyIfTextIsUppercase;
            _removeTextBeforeColonOnlyUppercase.Activated += GeneratePreview;

            _removeTextBeforeColonOnlySeperateLine.Title      = l.OnlyIfInSeparateLine;
            _removeTextBeforeColonOnlySeperateLine.Activated += GeneratePreview;

            _removeLineIfUppercase.Title      = l.RemoveTextIfAllUppercase;
            _removeLineIfUppercase.Activated += GeneratePreview;

            _removeLineIfContains.Title      = l.RemoveTextIfContains;
            _removeLineIfContains.Activated += GeneratePreview;

            _removeInterjections.Title      = l.RemoveInterjections;
            _removeInterjections.Activated += GeneratePreview;

            var list = new List <NSString>()
            {
                new NSString("¶"),
                new NSString("♪"),
                new NSString("♫")
            };

            _removeBetweenCustLeft.RemoveAll();
            _removeBetweenCustRight.RemoveAll();
            foreach (var ns in list)
            {
                _removeBetweenCustLeft.Add(ns);
                _removeBetweenCustRight.Add(ns);
            }
            _removeBetweenCustLeft.Select(list[0]);
            _removeBetweenCustRight.Select(list[0]);

            list = new List <NSString>()
            {
                new NSString("¶"),
                new NSString("♪"),
                new NSString("♫"),
                new NSString("♪, ♫")
            };
            _removeLineIfContainsText.RemoveAll();
            foreach (var ns in list)
            {
                _removeLineIfContainsText.Add(ns);
            }
            _removeLineIfContainsText.Select(list[0]);


            _editInterjections.Title      = l.EditInterjections;
            _editInterjections.Activated += (object sender, EventArgs e) =>
            {
                using (var controller = new EditInterjectionsController())
                {
                    controller.Window.ReleasedWhenClosed = true;
                    NSApplication.SharedApplication.RunModalForWindow(controller.Window); // window's WillClose event stops modal
                    if (controller.WasOkPressed)
                    {
                        GeneratePreview(null, null);
                    }
                }
            };

            _andForCustom.StringValue = l.And;


            GeneratePreview(null, null);
        }