private void DiagramManager_SelectionChanged(SelectableModel model, bool selected)
        {
            if (!DiagramManager.Options.GroupingEnabled)
            {
                return;
            }

            if (!(model is NodeModel node))
            {
                return;
            }

            if (node.Group == null)
            {
                return;
            }

            foreach (var n in node.Group.Nodes)
            {
                if (n == node || n.Selected == selected)
                {
                    continue;
                }

                if (selected)
                {
                    DiagramManager.SelectModel(n, false);
                }
                else
                {
                    DiagramManager.UnselectModel(n);
                }
            }
        }
Example #2
0
        public List <SelectableModel> GetSelectableModels(int?cicleId, bool?onlyPendingTickets)
        {
            List <SelectableModel> tickets = new List <SelectableModel>();

            using (SqlCommand command = new SqlCommand())
            {
                using (SqlConnection connection = new SqlConnection())
                {
                    connection.ConnectionString = ConnectionString;
                    command.Connection          = connection;
                    command.CommandText         = "spGetWeightTicketSelectableModels";
                    command.Parameters.Add("@CicleId", SqlDbType.Int).Value            = cicleId;
                    command.Parameters.Add("@OnlyPendingTickets", SqlDbType.Bit).Value = onlyPendingTickets;
                    command.CommandType = CommandType.StoredProcedure;
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        SelectableModel ticket = new SelectableModel();
                        ticket.Id   = int.Parse(reader["Id"].ToString());
                        ticket.Name = reader["Folio"].ToString();
                        tickets.Add(ticket);
                    }

                    connection.Close();
                }
                return(tickets);
            }
        }
Example #3
0
        public List <SelectableModel> GetSettlementSelectableModels(int cicleId)
        {
            List <SelectableModel> settlements = new List <SelectableModel>();

            using (SqlCommand command = new SqlCommand())
            {
                using (SqlConnection connection = new SqlConnection())
                {
                    connection.ConnectionString = ConnectionString;
                    command.Connection          = connection;
                    command.CommandText         = "spGetSettlementSelectableModels";
                    command.Parameters.Add("@CicleId", SqlDbType.Int).Value = cicleId;
                    command.CommandType = CommandType.StoredProcedure;
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        SelectableModel settlement = new SelectableModel();
                        settlement.Id   = int.Parse(reader["Id"].ToString());
                        settlement.Name = reader["Producer"].ToString();
                        settlements.Add(settlement);
                    }
                    connection.Close();
                }
                return(settlements);
            }
        }
 private void Diagram_SelectionChanged(SelectableModel model, bool selected)
 {
     if (model is Table tm)
     {
         _selectedTable  = selected ? tm : null;
         _selectedColumn = null;
         StateHasChanged();
     }
 }
        public void UnselectModel(SelectableModel model)
        {
            if (!model.Selected)
            {
                return;
            }

            model.Selected = false;
            model.Refresh();
            SelectionChanged?.Invoke(model);
        }
Example #6
0
        public void UnselectModel(SelectableModel model)
        {
            if (!_selectedModels.Contains(model))
            {
                return;
            }

            model.Selected = false;
            _selectedModels.Remove(model);
            model.Refresh();
            SelectionChanged?.Invoke(model, false);
        }
        public void SelectModel(SelectableModel model, bool unselectOthers)
        {
            if (model.Selected)
            {
                return;
            }

            if (unselectOthers)
            {
                UnselectAll();
            }

            model.Selected = true;
            model.Refresh();
            SelectionChanged?.Invoke(model);
        }
Example #8
0
        public void SelectModel(SelectableModel model, bool unselectOthers)
        {
            if (_selectedModels.Contains(model))
            {
                return;
            }

            if (unselectOthers)
            {
                UnselectAll();
            }

            model.Selected = true;
            _selectedModels.Add(model);
            model.Refresh();
            SelectionChanged?.Invoke(model, true);
        }
 private void Diagram_SelectionChanged(SelectableModel obj)
 {
     Console.WriteLine($"SelectionChanged, Model={obj.GetType().Name}, Selected={obj.Selected}");
 }