Esempio n. 1
0
 public void SetSelectedItem(rMindBaseElement item, bool multi = false)
 {
     if (item == null)
     {
         foreach (var it in m_selected_items)
         {
             it.SetSelected(false);
         }
         m_selected_items.Clear();
         return;
     }
     if (!multi && !m_selected_items.Contains(item))
     {
         foreach (var it in m_selected_items)
         {
             if (it == item)
             {
                 continue;
             }
             it.SetSelected(false);
         }
         m_selected_items.Clear();
         m_selected_items.Add(item);
     }
     if (!m_selected_items.Contains(item))
     {
         item.SetSelected(true);
         m_selected_items.Add(item);
     }
 }
Esempio n. 2
0
        public void SetSelectedItem(rMindBaseElement item, bool multi = false)
        {
            if (item == null)
            {
                foreach (var selection in SelectedItems)
                {
                    selection.SetSelected(false);
                }
                SelectedItems.Clear();
                return;
            }

            if (multi)
            {
                if (!SelectedItems.Contains(item))
                {
                    item.SetSelected(true);
                    SelectedItems.Add(item);
                }
            }
            else
            {
                if (!SelectedItems.Contains(item))
                {
                    foreach (var selection in SelectedItems)
                    {
                        selection.SetSelected(false);
                    }
                    SelectedItems.Clear();
                    item.SetSelected(true);
                    SelectedItems.Add(item);
                }
            }

            /*
             * if (item == null)
             * {
             *  foreach (var it in m_selected_items)
             *  {
             *      it.SetSelected(false);
             *  }
             *  m_selected_items.Clear();
             *  return;
             * }
             * if (!multi && !m_selected_items.Contains(item))
             * {
             *  foreach (var it in m_selected_items)
             *  {
             *      if (it == item)
             *          continue;
             *      it.SetSelected(false);
             *  }
             *  m_selected_items.Clear();
             *  m_selected_items.Add(item);
             * }
             * if (!m_selected_items.Contains(item))
             * {
             *  item.SetSelected(true);
             *  m_selected_items.Add(item);
             * }
             */
        }