private void GridViewOnUserHitCell(object sender, MouseEventArgs e, int rowIndex, FastColumn col)
        {
            if (!col.IsHyperlinkStyleColumn)
            {
                return;
            }
            // добавить / исключить из списка выбранных
            var desc  = (IndicatorDescription)gridView.rows[rowIndex].ValueObject;
            var isFav = !desc.IsFavorite;

            desc.IsFavorite = isFav;
            // сохранить изменения
            var favList = gridView.rows.Select(r => ((IndicatorDescription)r.ValueObject)).Where(d =>
                                                                                                 d.IsFavorite).Select(d => d.TypeName).ToList();

            owner.CallFavoriteIndicatorsAreUpdated(favList);
            // перерисовать
            gridView.UpdateRow(rowIndex, desc);
            gridView.InvalidateCell(col, rowIndex);
        }
Пример #2
0
        private void FastGridUserHitCell(object sender, MouseEventArgs e, int rowIndex, FastColumn col)
        {
            UpdateUserInterface();
            var indDesc = (IndicatorDescription)fastGrid.rows[rowIndex].ValueObject;

            if (col.PropertyName == indDesc.Property(p => p.Close) && rowIndex >= 0)
            {
                DeleteIndicator(rowIndex);
                return;
            }
            if (e.Button == MouseButtons.Right && GetSelectedRow() >= 0)
            {
                contextMenuStrip.Show(fastGrid, e.Location);
                return;
            }
            if (col.PropertyName == indDesc.Property(p => p.IsFavorite) && rowIndex >= 0)
            {
                indDesc.IsFavorite = !indDesc.IsFavorite;
                var favList = owner.getFavoriteIndicators();
                if (indDesc.IsFavorite)
                {
                    favList.Add(indDesc.TypeName);
                }
                else
                {
                    favList.Remove(indDesc.TypeName);
                }
                owner.CallFavoriteIndicatorsAreUpdated(favList);
                BuildView();
                return;
            }
            if (e.Clicks == 2 && rowIndex >= 0)
            {
                EditIndicator(rowIndex);
            }
        }