示例#1
0
 /// <summary>
 /// 退出程序
 /// </summary>
 void exitApplication()
 {
     /* 删除文件缓存目录 */
     if (Directory.Exists(MyConfig.PATH_FILE_BUFFER))
     {
         FileTree.deleteDirectory(MyConfig.PATH_FILE_BUFFER, null);
     }
     System.Environment.Exit(0);
 }
示例#2
0
 private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
 {
     /* 删除文件缓存目录 */
     if (Directory.Exists(MyConfig.PATH_FILE_BUFFER))
     {
         FileTree.deleteDirectory(MyConfig.PATH_FILE_BUFFER, null);
     }
     /* 关闭同步线程 */
     if (ThreadSync != null)
     {
         ThreadSync.Abort();
     }
 }
示例#3
0
        /// <summary>
        /// 更新文件树
        /// </summary>
        /// <param name="directory_paths"></param>
        ///

        public void updateTree(string directoryPath)
        {
            if (string.IsNullOrEmpty(directoryPath))
            {
                return;
            }
            if (directoryPath.Equals(RootDirectory.FullName))
            {
                initializeTree(directoryPath);
            }
            FileTree fileTree = getTargetTree(directoryPath);

            if (fileTree == null)
            {
                return;
            }
            else
            {
                fileTree.initializeTree(directoryPath);
            }
        }
示例#4
0
        /// <summary>
        /// 获得指定的子树
        /// </summary>
        /// <param name="directoryPath"></param>
        /// <returns></returns>
        public FileTree getTargetTree(string directoryPath)
        {
            Stack <string> pathBlock = getPathBlock(directoryPath);

            if (pathBlock == null)
            {
                return(null);
            }
            FileTree fileTree = this;

            try
            {
                while (pathBlock.Count > 0)
                {
                    fileTree = fileTree.SubTree[pathBlock.Pop()];
                }
            }
            catch (Exception e)
            {
                Reporter.reportBug(e.ToString());
            }
            return(fileTree);
        }
示例#5
0
        /// <summary>
        /// 设置按钮按下事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pictureBox_buttonSetting_Click(object sender, EventArgs e)
        {
            settingForm = new SettingForm();
            //settingForm.TopLevel = false;
            //settingForm.Parent = this;
            settingForm.startSetting();
            DialogResult dialogResult = settingForm.ShowDialog();

            if (dialogResult.Equals(DialogResult.OK))
            {
                /* 临时保存工作目录,防止回退 */
                string         tempPath     = cloudDiskForm.Current_Path;
                Stack <string> backStack    = cloudDiskForm.BackStack;
                Stack <string> forwardStack = cloudDiskForm.ForwardStack;
                cloudDiskForm.updateFileTree();
                FileTree fileTree = cloudDiskForm.File_Tree;


                cloudDiskForm          = new CloudDiskForm(this, null);
                cloudDiskForm.TopLevel = false;
                panel_mainForm.Controls.RemoveByKey(cloudDiskForm.Name);

                cloudDiskForm.BackStack    = backStack;
                cloudDiskForm.ForwardStack = forwardStack;
                cloudDiskForm.Current_Path = tempPath;
                cloudDiskForm.setUserInfo(userInfo);


                panel_mainForm.Controls.Add(cloudDiskForm);
                cloudDiskForm.Show();
                /* 还原目录树的展开状态 */
                cloudDiskForm.File_Tree = fileTree;
                cloudDiskForm.updateDirectoryTree();
            }
            //settingForm.Show();
            //this.Enabled = false;
        }