コード例 #1
0
 /// <summary>
 /// A value has changed.
 /// Update treenode.
 /// </summary>
 private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
 {
     foreach (var entity in selectionManager.SelectedEntities)
     {
         tvItems.UpdateNodeFromEntity(entity);
     }
     propertyGrid.Refresh();
     UpdateFormTitle.Fire(this);
     ValidateModule();
 }
コード例 #2
0
        /// <summary>
        /// Add the given entity to the tree.
        /// </summary>
        private void AddEntity(IEntity entity, TreeNode root, bool reloadAndValidate)
        {
            var node = new EntityNode(entity, contextMenus);

            root.Nodes.Add(node);
            using (selectionManager.BeginUpdate())
            {
                selectionManager.Clear();
                selectionManager.Add(entity);
            }
            if (reloadAndValidate)
            {
                viewEditor.ReloadModule();
                ValidateModule();
            }
            UpdateFormTitle.Fire(this);
        }
コード例 #3
0
        /// <summary>
        /// Rename the selected nodes
        /// </summary>
        private void tbRename_Click(object sender, EventArgs e)
        {
            var selection = selectionManager.SelectedEntities.Where(x => !x.HasAutomaticDescription).ToList();

            if (selection.Count > 0)
            {
                using (var dialog = new RenameEntitiesForm(selection))
                {
                    if (dialog.ShowDialog(this) == DialogResult.OK)
                    {
                        foreach (var entity in selection)
                        {
                            tvItems.UpdateNodeFromEntity(entity);
                        }
                        propertyGrid.Refresh();
                        UpdateFormTitle.Fire(this);
                        ValidateModule();
                    }
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Add a route that is the reverse of the selected route.
        /// </summary>
        private void miAddReverseRoute_Click(object sender, EventArgs e)
        {
            var selection  = selectionManager.SelectedEntities.OfType <IRoute>().Where(x => x.GetReverse() == null).ToList();
            var nodesAdded = false;

            foreach (var route in selection)
            {
                var reverse = route.AddReverse();
                if (reverse != null)
                {
                    AddEntity(reverse, moduleTree.RoutesRoot, false);
                    nodesAdded = true;
                }
            }
            if (nodesAdded)
            {
                propertyGrid.Refresh();
                viewEditor.ReloadModule();
                UpdateFormTitle.Fire(this);
                ValidateModule();
            }
        }
コード例 #5
0
        /// <summary>
        /// Remove the selected entity
        /// </summary>
        private void tbRemove_Click(object sender, EventArgs e)
        {
            var selection = selectionManager.SelectedEntities.ToList();

            if (selection.Count > 0)
            {
                var msg = (selection.Count == 1)
                              ? string.Format(Strings.AreYouSureToRemoveX, selection[0])
                              : string.Format(Strings.AreYouSureToRemoveAllXEntities, selection.Count);
                if (MessageBox.Show(msg, Strings.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    foreach (var entity in selection)
                    {
                        entity.Accept(Default <RemoveVisitor> .Instance, module);
                    }
                    ReloadModule();
                    viewEditor.ReloadModule();
                    UpdateFormTitle.Fire(this);
                    ValidateModule();
                }
            }
        }