Пример #1
0
        public HexDataContext(Stream stream)
        {
            _vm.Stream = stream;
            StackGrid.AddChild(
                UIObjectProviderFactory.CreateNew(ViewProvider.CreateView(Contracts.Hex.Constants.HexView, _vm)),
                GridChildLength.Auto
                );

            _vm.FocusPositionChanged += delegate {
                FocusPositionChanged?.Invoke(this, EventArgs.Empty);
            };

            _vm.SelectionStateChanged += delegate {
                SelectionStateChanged?.Invoke(this, EventArgs.Empty);
            };

            _vm.FocusPositionChanged += delegate {
                //LostFocus?.Invoke(this, EventArgs.Empty);
            };

            _vm.SelectedToolTipItemModelChanged += delegate {
                SelectedToolTipItemChanged?.Invoke(this, EventArgs.Empty);
            };

            _customBackgroundBlocksWrapper = new CollectionWrapper <
                IBrushBlock,
                WpfHexaEditor.Core.Interfaces.IBrushBlock
                >(p => new BrushBlockWrapper(p), _vm.CustomBackgroundBlocks);
        }
Пример #2
0
        /// <summary>
        /// Focuses on the values defined by SP and PC. It also jumps to that position
        /// </summary>
        private void SelectAndScrollValuesIntoView()
        {
            MemoryGrid.SelectedIndex = emulator.Chip8.Pc;
            MemoryGrid.ScrollIntoView(MemoryGrid.SelectedItem);

            StackGrid.SelectedIndex = emulator.Chip8.Sp;
            StackGrid.ScrollIntoView(StackGrid.SelectedIndex);

            //For the dissasembled code
            if (emulator.Debugger.Paused || emulator.Debugger.StepOver)
            {
                if (selectedInstruction != null)
                {
                    selectedInstruction.Background = Brushes.Transparent;
                }

                var pcValue = emulator.Chip8.Pc % 2 == 0 ? emulator.Chip8.Pc - 2 : emulator.Chip8.Pc - 1;
                if (dissasembledBlocks.TryGetValue(pcValue, out var instruction))
                {
                    //We do Pc-2 because on Pc will be the next instruction, not the one stopped at
                    selectedInstruction            = instruction;
                    selectedInstruction.Background = Brushes.Yellow;
                    selectedInstruction.BringIntoView();
                }
            }
        }
Пример #3
0
 void StackCountDataEditor_Ok(object sender, EventArgs e)
 {
     try
     {
         if (((StackPhysicalCountInfo)StackCountDataEditor.DataSource).StackId == Guid.Empty)
         {
             errorDisplayer.ShowErrorMessage("Stack is required");
         }
         else if (StackCountDataEditor.IsNew)
         {
             inventoryService.AddStackPhysicalCount(PhysicalCountInformation, ((StackPhysicalCountInfo)StackCountDataEditor.DataSource));
             StackGrid.DataBind();
             StackCountDataEditor.IsNew = false;
         }
         else
         {
             var editedStackCount = from stackCount in PhysicalCountInformation.Stacks
                                    where stackCount.Id == ((StackPhysicalCountInfo)StackCountDataEditor.DataSource).Id
                                    select stackCount;
             if (editedStackCount.Count() > 0)
             {
                 editedStackCount.ElementAt(0).Copy((StackPhysicalCountInfo)StackCountDataEditor.DataSource);
                 StackGrid.DataBind();
             }
         }
         mpeStackCountDataEditorExtender.Hide();
         btnCancel.Text = "  Cancel  ";
     }
     catch (Exception ex)
     {
         errorDisplayer.ShowErrorMessage(ex.Message);
     }
 }
        public FolderBrowserDataContext(IHaveFileCollection haveFileCollection)
        {
            FolderBrowserViewModel = new FolderBrowserViewModel(haveFileCollection);
            //var vm = FileExplorerDataContextFactory.CreateFolderBrowserDataContext(haveFileCollection);

            var folderBrowser         = ViewProvider.CreateView(Constants.FolderBrowserView, FolderBrowserViewModel);
            var folderBrowserUIObject = UIObjectProviderFactory.CreateNew(folderBrowser);

            StackGrid.AddChild(folderBrowserUIObject,
                               new GridChildLength(new System.Windows.GridLength(1, System.Windows.GridUnitType.Star)));
        }