private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            PacketStructureManager.loadStructure(comboBox.SelectedItem);
            PacketStructure ps = PacketStructureManager.getStructure(comboBox.SelectedItem);

            textBox.Text = ps.script;
        }
        private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            PacketStructure ps = new PacketStructure(false);

            ps.script = textBox.Text;
            PacketStructureManager.saveStructure(comboBox.SelectedItem, ps);
            MessageBox.Show("Сохранено");
        }
        private void buttonLoad_Click(object sender, RoutedEventArgs e)
        {
            PacketStructureManager.loadStructure(comboBox.SelectedItem);
            PacketStructure ps = PacketStructureManager.getStructure(comboBox.SelectedItem);

            textBox.Text = ps.script;
            MessageBox.Show("Загруженно");
        }
Example #4
0
        private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dataGrid.SelectedItem != null)
            {
                DataPacket      p  = (dataGrid.SelectedItem as DataPacket);
                PacketStructure ps = PacketStructureManager.getStructure(p.opCode);
                textBlockPacket.Text = ps.parse(p.getTeraPacket()).ToString();
            }
            //textBlockPacket.Text = Detrav.Sniffer.Tera.TeraPacketCreator.create((dataGrid.SelectedItem as DataPacket).getTeraPacket()).ToString();

            /*richTextBox.Document.Blocks.Clear();
             * richTextBox.Selection.Text = Detrav.Sniffer.Tera.TeraPacketCreator.create((dataGrid.SelectedItem as DataPacket).getTeraPacket()).ToString();*/
        }
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var result = MessageBox.Show("Хотите сохранить изменения в текущем пакете?", "Закрытие", MessageBoxButton.YesNoCancel);

            switch (result)
            {
            case MessageBoxResult.Yes:
                PacketStructure ps = new PacketStructure(false);
                ps.script = textBox.Text;
                PacketStructureManager.saveStructure(comboBox.SelectedItem, ps);
                break;

            case MessageBoxResult.No: break;

            default: e.Cancel = true; break;
            }
        }