Exemple #1
0
        private void InitQRInput()
        {
            TextBox qrInputTextBox = (TextBox)this.FindName("QRInput");
            Binding binding        = new Binding("CurrentUserQRIndex")
            {
                Mode                = BindingMode.TwoWay,
                Converter           = new ZeroBasedIndexToOneBasedIndex(),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
            };

            ActionViewBase.InitUserInputField(qrInputTextBox, binding, 1, 4, ViewModel.QRInputHandler);
        }
Exemple #2
0
        private void InitRoundInput()
        {
            TextBox roundInputTextBox = (TextBox)this.FindName("RoundInput");
            int     maxRound          = ViewModel.Settings.Rounds;
            Binding binding           = new Binding("CurrentUserRoundIndex")
            {
                Mode                = BindingMode.TwoWay,
                Converter           = new ZeroBasedIndexToOneBasedIndex(),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
            };

            ActionViewBase.InitUserInputField(roundInputTextBox, binding, 1, maxRound, ViewModel.RoundInputHandler);
        }
Exemple #3
0
        private void InitKeystreamBlockInput()
        {
            TextBox keystreamBlockInput = (TextBox)this.FindName("KeystreamBlockInput");
            int     maxKeystreamBlock   = ViewModel.ChaCha.TotalKeystreamBlocks;
            Binding binding             = new Binding("CurrentKeystreamBlockIndex")
            {
                Mode                = BindingMode.TwoWay,
                Converter           = new ZeroBasedIndexToOneBasedIndex(),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
            };

            ActionViewBase.InitUserInputField(keystreamBlockInput, binding, 1, maxKeystreamBlock, ViewModel.KeystreamBlockInputHandler);
        }
Exemple #4
0
        private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            ViewModel = (ChaChaHashViewModel)e.NewValue;
            if (ViewModel != null)
            {
                // On page enter, the real DOM and virtual DOM should be in sync.
                DomSync();

                ViewModel.PropertyChanged += new PropertyChangedEventHandler(OnViewModelPropertyChange);
                ActionViewBase.AddEventHandlers(ViewModel, Root);

                InitKeystreamBlockInput();
                InitRoundInput();
                InitQRInput();
            }
        }
        private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            StateMatrixInitViewModel ViewModel = (StateMatrixInitViewModel)e.NewValue;

            if (ViewModel != null)
            {
                ActionViewBase.AddEventHandlers(ViewModel, Root);

                this.ViewModel = ViewModel;

                // State parameter diffusion values
                InitDiffusionStateParameters();

                // State encoding diffusion values
                InitDiffusionStateEncoding();

                // State matrix diffusion values
                InitDiffusionStateMatrix();
            }
        }
Exemple #6
0
 public Diffusion()
 {
     InitializeComponent();
     ActionViewBase.LoadLocaleResources(this);
     this.DataContextChanged += OnDataContextChanged;
 }
Exemple #7
0
 public Overview()
 {
     InitializeComponent();
     ActionViewBase.LoadLocaleResources(this);
 }