Example #1
0
 public void OnFormulaRecalculate(Formula target)
 {
     Result = target.Evaluate();
     if (Recalculated != null)
     {
         Recalculated.Invoke(this, EventArgs.Empty);
     }
 }
Example #2
0
        public void Recalculate()
        {
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            IsStarted = true;

            DisposeQuickInfoSources();
            quickInfoSources = CreateQuickInfoSources();

            var           newContent       = new List <object>();
            ITrackingSpan applicableToSpan = null;

            foreach (var source in quickInfoSources)
            {
                ITrackingSpan applicableToSpanTmp;
                source.AugmentQuickInfoSession(this, newContent, out applicableToSpanTmp);
                if (IsDismissed)
                {
                    return;
                }
                if (applicableToSpan == null)
                {
                    applicableToSpan = applicableToSpanTmp;
                }
            }

            if (newContent.Count == 0 || applicableToSpan == null)
            {
                Dismiss();
            }
            else
            {
                QuickInfoContent.BeginBulkOperation();
                QuickInfoContent.Clear();
                QuickInfoContent.AddRange(newContent);
                QuickInfoContent.EndBulkOperation();

                HasInteractiveContent = CalculateHasInteractiveContent();
                ApplicableToSpan      = applicableToSpan;
                if (quickInfoPresenter == null)
                {
                    quickInfoPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this);
                    if (quickInfoPresenter == null)
                    {
                        Dismiss();
                        return;
                    }
                    PresenterChanged?.Invoke(this, EventArgs.Empty);
                }
            }
            Recalculated?.Invoke(this, EventArgs.Empty);
        }
        public void Recalculate()
        {
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            bool firstTime = !IsStarted;

            IsStarted = true;
            if (firstTime && trackCaret)
            {
                TextView.Caret.PositionChanged += Caret_PositionChanged;
            }

            DisposeSignatureHelpSources();
            signatureHelpSources = CreateSignatureHelpSources();

            var list = new List <ISignature>();

            foreach (var source in signatureHelpSources)
            {
                source.AugmentSignatureHelpSession(this, list);
                if (IsDismissed)
                {
                    return;
                }
            }
            signatures.Clear();
            foreach (var sig in list)
            {
                signatures.Add(sig);
            }

            if (signatures.Count == 0)
            {
                Dismiss();
            }
            else
            {
                SelectedSignature = signatures[0];
                if (signatureHelpPresenter == null)
                {
                    signatureHelpPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this);
                    if (signatureHelpPresenter == null)
                    {
                        Dismiss();
                        return;
                    }
                    PresenterChanged?.Invoke(this, EventArgs.Empty);
                }
            }
            Recalculated?.Invoke(this, EventArgs.Empty);
        }
Example #4
0
        public void Recalculate()
        {
            if (!IsStarted)
            {
                throw new InvalidOperationException();
            }
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }

            foreach (var collection in completionCollections)
            {
                collection.Recalculate();
            }
            Match();
            Recalculated?.Invoke(this, EventArgs.Empty);
        }
Example #5
0
        public void Recalculate()
        {
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            IsStarted = true;

            DisposeQuickInfoSources();
            quickInfoSources = CreateQuickInfoSources();

            QuickInfoContent.Clear();
            ITrackingSpan applicableToSpan = null;

            foreach (var source in quickInfoSources)
            {
                ITrackingSpan applicableToSpanTmp;
                source.AugmentQuickInfoSession(this, QuickInfoContent, out applicableToSpanTmp);
                if (applicableToSpan == null)
                {
                    applicableToSpan = applicableToSpanTmp;
                }
            }

            if (QuickInfoContent.Count == 0 || applicableToSpan == null)
            {
                Dismiss();
            }
            else
            {
                HasInteractiveContent = CalculateHasInteractiveContent();
                ApplicableToSpan      = applicableToSpan;
                if (quickInfoPresenter == null)
                {
                    quickInfoPresenter = quickInfoPresenterProvider.Create(this);
                    Debug.Assert(quickInfoPresenter != null);
                    PresenterChanged?.Invoke(this, EventArgs.Empty);
                }
            }

            Recalculated?.Invoke(this, EventArgs.Empty);
        }
Example #6
0
        public void Recalculate()
        {
            lock (locker)
            {
                constants.Clear();

                // WIP: sort the cell by reference (needs to be DAG)
                var list = EnumerateCells().OrderByDescending(i => i.cell.Expression).ToList();
                foreach (var xyc in list)
                {
                    var expression = xyc.cell.Expression;
                    if (expression.StartsWith("="))
                    {
                        expression = expression.Substring(1);
                    }
                    if (expression.StartsWith("."))
                    {
                        expression = "0" + expression;
                    }
                    var evaluator = new Expression(expression.ToLower());
                    AddConstants(evaluator);
                    var value = evaluator.calculate();
                    if (double.IsNaN(value) ||
                        double.IsInfinity(value))
                    {
                        value = 0;
                    }

                    constants.Add(CellId(xyc.x, xyc.y).ToLower(), value);
                    if (!string.IsNullOrEmpty(xyc.cell.Name))
                    {
                        constants.Add(xyc.cell.Name.ToLower(), value);
                    }
                }

                tabelCalculated = true;
            }

            Recalculated?.Invoke(this, null);
        }
Example #7
0
 protected void OnRegisterModified()
 {
     Recalculated?.Invoke();
 }
Example #8
0
 /// <inheritdoc/>
 public void CalculateAppend(int originX, int originY, double radius, Distance distanceCalc, double angle, double span)
 {
     OnCalculate(originX, originY, radius, distanceCalc, angle, span);
     Recalculated?.Invoke(this, new FOVRecalculatedEventArgs(new Point(originX, originY), radius, distanceCalc, angle, span));
 }
Example #9
0
        public void Recalculate()
        {
            BuildTableConstants();

            Recalculated?.Invoke(this, null);
        }