예제 #1
0
        /// <summary>
        /// Update the current cell cache <see cref="currentCells" />
        /// </summary>
        /// <param name="row">The thing in the current row context</param>
        /// <param name="col">The thing in the current column context</param>
        /// <param name="cellValue">The cell object</param>
        private void UpdateCurrentCell(DefinedThing row, DefinedThing col, MatrixCellViewModel cellValue)
        {
            var cellRef = $"{row.Iid}_{col.Iid}";

            if (this.currentCells.ContainsKey(cellRef))
            {
                this.currentCells[cellRef] = cellValue;
            }
            else
            {
                this.currentCells.Add(cellRef, cellValue);
            }
        }
예제 #2
0
        /// <summary>
        /// Sets the info detail properties
        /// </summary>
        /// <param name="vm"><see cref="MatrixCellViewModel"/> that represents the currently selected grid cell</param>
        private void SetPropertiesOnSelectedItemChanged(MatrixCellViewModel vm)
        {
            this.SelectedCellDetails = string.Empty;

            if (vm == null)
            {
                return;
            }

            var selectedRow = this.Records.FirstOrDefault(x => x.SingleOrDefault(y => y.Value == vm).Key != null);

            if (selectedRow != null)
            {
                var thing = vm.SourceX as DefinedThing;

                var matrixAddress = new MatrixAddress
                {
                    Column = thing?.ShortName ?? string.Empty,
                    Row    = this.Records.IndexOf(selectedRow)
                };

                this.SetRowAndColumnPropertiesOnSelectedItemChanged(matrixAddress);
            }

            var toolTip = new StringBuilder();

            foreach (var relationship in vm.Relationships)
            {
                if (toolTip.Length > 0)
                {
                    toolTip.AppendLine("");
                    toolTip.AppendLine("");
                }

                toolTip.AppendLine(relationship.Source.Equals(vm.SourceY) ? "------------->>>" : "<<<-------------");
                toolTip.Append(relationship.Tooltip());
            }

            this.SelectedCellDetails = toolTip.ToString();
        }