Example #1
0
        private string GetCurrentPath()
        {
            TreeNode node = GetSelectedTreeNode();
            string   path = "";

            if (node == null)
            {
                path = this.accountTree1.RootPath;
            }
            else
            {
                AccountNodeInfo nodeInfo = (AccountNodeInfo)node.Tag;
                path = nodeInfo.Path;
            }

            return(path);
        }
Example #2
0
        private void itemDelete_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = accountTree1.AccountTreeView.SelectedNode;

            if (selectedNode == null)
            {
                MessageBox.Show("没有选中任何账户或目录");
                return;
            }

            AccountNodeInfo nodeInfo = (AccountNodeInfo)selectedNode.Tag;
            string          path     = GetCurrentPath();

            if (nodeInfo.IsPath)
            {
                accountManager.DeleteAccountPath(path);
            }
            else
            {
                accountManager.DeleteAccount(path, selectedNode.Text);
            }
            selectedNode.Remove();
        }
Example #3
0
        private void itemAccountDetail_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = accountTree1.AccountTreeView.SelectedNode;

            if (selectedNode == null)
            {
                MessageBox.Show("没有选中任何账户");
                return;
            }
            AccountNodeInfo nodeInfo = (AccountNodeInfo)selectedNode.Tag;

            if (nodeInfo.IsPath)
            {
                MessageBox.Show("选中的是目录");
                return;
            }

            string            path       = GetCurrentPath();
            string            name       = selectedNode.Text;
            IAccount          account    = accountManager.Load(path, name);
            FormAccountDetail formDetail = new FormAccountDetail(name, account);

            formDetail.ShowDialog();
        }
Example #4
0
        private void DoSelectAccount()
        {
            TreeNode selectedNode = accountTree1.AccountTreeView.SelectedNode;

            if (selectedNode == null)
            {
                MessageBox.Show("没有选中任何账户");
                return;
            }

            AccountNodeInfo nodeInfo = (AccountNodeInfo)selectedNode.Tag;

            if (nodeInfo.IsPath)
            {
                MessageBox.Show("选中的是目录");
                return;
            }
            string path = GetCurrentPath();

            this.selectedAccountPath = path;
            this.selectedAccountName = selectedNode.Text;
            this.selectedAccount     = accountManager.Load(SelectedAccountPath, SelectedAccountName);
            this.DialogResult        = DialogResult.OK;
        }