示例#1
0
 public void Setup()
 {
     mockRepo  = new MockRepository();
     model     = mockRepo.DynamicMock <ProcessorViewModel>(GetProcessorParser().Parse());
     outWindow = mockRepo.DynamicMock <IOutputWindow>();
     parser    = new AssemblerParser(model, outWindow);
 }
        public ProcessorViewModel GetCardRequestById(int RequestId)
        {
            var result = _appDbContext.CardIssuances.Where(c => c.Id == RequestId).FirstOrDefault();
            var cus    = _appDbContext.Customers.Where(c => c.Id == result.CustomerId).FirstOrDefault();

            if (result != null && result != null)
            {
                var cardReq = new ProcessorViewModel
                {
                    accountName     = result.NameOnCard,
                    AccountNumber   = cus.AccountNumber,
                    AccountTypeName = cus.AccountTypeName,
                    AccountType     = result.Customer.AccountType,
                    Gender          = cus.Gender,
                    Birthday        = cus.BirthDay,
                    CustomerAddress = cus.Address,
                    CustomerId      = cus.CustIdFinacle,
                    CustomerEmail   = cus.Email,
                    CustomerMobile  = cus.PhoneNumber,
                    NameOnCard      = result.NameOnCard,
                    Branch          = _appDbContext.Branches.Where(b => b.Id == result.BranchId).Select(b => b.BranchName).FirstOrDefault(),
                    PickUpBranch    = _appDbContext.Branches.Where(b => b.Id == result.PickUpBranchId).Select(b => b.BranchName).FirstOrDefault(),
                };

                return(cardReq);
            }
            return(null);
        }
