示例#1
0
        /// <summary>
        /// Update view when item is clicked
        /// </summary>
        private void BlockItem_Click(object sender, EventArgs e)
        {
            if (_internalChange)
            {
                return;
            }
            if (sender is not BlockListItem blockitm)
            {
                return;
            }
            if (_differences is null)
            {
                return;
            }

            //Clear UI
            FileDiffBytesList.Items.Clear();

            _internalChange = true;
            FirstFile.SetPosition(blockitm.CustomBlock.StartOffset, 1);
            SecondFile.SetPosition(blockitm.CustomBlock.StartOffset, 1);
            _internalChange = false;

            //Load list of byte difference
            foreach (ByteDifference byteDifference in _differences
                     .Where(c => c.BytePositionInStream >= blockitm.CustomBlock.StartOffset &&
                            c.BytePositionInStream <= blockitm.CustomBlock.StopOffset))
            {
                byteDifference.Color = blockitm.CustomBlock.Color;
                FileDiffBytesList.Items.Add(new ByteDifferenceListItem(byteDifference));
            }
        }
        private void FirstFile_VerticalScrollBarChanged(object sender, ByteEventArgs e)
        {
            if (_internalChange)
            {
                return;
            }

            _internalChange = true;
            SecondFile.SetPosition(e.BytePositionInStream);
            _internalChange = false;
        }
        private void FileDiffBytesList_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (_internalChange)
            {
                return;
            }
            if (FileDiffBytesList.SelectedItem is not ByteDifferenceListItem byteDifferenceItem)
            {
                return;
            }

            _internalChange = true;
            FirstFile.SetPosition(byteDifferenceItem.ByteDiff.BytePositionInStream, 1);
            SecondFile.SetPosition(byteDifferenceItem.ByteDiff.BytePositionInStream, 1);
            _internalChange = false;
        }
        private void FileDiffBlockList_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (_internalChange)
            {
                return;
            }
            if (FileDiffBlockList.SelectedItem is not BlockListItem blockitm)
            {
                return;
            }

            _internalChange = true;
            FirstFile.SetPosition(blockitm.CustomBlock.StartOffset, 1);
            SecondFile.SetPosition(blockitm.CustomBlock.StartOffset, 1);
            _internalChange = false;

            LoadByteDifferenceList();
        }