示例#1
0
        private void FileTreeView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TreeListItem item = WpfUtil.GetTreeListItem(e.OriginalSource);

            if (item == null)
            {
                return;
            }

            FileComponent file = FileController.SelectedItem;

            if (file != null)
            {
                if (file.File)
                {
                    file.Open();
                }
                else
                {
                    TreeNode node = FileTreeView.SelectedNode;
                    if (node != null)
                    {
                        FileTreeView.SetIsExpanded(node, !node.IsExpanded);
                    }
                }
            }

            FileTreeView.UnselectAll();
        }
示例#2
0
        private void FileOpenCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (FileController.SelectedItems.Count == 1)
            {
                FileComponent file = FileController.SelectedItem;

                if (file.File)
                {
                    file.Open();
                    FileTreeView.UnselectAll();
                    return;
                }
            }

            FileController.Open(FileController.SelectedItems);
            FileTreeView.UnselectAll();
        }
示例#3
0
        private void FileAddCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            DemonSaw.Entity.Entity entity = ClientController.SelectedItem;

            System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog()
            {
                Description = "Select the directory that you want to share.",
            };

            System.Windows.Forms.DialogResult result = dlg.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                FileComponent file = new FileComponent(dlg.SelectedPath)
                {
                    Owner = entity
                };
                FileController.Add(file);
            }

            FileTreeView.UnselectAll();
        }