Пример #1
0
        private async void RemoveItem(object obj)
        {
            if (await FocusedNode.RemoveAsync(false) != NodeActionResult.Cancelled)
            {
                String parentNodePath = ((new DirectoryInfo(FocusedNode.NodePath)).Parent).FullName;

                String sfoRootPath = Path.Combine(ApplicationData.Current.LocalFolder.Path,
                                                  AppResources.DownloadsDirectory.Replace("\\", ""));

                // Check if the previous folders of the path are empty and
                // remove from the offline and the DB on this case
                while (String.Compare(parentNodePath, sfoRootPath) != 0)
                {
                    var folderPathToRemove = parentNodePath;
                    parentNodePath = ((new DirectoryInfo(parentNodePath)).Parent).FullName;

                    if (FolderService.IsEmptyFolder(folderPathToRemove))
                    {
                        Deployment.Current.Dispatcher.BeginInvoke(() => GoFolderUp());
                        FolderService.DeleteFolder(folderPathToRemove);
                        SavedForOffline.DeleteNodeByLocalPath(folderPathToRemove);
                    }
                }

                Refresh();
            }
        }
Пример #2
0
 private async void RemoveItem(object obj)
 {
     if (FocusedNode != null)
     {
         await FocusedNode.RemoveAsync(false);
     }
 }
Пример #3
0
        public void LinkControl(LinkDirection direction, UserControl linkedUserControl)
        {
            if (!dict.ContainsKey(linkedUserControl))
            {
                AddLinkedControl(linkedUserControl);
            }

            FocusedNode.Link(direction, dict[linkedUserControl]);

            switch (direction)
            {
            case LinkDirection.ldRight:
                OnPropertyChanged("CanNavigateRight");
                OnPropertyChanged("RightDirectionModelName");
                break;

            case LinkDirection.ldLeft:
                OnPropertyChanged("CanNavigateLeft");
                OnPropertyChanged("LeftDirectionModelName");
                break;

            case LinkDirection.ldTop:
                OnPropertyChanged("CanNavigateTop");
                OnPropertyChanged("TopDirectionModelName");
                break;

            case LinkDirection.ldBottom:
                OnPropertyChanged("CanNavigateBottom");
                OnPropertyChanged("BottomDirectionModelName");
                break;

            default:
                break;
            }
        }
Пример #4
0
        private string GetNavigationHint(LinkDirection direction)
        {
            bool   canNavigate = (FocusedNode != null && FocusedNode.HasLinkedNode(direction));
            string text        = string.Empty;

            if (canNavigate)
            {
                var control = FocusedNode.GetLinkedNode(direction).Control;

                if (control is TreeControl)
                {
                    text = (control as TreeControl).modelName;
                }
                if (control is ProjectControl)
                {
                    text = "Project";
                }
                if (control is ReportControl)
                {
                    text = "Report";
                }
            }

            return(text);
        }
Пример #5
0
 protected override bool OnKeyReleaseEvent(Gdk.EventKey evnt)
 {
     if (FocusedNode != null)
     {
         FocusedNode.KeyRelease(new GdkKeyEvent(evnt));
     }
     return(true);
 }
Пример #6
0
        private void GetLink(object obj)
        {
            if (!IsUserOnline())
            {
                return;
            }

            FocusedNode.GetLink();
        }
Пример #7
0
        public void Navigate(LinkDirection direction)
        {
            var targetNode = FocusedNode.GetLinkedNode(direction);

            // relink TreeControl (call link back)
            if (FocusedNode.Control is TreeControl && !(targetNode.Control is TreeControl))
            {
                FocusedNode.Link(LinkDirection.ldLeft, FocusedNode.GetLinkedNode(LinkDirection.ldLeft));
                FocusedNode.Link(LinkDirection.ldRight, FocusedNode.GetLinkedNode(LinkDirection.ldRight));
            }

            FocusedNode = targetNode;
        }
