Example #1
0
        public static BaseWrapper Wrap(IWin32Window owner, ResourceNode node)
        {
            _owner = owner;
            BaseWrapper w;

            if (NodeWrapperAttribute.PluginTypeWrappers.ContainsKey(node.GetType()))
            {
                w = NodeWrapperAttribute.PluginTypeWrappers[node.GetType()].GetInstance();
            }
            else if (NodeWrapperAttribute.PluginResourceWrappers.ContainsKey(node.ResourceFileType))
            {
                w = NodeWrapperAttribute.PluginResourceWrappers[node.ResourceFileType].GetInstance();
            }
            else if (NodeWrapperAttribute.ResourceWrappers.ContainsKey(node.ResourceFileType))
            {
                w = Activator.CreateInstance(NodeWrapperAttribute.ResourceWrappers[node.ResourceFileType]) as
                    BaseWrapper;
            }
            else
            {
                w = new GenericWrapper();
            }

            w.Link(node);
            return(w);
        }
        private static void MenuOpening(object sender, CancelEventArgs e)
        {
            GenericWrapper w = GetInstance <GenericWrapper>();

            _menu.Items[2].Enabled = w.PrevNode != null;
            _menu.Items[3].Enabled = w.NextNode != null;
        }
Example #3
0
        protected internal virtual void OnMovedDown(ResourceNode node, bool select)
        {
            GenericWrapper res = FindResource(node, false) as GenericWrapper;

            res.MoveDown(select);
            res.EnsureVisible();
            //res.TreeView.SelectedNode = res;
        }
        private static void MenuOpening(object sender, CancelEventArgs e)
        {
            GenericWrapper w = GetInstance <GenericWrapper>();

            _menu.Items[1].Enabled = _menu.Items[8].Enabled = w.Parent != null;
            _menu.Items[2].Enabled = w._resource.IsDirty || w._resource.IsBranch;
            _menu.Items[4].Enabled = w.PrevNode != null;
            _menu.Items[5].Enabled = w.NextNode != null;
        }
        private static void MenuOpening(object sender, CancelEventArgs e)
        {
            GenericWrapper w = GetInstance <GenericWrapper>();

            ReplaceToolStripMenuItem.Enabled  = w.Parent != null;
            RestoreToolStripMenuItem.Enabled  = w._resource.IsDirty || w._resource.IsBranch;
            MoveUpToolStripMenuItem.Enabled   = w.PrevNode != null;
            MoveDownToolStripMenuItem.Enabled = w.NextNode != null;
            DeleteToolStripMenuItem.Enabled   = w.Parent != null;
        }
Example #6
0
        private static void MultiMenuOpening(object sender, CancelEventArgs e)
        {
            GenericWrapper w = GetInstance <GenericWrapper>();

            foreach (TreeNode n in MainForm.Instance.resourceTree.SelectedNodes)
            {
                if (!(n is GenericWrapper g) || g._resource.Parent == null)
                {
                    DeleteSelectedToolStripMenuItem.Visible = false;
                    DeleteSelectedToolStripMenuItem.Enabled = false;
                    break;
                }
            }
        }