Ejemplo n.º 1
0
            public SubPathParentToolStripItem(MainWindow window, IExplorerParentObject exObject)
            {

                if (exObject != null)
                {
                    base.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                    base.Image = gView.Desktop.Wpf.DataExplorer.Properties.Resources.pfeil_r_s;
                    base.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
                    base.ShowDropDownArrow = false;

                    if (exObject.ChildObjects != null)
                    {
                        foreach (IExplorerObject childObject in exObject.ChildObjects)
                        {
                            SubPathToolStripItem child = new SubPathToolStripItem(childObject);
                            child.Click += new EventHandler(window.SubPathItem_Click);
                            base.DropDownItems.Add(child);

                        }
                    }
                }
                base.BackColor = System.Drawing.Color.White;

                //base.Size = new Size(base.Size.Width, 14);
            }
Ejemplo n.º 2
0
            async static public Task <SubPathParentToolStripItem> Create(MainWindow window, IExplorerParentObject exObject)
            {
                var item = new SubPathParentToolStripItem();

                if (exObject != null)
                {
                    item.DisplayStyle      = global::System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                    item.Image             = gView.Win.DataExplorer.Properties.Resources.pfeil_r_s;
                    item.ImageScaling      = global::System.Windows.Forms.ToolStripItemImageScaling.None;
                    item.ShowDropDownArrow = false;

                    if (await exObject.ChildObjects() != null)
                    {
                        foreach (IExplorerObject childObject in await exObject.ChildObjects())
                        {
                            SubPathToolStripItem child = new SubPathToolStripItem(childObject);
                            child.Click += new EventHandler(window.SubPathItem_Click);
                            item.DropDownItems.Add(child);
                        }
                    }
                }
                item.BackColor = global::System.Drawing.Color.White;

                //base.Size = new Size(base.Size.Width, 14);

                return(item);
            }
Ejemplo n.º 3
0
        private void tree_NodeSelected(System.Windows.Forms.TreeNode node)
        {
            if (_toolStripAddress == null) return;
            if (node is ExplorerObjectNode && ((ExplorerObjectNode)node).ExplorerObject != null)
            {
                RemovePathButtons();

                IExplorerObject pathObject = ((ExplorerObjectNode)node).ExplorerObject;
                while (pathObject != null)
                {
                    if (pathObject is IExplorerParentObject)
                        _toolStripAddress.Items.Insert(0, new SubPathParentToolStripItem(this, (IExplorerParentObject)pathObject));

                    SubPathToolStripItem item = new SubPathToolStripItem(pathObject);
                    item.Click += new EventHandler(SubPathItem_Click);
                    _toolStripAddress.Items.Insert(0, item);

                    pathObject = pathObject.ParentExplorerObject;
                }

                _selected.Clear();
                _selected.Add(_exObject = ((ExplorerObjectNode)node).ExplorerObject);

                ViewTabPages(_exObject);

                if (_createNewRibbonGroupBox != null)
                {
                    RemoveCreateNewButtons();
                    PlugInManager compMan = new PlugInManager();
                    foreach (XmlNode compNode in compMan.GetPluginNodes(Plugins.Type.IExplorerObject))
                    {
                        IExplorerObject ex = compMan.CreateInstance(compNode) as IExplorerObject;
                        if (ex is IExplorerObjectCreatable)
                        {
                            if (!((IExplorerObjectCreatable)ex).CanCreate(_exObject)) continue;

                            //if (_toolStripCreateNew.Items.Count == 0)
                            //{
                            //    _toolStripCreateNew.Items.Add(new System.Windows.Forms.ToolStripLabel(gView.Framework.Globalisation.LocalizedResources.GetResString("Create.New", "Create new") + ":"));
                            //}

                            CreateNewToolStripItem createNewItem = new CreateNewToolStripItem(ex);
                            createNewItem.Click += createNewItem_Click;
                            _createNewRibbonGroupBox.Items.Add(createNewItem);
                        }
                    }
                    if (_createNewRibbonGroupBox.Items.Count > 0)
                        _createNewRibbonGroupBox.Visibility = Visibility.Visible;
                }
            }
            else
            {
                RemovePathButtons();
                ViewTabPages(null);
            }

            ValidateButtons();
        }
Ejemplo n.º 4
0
        internal void SubPathItem_Click(object sender, EventArgs e)
        {
            if (_tree != null && sender is SubPathToolStripItem)
            {
                SubPathToolStripItem item = (SubPathToolStripItem)sender;

                this.Cursor = System.Windows.Input.Cursors.Wait;
                try
                {
                    if (!_tree.MoveToNode(item.SubPath))
                    {
                        System.Windows.MessageBox.Show("Can't move to '" + item.SubPath + "'", "Error");
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.MessageBox.Show(ex.Message, "Error");
                }
                this.Cursor = System.Windows.Input.Cursors.Arrow;
            }
        }
Ejemplo n.º 5
0
        async private Task tree_NodeSelected(global::System.Windows.Forms.TreeNode node)
        {
            if (_toolStripAddress == null)
            {
                return;
            }

            if (node is ExplorerObjectNode && ((ExplorerObjectNode)node).ExplorerObject != null)
            {
                RemovePathButtons();

                IExplorerObject pathObject = ((ExplorerObjectNode)node).ExplorerObject;
                while (pathObject != null)
                {
                    if (pathObject is IExplorerParentObject)
                    {
                        try
                        {
                            _toolStripAddress.Items.Insert(0, await SubPathParentToolStripItem.Create(this, (IExplorerParentObject)pathObject));
                        }
                        catch (Exception ex)
                        {
                            string msg = ex.Message;
                            MessageBox.Show(ex.Message);
                        }
                    }

                    SubPathToolStripItem item = new SubPathToolStripItem(pathObject);
                    item.Click += new EventHandler(SubPathItem_Click);
                    _toolStripAddress.Items.Insert(0, item);

                    pathObject = pathObject.ParentExplorerObject;
                }

                _selected.Clear();
                _selected.Add(_exObject = ((ExplorerObjectNode)node).ExplorerObject);

                await ViewTabPages(_exObject);

                if (_createNewRibbonGroupBox != null)
                {
                    RemoveCreateNewButtons();
                    PlugInManager compMan = new PlugInManager();
                    foreach (var compType in compMan.GetPlugins(gView.Framework.system.Plugins.Type.IExplorerObject))
                    {
                        IExplorerObject ex = compMan.CreateInstance <IExplorerObject>(compType);
                        if (ex is IExplorerObjectCreatable)
                        {
                            if (!((IExplorerObjectCreatable)ex).CanCreate(_exObject))
                            {
                                continue;
                            }

                            //if (_toolStripCreateNew.Items.Count == 0)
                            //{
                            //    _toolStripCreateNew.Items.Add(new System.Windows.Forms.ToolStripLabel(gView.Framework.Globalisation.LocalizedResources.GetResString("Create.New", "Create new") + ":"));
                            //}

                            CreateNewToolStripItem createNewItem = new CreateNewToolStripItem(ex);
                            createNewItem.Click += createNewItem_Click;
                            _createNewRibbonGroupBox.Items.Add(createNewItem);
                        }
                    }
                    if (_createNewRibbonGroupBox.Items.Count > 0)
                    {
                        _createNewRibbonGroupBox.Visibility = Visibility.Visible;
                    }
                }
            }
            else
            {
                RemovePathButtons();
                await ViewTabPages(null);
            }

            ValidateButtons();
        }