Exemplo n.º 1
0
        public static void RecordSelection()
        {
            if (!Enabled)
            {
                return;
            }

            RecordObject(null, new SelectionRecord {
                objects = RuntimeSelection.objects, activeObject = RuntimeSelection.activeObject
            }, record =>
            {
                SelectionRecord state = (SelectionRecord)record.State;

                bool hasChanged = false;
                if (state.objects != null && RuntimeSelection.objects != null)
                {
                    if (state.objects.Length != RuntimeSelection.objects.Length)
                    {
                        hasChanged = true;
                    }
                    else
                    {
                        for (int i = 0; i < RuntimeSelection.objects.Length; ++i)
                        {
                            if (state.objects[i] != RuntimeSelection.objects[i])
                            {
                                hasChanged = true;
                                break;
                            }
                        }
                    }
                }
                else if (state.objects == null)
                {
                    hasChanged = RuntimeSelection.objects != null && RuntimeSelection.objects.Length != 0;
                }
                else if (RuntimeSelection.objects == null)
                {
                    hasChanged = state.objects != null && state.objects.Length != 0;
                }


                if (hasChanged)
                {
                    List <Object> selection = null;
                    if (state.objects != null)
                    {
                        selection = state.objects.ToList();
                        if (state.activeObject != null)
                        {
                            if (selection.Contains(state.activeObject))
                            {
                                selection.Remove(state.activeObject);
                                selection.Insert(0, state.activeObject);
                            }
                            else
                            {
                                selection.Insert(0, state.activeObject);
                            }
                        }
                        RTSelectionInternalsAccessor.activeObjectProperty = state.activeObject;
                        RTSelectionInternalsAccessor.objectsProperty      = selection.ToArray();
                    }
                    else
                    {
                        RTSelectionInternalsAccessor.activeObjectProperty = null;
                        RTSelectionInternalsAccessor.objectsProperty      = null;
                    }
                }
                return(hasChanged);
            },
                         r => { });
        }
Exemplo n.º 2
0
        public void RecordSelection()
        {
            if (!Enabled)
            {
                return;
            }

            RecordObject(null, new SelectionRecord {
                objects = m_rte.Selection.objects, activeObject = m_rte.Selection.activeObject
            }, record =>
            {
                SelectionRecord state = (SelectionRecord)record.State;

                bool hasChanged = false;
                if (state.objects != null && m_rte.Selection.objects != null)
                {
                    if (state.objects.Length != m_rte.Selection.objects.Length)
                    {
                        hasChanged = true;
                    }
                    else
                    {
                        for (int i = 0; i < m_rte.Selection.objects.Length; ++i)
                        {
                            if (state.objects[i] != m_rte.Selection.objects[i])
                            {
                                hasChanged = true;
                                break;
                            }
                        }
                    }
                }
                else if (state.objects == null)
                {
                    hasChanged = m_rte.Selection.objects != null && m_rte.Selection.objects.Length != 0;
                }
                else if (m_rte.Selection.objects == null)
                {
                    hasChanged = state.objects != null && state.objects.Length != 0;
                }


                if (hasChanged)
                {
                    List <Object> selection = null;
                    if (state.objects != null)
                    {
                        selection = state.objects.ToList();
                        if (state.activeObject != null)
                        {
                            if (selection.Contains(state.activeObject))
                            {
                                selection.Remove(state.activeObject);
                                selection.Insert(0, state.activeObject);
                            }
                            else
                            {
                                selection.Insert(0, state.activeObject);
                            }
                        }
                        m_rte.Selection.INTERNAL_activeObjectProperty = state.activeObject;
                        m_rte.Selection.INTERNAL_objectsProperty      = selection.ToArray();
                    }
                    else
                    {
                        m_rte.Selection.INTERNAL_activeObjectProperty = null;
                        m_rte.Selection.INTERNAL_objectsProperty      = null;
                    }
                }
                return(hasChanged);
            },
                         r => { });
        }