private void createResearchDesc_Click(object sender, RoutedEventArgs e)
        {
            if (_SelectedResearchData == null)
                return;

            npc_text t = DataProcessor.CreateNewNpcText();
            _SelectedResearchData.Description = t.ID;
            researchGrid.DataContext = _SelectedResearchData;
            _SelectedNpcText = t;
            _SelectedBroadcastText = DataProcessor.GetBroadCastText(t.BroadcastTextID0);
            Binding binding = new Binding();
            binding.Source = _SelectedBroadcastText;
            binding.Path = new PropertyPath("MaleText");
            descriptionText.SetBinding(TextBox.TextProperty, binding);
        }
        public void LoadGossipMenu(gossip_menu menu)
        {
            if (menu == null)
                return;

            _SelectedGossipMenu = menu;

            npc_text text = DataProcessor.GetNpcText(menu.text_id);
            _SelectedNpcText = text;
            if (text == null)
                return;

            Binding binding0 = new Binding();
            binding0.Source = _SelectedNpcText;
            binding0.Path = new PropertyPath("BroadcastTextID0");
            this.gossipText0Bct.SetBinding(TextBox.TextProperty, binding0);

            Binding binding1 = new Binding();
            binding1.Source = _SelectedNpcText;
            binding1.Path = new PropertyPath("BroadcastTextID1");
            this.gossipText1Bct.SetBinding(TextBox.TextProperty, binding1);

            Binding binding2 = new Binding();
            binding2.Source = _SelectedNpcText;
            binding2.Path = new PropertyPath("BroadcastTextID2");
            this.gossipText2Bct.SetBinding(TextBox.TextProperty, binding2);

            Binding binding3 = new Binding();
            binding3.Source = _SelectedNpcText;
            binding3.Path = new PropertyPath("BroadcastTextID3");
            this.gossipText3Bct.SetBinding(TextBox.TextProperty, binding3);

            Binding binding4 = new Binding();
            binding4.Source = _SelectedNpcText;
            binding4.Path = new PropertyPath("BroadcastTextID4");
            this.gossipText4Bct.SetBinding(TextBox.TextProperty, binding4);

            Binding binding5 = new Binding();
            binding5.Source = _SelectedNpcText;
            binding5.Path = new PropertyPath("BroadcastTextID5");
            this.gossipText5Bct.SetBinding(TextBox.TextProperty, binding5);

            Binding binding6 = new Binding();
            binding6.Source = _SelectedNpcText;
            binding6.Path = new PropertyPath("BroadcastTextID6");
            this.gossipText6Bct.SetBinding(TextBox.TextProperty, binding6);

            Binding binding7 = new Binding();
            binding7.Source = _SelectedNpcText;
            binding7.Path = new PropertyPath("BroadcastTextID7");
            this.gossipText7Bct.SetBinding(TextBox.TextProperty, binding7);

            Binding binding0c = new Binding();
            binding0c.Source = _SelectedNpcText;
            binding0c.Path = new PropertyPath("prop0");
            this.gossipText0Chance.SetBinding(TextBox.TextProperty, binding0c);

            Binding binding1c = new Binding();
            binding1c.Source = _SelectedNpcText;
            binding1c.Path = new PropertyPath("prop1");
            this.gossipText1Chance.SetBinding(TextBox.TextProperty, binding1c);

            Binding binding2c = new Binding();
            binding2c.Source = _SelectedNpcText;
            binding2c.Path = new PropertyPath("prop2");
            this.gossipText2Chance.SetBinding(TextBox.TextProperty, binding2c);

            Binding binding3c = new Binding();
            binding3c.Source = _SelectedNpcText;
            binding3c.Path = new PropertyPath("prop3");
            this.gossipText3Chance.SetBinding(TextBox.TextProperty, binding3c);

            Binding binding4c = new Binding();
            binding4c.Source = _SelectedNpcText;
            binding4c.Path = new PropertyPath("prop4");
            this.gossipText4Chance.SetBinding(TextBox.TextProperty, binding4c);

            Binding binding5c = new Binding();
            binding5c.Source = _SelectedNpcText;
            binding5c.Path = new PropertyPath("prop5");
            this.gossipText0Chance.SetBinding(TextBox.TextProperty, binding5c);

            Binding binding6c = new Binding();
            binding6c.Source = _SelectedNpcText;
            binding6c.Path = new PropertyPath("prop6");
            this.gossipText6Chance.SetBinding(TextBox.TextProperty, binding6c);

            Binding binding7c = new Binding();
            binding7c.Source = _SelectedNpcText;
            binding7c.Path = new PropertyPath("prop7");
            this.gossipText7Chance.SetBinding(TextBox.TextProperty, binding7c);

            _bct0 = text.BroadcastTextID0 == 0 ? null : DataProcessor.GetBroadCastText(text.BroadcastTextID0);
            bct0.DataContext = _bct0;
            _bct1 = text.BroadcastTextID1 == 0 ? null : DataProcessor.GetBroadCastText(text.BroadcastTextID1);
            bct1.DataContext = _bct1;
            _bct2 = text.BroadcastTextID2 == 0 ? null : DataProcessor.GetBroadCastText(text.BroadcastTextID2);
            bct2.DataContext = _bct2;
            _bct3 = text.BroadcastTextID3 == 0 ? null : DataProcessor.GetBroadCastText(text.BroadcastTextID3);
            bct3.DataContext = _bct3;
            _bct4 = text.BroadcastTextID4 == 0 ? null : DataProcessor.GetBroadCastText(text.BroadcastTextID4);
            bct4.DataContext = _bct4;
            _bct5 = text.BroadcastTextID5 == 0 ? null : DataProcessor.GetBroadCastText(text.BroadcastTextID5);
            bct5.DataContext = _bct5;
            _bct6 = text.BroadcastTextID6 == 0 ? null : DataProcessor.GetBroadCastText(text.BroadcastTextID6);
            bct6.DataContext = _bct6;
            _bct7 = text.BroadcastTextID7 == 0 ? null : DataProcessor.GetBroadCastText(text.BroadcastTextID7);
            bct7.DataContext = _bct7;

            LoadGossipMenuItems(menu.entry);
        }
        private void researchList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            capital_city_research_data data = researchList.SelectedItem as capital_city_research_data;
            if (data == null) // set filter changed
                return;
            _SelectedResearchData = data;
            researchGrid.DataContext = data;
            if (data.Description != 0)
            {
                npc_text t = DataProcessor.GetNpcText(data.Description);
                _SelectedNpcText = t;
                if (t != null)
                {
                    broadcast_text b = DataProcessor.GetBroadCastText(t.BroadcastTextID0);
                    _SelectedBroadcastText = b;
                    if (b != null)
                    {
                        Binding binding = new Binding();
                        binding.Source = b;
                        binding.Path = new PropertyPath("MaleText");
                        descriptionText.SetBinding(TextBox.TextProperty, binding);
                    }
                }
            }
            else
            {
                _SelectedNpcText = null;
                _SelectedBroadcastText = null;
                descriptionText.Text = "";
            }

            if (data.Spell != 0)
            {
                capital_city_research_trainer_data t = DataProcessor.GetResearchSpell(data.Spell);
                _SelectedResearchSpell = t;
            }
            else
                _SelectedResearchSpell = null;

            if (data.Item != 0)
            {
                capital_city_research_vendor_data t = DataProcessor.GetResearchItem(data.Item);
                _SelectedResearchItem = t;
            }
            else
                _SelectedResearchItem = null;

            researchSpellGrid.DataContext = _SelectedResearchSpell;
            researchItemGrid.DataContext = _SelectedResearchItem;

            _ResearchQuest = DataProcessor.GetResearchQuests(_SelectedResearchData.QuestSet);
            researchQuestList.ItemsSource = _ResearchQuest;
        }