Пример #8
0
 //-------------------------------------------------------------------------
 void OnExpandAllChildren(object sender, EventArgs e)
 {
     BeginUpdate();
     if (MultiSelect && NodesSelection.Count > 0)
     {
         foreach (timos.supervision.Node selnode in NodesSelection)
         {
             selnode.ExpandAll();
         }
         NodesSelection.Clear();
     }
     if (FocusedNode != null)
     {
         FocusedNode.ExpandAll();
     }
     EndUpdate();
 }
Пример #9
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            Node newnode = null;

            if (e.KeyCode == Keys.PageUp)
            {
                int remainder = 0;
                int diff      = MaxVisibleRows(out remainder) - 1;
                newnode = NodeCollection.GetNextNode(FocusedNode, -diff);
                if (newnode == null)
                {
                    newnode = Nodes.FirstVisibleNode();
                }
            }
            if (e.KeyCode == Keys.PageDown)
            {
                int remainder = 0;
                int diff      = MaxVisibleRows(out remainder) - 1;
                newnode = NodeCollection.GetNextNode(FocusedNode, diff);
                if (newnode == null)
                {
                    newnode = Nodes.LastVisibleNode(true);
                }
            }

            if (e.KeyCode == Keys.Down)
            {
                newnode = NodeCollection.GetNextNode(FocusedNode, 1);
            }
            if (e.KeyCode == Keys.Up)
            {
                newnode = NodeCollection.GetNextNode(FocusedNode, -1);
            }
            if (e.KeyCode == Keys.Home)
            {
                newnode = Nodes.FirstNode;
            }
            if (e.KeyCode == Keys.End)
            {
                newnode = Nodes.LastVisibleNode(true);
            }
            if (e.KeyCode == Keys.Left)
            {
                if (FocusedNode != null)
                {
                    if (FocusedNode.Expanded)
                    {
                        FocusedNode.Collapse();
                        EnsureVisible(FocusedNode);
                        return;
                    }
                    if (FocusedNode.Parent != null)
                    {
                        FocusedNode = FocusedNode.Parent;
                        EnsureVisible(FocusedNode);
                    }
                }
            }
            if (e.KeyCode == Keys.Right)
            {
                if (FocusedNode != null)
                {
                    if (FocusedNode.Expanded == false && FocusedNode.HasChildren)
                    {
                        FocusedNode.Expand();
                        EnsureVisible(FocusedNode);
                        return;
                    }
                    if (FocusedNode.Expanded == true && FocusedNode.HasChildren)
                    {
                        FocusedNode = FocusedNode.Nodes.FirstNode;
                        EnsureVisible(FocusedNode);
                    }
                }
            }
            if (newnode != null)
            {
                if (MultiSelect)
                {
                    // tree behavior is
                    // keys none,		the selected node is added as the focused and selected node
                    // keys control,	only focused node is moved, the selected nodes collection is not modified
                    // keys shift,		selection from first selected node to current node is done
                    if (Control.ModifierKeys == Keys.Control)
                    {
                        FocusedNode = newnode;
                    }
                    else
                    {
                        MultiSelectAdd(newnode, Control.ModifierKeys);
                    }
                }
                else
                {
                    FocusedNode = newnode;
                }
                EnsureVisible(FocusedNode);
            }
            base.OnKeyDown(e);
        }
Пример #10
0
 private void ExpandAllItemClick(object sender, EventArgs eventArgs)
 {
     FocusedNode.ExpandAll();
 }
Пример #11
0
 public string GetSelectedNodeText(int colNum)
 {
     return(FocusedNode.GetValue(colNum).ToString());
 }
Пример #12
0
 private void DownloadItem(object obj)
 {
     FocusedNode.Download(TransfersService.MegaTransfers);
 }
Пример #13
0
 private void RenameItem(object obj)
 {
     FocusedNode.Rename();
 }