Ejemplo n.º 1
0
 public void When(LineCreated evnt)
 {
     LineId          = evnt.LineId.ToString();
     BudgetId        = evnt.BudgetId.ToString();
     Date            = evnt.Expense.Date;
     Category        = evnt.Expense.Category;
     DistributionKey = evnt.Expense.DistributionKey;
     Description     = evnt.Expense.Description;
     Amount          = evnt.Expense.Amount;
     CurrencyISOCode = evnt.Expense.Amount.GetCurrency().IsoCode;
 }
Ejemplo n.º 2
0
 public BudgetLine(LineCreated evnt)
 {
     Id              = evnt.LineId.ToString();
     Timestamp       = evnt.Timestamp;
     Date            = evnt.Expense.Date;
     Amount          = evnt.Expense.Amount;
     Category        = evnt.Expense.Category;
     Description     = evnt.Expense.Description;
     DistributionKey = evnt.Expense.DistributionKey;
     Tags            = evnt.Expense.Tags;
 }
Ejemplo n.º 3
0
        void When(LineCreated evnt)
        {
            if (evnt.BudgetId.ToString().Equals(_budgetId) == false)
            {
                return;
            }

            if (_lines.Any(l => l.Id == evnt.LineId.ToString()))
            {
                return;
            }
            _lines.Add(new BudgetLine(evnt));
        }
Ejemplo n.º 4
0
        void When(LineCreated evnt)
        {
            if (evnt.BudgetId.ToString().Equals(_budget) == false)
            {
                return;
            }

            if (_lines.Any(l => l.Id == evnt.LineId.ToString()))
            {
                return;

                System.Diagnostics.Debugger.Break();
            }
            _lines.Add(new BudgetLine(evnt));
        }
Ejemplo n.º 5
0
    private void OnPointClick(PointText point, string type, bool pressed)
    {
        if (!_points.TryGetValue(type, out var points))
        {
            throw new ArgumentException("Unsupported type", nameof(type));
        }

        var index         = points.IndexOf(point);
        var geometryPoint = new GeometryPoint {
            Name = point.Text, Index = index, Type = type
        };
        var existingIndex = _indices.IndexOf(geometryPoint);

        if (existingIndex >= 0 || !pressed)
        {
            _indices.RemoveAt(existingIndex);
            _line.positionCount = _indices.Count;
            LineDestroyed?.Invoke();
            return;
        }

        if (_line.positionCount >= maxSelection)
        {
            var positionCount = _line.positionCount;
            _points[_indices[positionCount - 1].Type][_indices[positionCount - 1].Index].ToggleWithoutNotify(false);
            _indices.RemoveAt(positionCount - 1);
            LineDestroyed?.Invoke(true);
        }

        _indices.Add(geometryPoint);
        _line.positionCount = _indices.Count;

        if (_line.positionCount != maxSelection)
        {
            return;
        }

        var linePoints = new Vector3[_line.positionCount];

        _line.GetPositions(linePoints);
        LineCreated?.Invoke(linePoints, _indices.ToArray());
    }