Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            IObservableText encryptedText = new ObservableText();
            IDecryptedText decryptedText = new DecryptedText(encryptedText);
            ITextHelper textChecker = new TextHelper();
            IXORKeyFinderFactory xorKeyFinderFactory = new XORKeyFinderFactory();
            ICaesarShiftDecrypter caesarShiftAlgorithm = new CaesarShiftDecrypter();
            IDecryptionSetupViewModel caesarShiftViemModel = new CaesarShiftSetupViewModel(caesarShiftAlgorithm, encryptedText);
            IXORDecrypter xorAlgorithm = new XORDecrypter(encryptedText, textChecker, xorKeyFinderFactory);
            IDecryptionSetupViewModel xorViewModel = new XORSetupViewModel(xorAlgorithm, encryptedText);
            IDecrypter monoAlphaAlgorithm = new MonoAlphaDecrypter();
            IDecryptionSetupViewModel monoAlphaViewModel = new MonoAlphaSetupViewModel(monoAlphaAlgorithm, encryptedText);

            DataContext = new DecrypterViewModel(
                encryptedText,
                decryptedText,
                Tuple.Create<IDecrypter, IDecryptionSetupViewModel>(caesarShiftAlgorithm, caesarShiftViemModel),
                Tuple.Create<IDecrypter, IDecryptionSetupViewModel>(xorAlgorithm, xorViewModel),
                Tuple.Create<IDecrypter, IDecryptionSetupViewModel>(monoAlphaAlgorithm, monoAlphaViewModel));
        }
 public void Initialize()
 {
     target = new ObservableText();
 }