示例#1
0
        private void statisticsClick(object sender, RoutedEventArgs e)
        {
            Lab2Contoller contoller = new Lab2Contoller("");
            string        res       = string.Empty;

            foreach (var i in contoller.CountOccurancies(contentTextBox.Text))
            {
                res += i.Key + " : " + i.Value + "\n";
            }
            MessageBox.Show(res, "Frequencies");
        }
示例#2
0
        private void decodeClick(object sender, RoutedEventArgs e)
        {
            Lab2Contoller controller;
            string        choice = methodsList.Text;

            switch (choice)
            {
            case "Vizhener":
                InputFilename input = new InputFilename((bool)enRadioButton.IsChecked);
                input.ShowDialog();
                Key                 = input.KeyValueTextBox.Text;
                controller          = new Lab2Contoller(Key);
                contentTextBox.Text = controller.DecodeVizhener(contentTextBox.Text, (bool)enRadioButton.IsChecked);
                break;

            case "Linear":
                InputLinear input1 = new InputLinear();
                input1.ShowDialog();
                A                   = Convert.ToInt32(input1.coeffATextBox.Text);
                B                   = Convert.ToInt32(input1.coeffBTextBox.Text);
                controller          = new Lab2Contoller(A, B);
                contentTextBox.Text = controller.Decode(contentTextBox.Text, true, (bool)enRadioButton.IsChecked);
                break;

            case "NonLinear":
                InputNonLinear input2 = new InputNonLinear();
                input2.ShowDialog();
                A                   = Convert.ToInt32(input2.coeffATextBox.Text);
                B                   = Convert.ToInt32(input2.coeffBTextBox.Text);
                C                   = Convert.ToInt32(input2.coeffcTextBox.Text);
                controller          = new Lab2Contoller(A, B, C);
                contentTextBox.Text = controller.Decode(contentTextBox.Text, false, (bool)enRadioButton.IsChecked);
                break;

            case "Gamma":
                InputFilename input3 = new InputFilename((bool)enRadioButton.IsChecked);
                input3.ShowDialog();
                Key = input3.KeyValueTextBox.Text;
                Lab3Controler lab3Controler = new Lab3Controler(Key);
                contentTextBox.Text = lab3Controler.EncodeUnicode(contentTextBox.Text, (bool)enRadioButton.IsChecked);
                break;
            }
        }