private void myConnectionsList_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {            
            if (myConnectionsList.SelectedItem != null)
            {
                OnlineBlocksFolder onl = new OnlineBlocksFolder((string) myConnectionsList.SelectedItem);
                IBlocksFolder fld = (IBlocksFolder) onl;
                DockableContentBlockList tmp = new DockableContentBlockList(fld);
                tmp.parentDockingManager = parentDockingManager;
                tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                tmp.ToolTip = fld.ToString();
                tmp.Show(parentDockingManager);
                tmp.ToggleAutoHide();

                //Set size of the parent DockablePane (it's automaticly been created!)
                DockablePane tmpPane = tmp.TryFindParent<DockablePane>();
                ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0));

                parentDockingManager.ActiveDocument = tmp;
            }
        }
コード例 #2
0
        private void mnuOnlineBlocks_Click(object sender, RoutedEventArgs e)
        {
            OnlineBlocksFolder onl = new OnlineBlocksFolder(Connection);
            IBlocksFolder fld = (IBlocksFolder)onl;
            DockableContentBlockList tmp = new DockableContentBlockList(fld);
            tmp.parentDockingManager = DockManager;
            tmp.Title = fld.ToString();
            tmp.ToolTip = fld.ToString();
            tmp.Show(DockManager);
            tmp.ToggleAutoHide();

            //Set size of the parent DockablePane (it's automaticly been created!)
            DockablePane tmpPane = tmp.TryFindParent<DockablePane>();
            ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0));

            DockManager.ActiveDocument = tmp;
        }
        private void myTreeView_Drop(object sender, DragEventArgs e)
        {
            
            TreeViewItem row = UIHelpers.TryFindFromPoint<TreeViewItem>((UIElement)sender, e.GetPosition(myTreeView));

            ProjectFolder blkFld = (ProjectFolder) myTreeView.ItemFromContainer(row);

            while (blkFld != null && !(blkFld is S7ProgrammFolder))
            {
                blkFld = ((ProjectFolder) blkFld).Parent;
                row = row.TryFindParent<TreeViewItem>();
            }

            if (blkFld != null)
            {
                string connName = (string) e.Data.GetData("ConnectionName");
                OnlineBlocksFolder oldFld = null;
                foreach (var projectFolder in blkFld.SubItems)
                {
                    if (projectFolder is OnlineBlocksFolder)
                        oldFld = (OnlineBlocksFolder) projectFolder;
                }
                if (oldFld != null)
                    blkFld.SubItems.Remove(oldFld);

                var onlBlkFld = new OnlineBlocksFolder(connName) {Parent = blkFld};
                blkFld.SubItems.Add(onlBlkFld);
                ((IProgrammFolder) blkFld).OnlineBlocksFolder = onlBlkFld;

                row.Items.Refresh();
            }

        }