示例#3
0
        /// <summary>
        /// The constructor of the assembler parser
        /// </summary>
        /// <param name="procVM">The Processor View Model for handling the simulator</param>
        /// <param name="window">The output window to write error or success messages</param>
        public AssemblerParser(ProcessorViewModel procVM, IOutputWindow window)
        {
            this.processorVM = procVM;
            output           = window;

            Reset();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="procVM">The Processor ViewModel</param>
        public RegistersWindow(ProcessorViewModel procVM)
        {
            InitializeComponent();

            this.procVM = procVM;

            DataContext = procVM;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="processorVM">THe Processor ViewModel</param>
        public RAMWindow(ProcessorViewModel processorVM)
        {
            InitializeComponent();

            procVM = processorVM;

            // Set the events in the ViewModel
            procVM.ramChangedEvent  += ReWrite;
            procVM.ipspChangedEvent += ReWrite;

            // Update the TextBox
            ReWrite();
        }
示例#6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="processorVM">The processor ViewModel</param>
        public ArchitectureWindow(ProcessorViewModel processorVM)
        {
            InitializeComponent();

            this.processorVM = processorVM;

            // Set the DataContext
            DataContext = processorVM;

            // Register the Events in the Processor ViewModel
            processorVM.mipChangedEvent += MIPChanged;
            processorVM.irChangedEvent  += IRChanged;
            processorVM.aluChangedEvent += AluChanged;
        }
示例#7
0
        async void OnCancelClicked()
        {
            _editing = false;

            if (_creating)
            {
                NavigationManager.ToBaseRelativePath("admin/processors");

                return;
            }

            _model = await Service.GetAsync(Id);

            SetCheckboxes();
            StateHasChanged();
        }
示例#8
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (_loaded)
            {
                return;
            }

            _loaded = true;

            _creating = NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
                        StartsWith("admin/processors/create", StringComparison.InvariantCulture);

            if (Id <= 0 &&
                !_creating)
            {
                return;
            }

            _companies = await CompaniesService.GetAsync();

            _instructionSets = await InstructionSetsService.GetAsync();

            _model = _creating ? new ProcessorViewModel() : await Service.GetAsync(Id);

            _instructionSetExtensions = await InstructionSetExtensionsService.GetAsync();

            _processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id);

            _authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

            _editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
                       StartsWith("admin/processors/edit/",
                                  StringComparison.InvariantCulture);

            if (_editing)
            {
                SetCheckboxes();
            }

            StateHasChanged();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="processorVM">The processor ViewModel</param>

        /// <param name="fileName">FileName of the File, to open the Window with</param>
        public AsmCodeWindow(ProcessorViewModel processorVM, string fileName)
        {
            InitializeComponent();

            this.processorVM = processorVM;

            // Set the IP- or SP-Changed Event
            this.processorVM.ipspChangedEvent += RefreshCurrentLine;

            // Set the SyntaxLexer
            SyntaxTextBox.SyntaxLexer = new AssemblerHighlightingParser(processorVM.proc.DecoderEntries);

            // Open the Startup File
            CurrentFileName = fileName;
            if (string.IsNullOrEmpty(CurrentFileName))
            {
                NewCommandHandler();
            }
            else
            {
                LoadASM();
            }
            RefreshCurrentLine();
        }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CopyRegistersCommand"/> class.
 /// </summary>
 /// <param name="vm">The register container.</param>
 public CopyRegistersCommand(ProcessorViewModel vm)
 {
     viewModel = vm;
 }
示例#11
0
        async void OnSaveClicked()
        {
            if (_unknownCompany)
            {
                _model.CompanyId = null;
            }
            else if (_model.CompanyId < 0)
            {
                return;
            }

            if (_unknownModelCode)
            {
                _model.ModelCode = null;
            }
            else if (string.IsNullOrWhiteSpace(_model.ModelCode))
            {
                return;
            }

            if (_unknownIntroduced)
            {
                _model.Introduced = null;
            }
            else if (_prototype)
            {
                _model.Introduced = new DateTime(1000, 1, 1);
            }
            else if (_model.Introduced >= DateTime.UtcNow.Date)
            {
                return;
            }

            if (_unknownInstructionSet)
            {
                _model.InstructionSetId = null;
            }
            else if (_model.InstructionSetId < 0)
            {
                return;
            }

            if (_unknownSpeed)
            {
                _model.Speed = null;
            }
            else if (_model.Speed < 0)
            {
                return;
            }

            if (_unknownPackage)
            {
                _model.Package = null;
            }
            else if (string.IsNullOrWhiteSpace(_model.Package))
            {
                return;
            }

            if (_unknownGprs)
            {
                _model.Gprs = null;
            }
            else if (_model.Gprs < 0)
            {
                return;
            }

            if (_unknownGprSize)
            {
                _model.GprSize = null;
            }
            else if (_model.GprSize < 0)
            {
                return;
            }

            if (_unknownFprs)
            {
                _model.Fprs = null;
            }
            else if (_model.Fprs < 0)
            {
                return;
            }

            if (_unknownFprSize)
            {
                _model.FprSize = null;
            }
            else if (_model.FprSize < 0)
            {
                return;
            }

            if (_unknownSimdRegisters)
            {
                _model.SimdRegisters = null;
            }
            else if (_model.SimdRegisters < 0)
            {
                return;
            }

            if (_unknownSimdSize)
            {
                _model.SimdSize = null;
            }
            else if (_model.SimdSize < 0)
            {
                return;
            }

            if (_unknownCores)
            {
                _model.Cores = null;
            }
            else if (_model.Cores < 1)
            {
                return;
            }

            if (_unknownThreadsPerCore)
            {
                _model.ThreadsPerCore = null;
            }
            else if (_model.ThreadsPerCore < 1)
            {
                return;
            }

            if (_unknownProcess)
            {
                _model.Process = null;
            }
            else if (string.IsNullOrWhiteSpace(_model.Process))
            {
                return;
            }

            if (_unknownProcessNm)
            {
                _model.ProcessNm = null;
            }
            else if (_model.ProcessNm < 1)
            {
                return;
            }

            if (_unknownDieSize)
            {
                _model.DieSize = null;
            }
            else if (_model.DieSize < 1)
            {
                return;
            }

            if (_unknownTransistors)
            {
                _model.Transistors = null;
            }
            else if (_model.Transistors < 0)
            {
                return;
            }

            if (_unknownDataBus)
            {
                _model.DataBus = null;
            }
            else if (_model.DataBus < 1)
            {
                return;
            }

            if (_unknownAddressBus)
            {
                _model.AddrBus = null;
            }
            else if (_model.AddrBus < 1)
            {
                return;
            }

            if (_unknownL1Instruction)
            {
                _model.L1Instruction = null;
            }
            else if (_model.L1Instruction < 0)
            {
                return;
            }

            if (_unknownL1Data)
            {
                _model.L1Data = null;
            }
            else if (_model.L1Data < 0)
            {
                return;
            }

            if (_unknownL2)
            {
                _model.L2 = null;
            }
            else if (_model.L2 < 0)
            {
                return;
            }

            if (_unknownL3)
            {
                _model.FprSize = null;
            }
            else if (_model.L3 < 0)
            {
                return;
            }

            if (_creating)
            {
                Id = await Service.CreateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
            }
            else
            {
                await Service.UpdateAsync(_model, (await UserManager.GetUserAsync(_authState.User)).Id);
            }

            _editing  = false;
            _creating = false;
            _model    = await Service.GetAsync(Id);

            SetCheckboxes();
            StateHasChanged();
        }
示例#12
0
 void ModalClosing(ModalClosingEventArgs obj) => _processor = null;
示例#13
0
 void ShowModal(int itemId)
 {
     _processor = _processors.FirstOrDefault(n => n.Id == itemId);
     _frmDelete.Show();
 }