void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.Root = ((Frontend.OptionsWindow)(target));
     return;
     case 2:
     this.Status = ((System.Windows.Controls.Primitives.StatusBarItem)(target));
     return;
     case 3:
     this.AnyTopicCheckbox = ((System.Windows.Controls.CheckBox)(target));
     return;
     case 4:
     this.TopicList = ((System.Windows.Controls.ListView)(target));
     return;
     case 5:
     
     #line 95 "..\..\OptionsWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Invert_Click);
     
     #line default
     #line hidden
     return;
     case 6:
     
     #line 99 "..\..\OptionsWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.SelectAll_Click);
     
     #line default
     #line hidden
     return;
     case 7:
     
     #line 103 "..\..\OptionsWindow.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Delete_Click);
     
     #line default
     #line hidden
     return;
     case 8:
     this.AddTopic = ((System.Windows.Controls.TextBox)(target));
     
     #line 116 "..\..\OptionsWindow.xaml"
     this.AddTopic.GotKeyboardFocus += new System.Windows.Input.KeyboardFocusChangedEventHandler(this.AddTopic_GotKeyboardFocus);
     
     #line default
     #line hidden
     
     #line 116 "..\..\OptionsWindow.xaml"
     this.AddTopic.LostKeyboardFocus += new System.Windows.Input.KeyboardFocusChangedEventHandler(this.AddTopic_LostKeyboardFocus);
     
     #line default
     #line hidden
     return;
     case 9:
     this.AddButton = ((System.Windows.Controls.Button)(target));
     
     #line 118 "..\..\OptionsWindow.xaml"
     this.AddButton.Click += new System.Windows.RoutedEventHandler(this.Add_Click);
     
     #line default
     #line hidden
     return;
     case 10:
     this.OkButton = ((System.Windows.Controls.Button)(target));
     
     #line 130 "..\..\OptionsWindow.xaml"
     this.OkButton.Click += new System.Windows.RoutedEventHandler(this.Ok_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
        /// <summary>
        /// Click event for the options menu item.
        /// 
        /// Opens the options dialog box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Options_Click(object sender, RoutedEventArgs e)
        {
            // Updates the window's topics list with anything that may
            // have been downloaded since the start of the program, or since
            // the last time the dialog was opened.
            var newTopics = TopicChooser.Topics(order)
                .Except(from topic in topics
                        select topic.TopicName);
            topics.AddRange(from topic in newTopics
                            select new SelectableTopic(topic));

            // Create and initialize the options window
            var options = new OptionsWindow();
            options.MarkovOrder = order;
            options.SentenceLength = sentenceLength;
            options.AnyTopic = anyTopic;
            options.Topics = topics;

            // Wait for the user to change the options
            bool? result = options.ShowDialog();
            if (result.GetValueOrDefault(false) == false)
                return;

            // Update the chat window options
            order = options.MarkovOrder;
            sentenceLength = options.SentenceLength;
            anyTopic = options.AnyTopic;
            topics = options.Topics;

            // Update the markov chain
            await UpdateMarkovChainAsync();
        }