Exemple #1
0
        public void InsertRegisterAbove(object parameter)
        {
            MainWindow           window = App.Current.MainWindow as MainWindow;
            NewRegisterInputVM   vm     = new NewRegisterInputVM();
            NewRegisterInput     input  = new NewRegisterInput(vm);
            ICustomContentDialog dialog = window.DialogManager.CreateCustomContentDialog(input, DialogMode.OkCancel);

            dialog.Ok = () =>
            {
                // to update bindings:
                input.normalize.Focus();
                if (!Validation.GetHasError(input.widthBox) &&
                    !Validation.GetHasError(input.statesGrid))
                {
                    int width = (int)vm.Width;
                    Dictionary <ulong, Complex> initStates = vm.GetInitStates();
                    if (width > 0 && initStates.Count > 0)
                    {
                        _model.InsertRegisterAbove(_registerIndex, width, initStates);
                    }
                }
            };
            dialog.Show();
        }