private void RefreshModel()
        {
            var currentPos = Model.CurrentPosition;
            var model      = new MixedCodeDataModel(program);

            model.MoveToLine(currentPos, 0);
            currentPos   = Model.CurrentPosition;
            this.addrTop = MixedCodeDataModel.PositionAddress(currentPos);
            this.Model   = model;
        }
        public Address GetAnchorAddress()
        {
            var pt             = GetAnchorMiddlePoint();
            var memoryTextSpan = GetTagFromPoint(pt) as MixedCodeDataModel.MemoryTextSpan;

            if (memoryTextSpan == null || memoryTextSpan.Address == null)
            {
                return(MixedCodeDataModel.PositionAddress(anchorPos.Line));
            }
            return(memoryTextSpan.Address);
        }
 protected override void OnScroll()
 {
     if (Model is MixedCodeDataModel)
     {
         var currentPos = Model.CurrentPosition;
         addrTop = MixedCodeDataModel.PositionAddress(currentPos);
     }
     else
     {
         addrTop = null;
     }
     base.OnScroll();
 }
 private void OnProgramChanged()
 {
     try
     {
         if (program != null)
         {
             Model = new MixedCodeDataModel(program);
             var currentPos = Model.CurrentPosition;
             addrTop = MixedCodeDataModel.PositionAddress(currentPos);
             return;
         }
     }
     catch (Exception ex)
     {
         Services.RequireService <IDiagnosticsService>().Error(ex, "An error occurred while displaying the program.");
     }
     Model   = new EmptyEditorModel();
     addrTop = null;
 }