Exemplo n.º 1
0
        private void DeleteDeviceExecute(object obj)
        {
            DynamicChildNodViewModel node = selectValue;

            //UI
            int index = DynamicChildren.IndexOf(node);

            DynamicChildren.Remove(node);

            //DOM
            DyncWidget.PanelStatePages.Remove(node.Page as IPanelStatePage);



            //Select
            if (index > 0)
            {
                SelectValue = DynamicChildren.ElementAt(--index);
            }
            else
            {
                SelectValue = DynamicChildren.ElementAt(0);
            }
            if (node.IsChecked == true)
            {
                SelectValue.IsChecked = true;
            }
            _document.IsDirty = true;
            HasChange         = true;
        }
Exemplo n.º 2
0
        private void RemoveChildPageExecute(object obj)
        {
            DynamicChildNodViewModel node = obj as DynamicChildNodViewModel;

            // This undo command will save the index of node, so have to create it before
            // removing it from collection.
            DeleteDynamicPanelStateCommand cmd = new DeleteDynamicPanelStateCommand(this, node);

            //UI
            int index = DynamicChildren.IndexOf(node);

            DynamicChildren.Remove(node);

            //DOM
            //DyncWidget.PanelStatePages.Remove(node.Page as IPanelStatePage);
            DyncWidget.DeletePanelStatePage(node.Page.Guid);
            if (DyncWidget.StartPanelStatePage == node.Page)
            {
                DyncWidget.StartPanelStatePage = DyncWidget.PanelStatePages[0];
            }

            //Select
            if (index > 0)
            {
                SelectValue = DynamicChildren.ElementAt(--index);
            }
            else
            {
                SelectValue = DynamicChildren.ElementAt(0);
            }
            if (node.IsChecked == true)
            {
                SelectValue.IsChecked = true;
            }

            //Set Dirty
            IDocumentService doc = ServiceLocator.Current.GetInstance <IDocumentService>();

            doc.Document.IsDirty = true;

            _undoManager.Push(cmd);
        }