private void TreeView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (myTreeView.SelectedItem != null)
            {
                if (myTreeView.SelectedItem is IBlocksFolder)
                {
                    IBlocksFolder            fld = (IBlocksFolder)myTreeView.SelectedItem;
                    DockableContentBlockList tmp = new DockableContentBlockList(fld);
                    tmp.parentDockingManager = parentDockingManager;
                    tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    if (myTreeView.SelectedItem is BlocksOfflineFolder)
                    {
                        tmp.ToolTip = ((BlocksOfflineFolder)myTreeView.SelectedItem).Folder;
                    }
                    else
                    {
                        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;
                }
                else if (myTreeView.SelectedItem is ISymbolTable)
                {
                    ISymbolTable             fld = (ISymbolTable)myTreeView.SelectedItem;
                    ContentWindowSymbolTable tmp = new ContentWindowSymbolTable(fld);
                    tmp.Title   = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    tmp.ToolTip = fld.ToString();
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (myTreeView.SelectedItem is ReferenceData)
                {
                    ReferenceData fld = (ReferenceData)myTreeView.SelectedItem;
                    ContentWindowReferenceData tmp = new ContentWindowReferenceData(fld);
                    tmp.parentDockingManager = parentDockingManager;

                    tmp.Title   = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    tmp.ToolTip = fld.ToString();
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (myTreeView.SelectedItem is S7VATBlock)
                {
                    S7VATBlock          fld = (S7VATBlock)myTreeView.SelectedItem;
                    ContentWindowVarTab tmp = new ContentWindowVarTab(fld);
                    tmp.Title   = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    tmp.ToolTip = fld.ToString();
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
            }
        }
        private void myDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if(myDataGrid.SelectedItem!=null)
            {
                Block blk = ((ProjectBlockInfo) myDataGrid.SelectedItem).GetBlock();

                if (blk is S7FunctionBlock || blk is S5FunctionBlock)
                {
                    e.Handled = true;
                    ContentWindowFunctionBlockEditor tmp = new ContentWindowFunctionBlockEditor(blk);
                    tmp.Title = blk.BlockName;
                    tmp.ToolTip = myFld.ToString() + "\\" + tmp.Title;
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (blk is S7DataBlock || blk is S5DataBlock)
                {
                    e.Handled = true;
                    ContentWindowDataBlockEditor tmp = new ContentWindowDataBlockEditor(blk);
                    tmp.Title = blk.BlockName;
                    tmp.ToolTip = myFld.ToString() + "\\" + tmp.Title;
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (blk is S7VATBlock)
                {
                    e.Handled = true;
                    ContentWindowVarTab tmp = new ContentWindowVarTab((S7VATBlock)blk);
                    tmp.Title = blk.BlockName;
                    tmp.ToolTip = myFld.ToString() + "\\" + tmp.Title;
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (blk is S7SourceBlock)
                {
                    e.Handled = true;
                    ContentWindowSourceBlock tmp = new ContentWindowSourceBlock((S7SourceBlock)blk);
                    tmp.Title = blk.Name;
                    tmp.ToolTip = myFld.ToString() + "\\" + tmp.Title;
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                
            }
        }
        private void myDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (myDataGrid.SelectedItem != null)
            {
                Block blk = ((ProjectBlockInfo)myDataGrid.SelectedItem).GetBlock();

                if (blk is S7FunctionBlock || blk is S5FunctionBlock)
                {
                    e.Handled = true;
                    ContentWindowFunctionBlockEditor tmp = new ContentWindowFunctionBlockEditor(blk);
                    tmp.Title   = blk.BlockName;
                    tmp.ToolTip = myFld.ToString() + "\\" + tmp.Title;
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (blk is S7DataBlock || blk is S5DataBlock)
                {
                    e.Handled = true;
                    ContentWindowDataBlockEditor tmp = new ContentWindowDataBlockEditor(blk);
                    tmp.Title   = blk.BlockName;
                    tmp.ToolTip = myFld.ToString() + "\\" + tmp.Title;
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (blk is S7VATBlock)
                {
                    e.Handled = true;
                    ContentWindowVarTab tmp = new ContentWindowVarTab((S7VATBlock)blk);
                    tmp.Title   = blk.BlockName;
                    tmp.ToolTip = myFld.ToString() + "\\" + tmp.Title;
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (blk is S7SourceBlock)
                {
                    e.Handled = true;
                    ContentWindowSourceBlock tmp = new ContentWindowSourceBlock((S7SourceBlock)blk);
                    tmp.Title   = blk.Name;
                    tmp.ToolTip = myFld.ToString() + "\\" + tmp.Title;
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
            }
        }
        private void TreeView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (myTreeView.SelectedItem!=null)
            {
                if (myTreeView.SelectedItem is IBlocksFolder)
                {
                    IBlocksFolder fld = (IBlocksFolder) myTreeView.SelectedItem;
                    DockableContentBlockList tmp = new DockableContentBlockList(fld);
                    tmp.parentDockingManager = parentDockingManager;
                    tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    if (myTreeView.SelectedItem is BlocksOfflineFolder)
                        tmp.ToolTip = ((BlocksOfflineFolder) myTreeView.SelectedItem).Folder;
                    else
                        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;

                }
                else if (myTreeView.SelectedItem is ISymbolTable)
                {
                    ISymbolTable fld = (ISymbolTable)myTreeView.SelectedItem;
                    ContentWindowSymbolTable tmp = new ContentWindowSymbolTable(fld);
                    tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    tmp.ToolTip = fld.ToString();                   
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (myTreeView.SelectedItem is ReferenceData)
                {
                    ReferenceData fld = (ReferenceData)myTreeView.SelectedItem;
                    ContentWindowReferenceData tmp = new ContentWindowReferenceData(fld);
                    tmp.parentDockingManager = parentDockingManager;
                  
                    tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    tmp.ToolTip = fld.ToString();
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (myTreeView.SelectedItem is S7VATBlock)
                {
                    S7VATBlock fld = (S7VATBlock)myTreeView.SelectedItem;
                    ContentWindowVarTab tmp = new ContentWindowVarTab(fld);
                    tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    tmp.ToolTip = fld.ToString();
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
            }
        }