Example #1
0
        /// <summary>
        /// 当点击[删除Bug]按钮时
        /// </summary>
        /// <param name="_source">触发这个事件的Bug控件(Tag属性里有BugData)</param>
        public void ClickDeleteBugButton(BugListItemControl _source)
        {
            //如果用户选择了Bug
            if (_source != null)
            {
                //取到BugData
                BugItemData _bugItemData = _source.Tag as BugItemData;
                BugData     _bugData     = _bugItemData.Data;

                //如果[还要提示]
                if (AppManager.Datas.AppData.IsNotAgainShowDeleteBugTip == false)
                {
                    //显示删除Bug界面
                    AppManager.Uis.DeleteBugTipUi.UiControl.Data = _bugData;
                    AppManager.Uis.DeleteBugTipUi.UiControl.Text = StringTool.Clamp(_bugData.Name.Text, 50);
                    AppManager.Uis.DeleteBugTipUi.OpenOrClose(true);
                }

                //如果[不再提示]
                else
                {
                    //直接删除Bug
                    AppManager.Systems.BugSystem.DeleteBug(_bugData);
                }
            }
        }
        /// <summary>
        /// 当点击[列表的Item]的[打开文件夹]按钮的时候
        /// </summary>
        /// <param name="_source">触发事件的LatelyProjectData对象</param>
        public void ClickListItemOpenFolderButton(LatelyProjectData _source)
        {
            //取到文件的信息
            FileInfo _fileInfo = new FileInfo(_source.Path);

            //如果文件存在
            if (_fileInfo.Exists == true)
            {
                //打开文件夹
                try
                {
                    System.Diagnostics.Process.Start(_fileInfo.Directory.FullName);//打开文件夹
                }
                catch (Exception e)
                {
                }
            }

            //如果文件不存在
            else
            {
                //提示:是否把这个数据从文件中移除?
                AppManager.Uis.LatelyProjectTipUi.UiControl.TipTitle   = AppManager.Systems.LanguageSystem.LatelyProjectTipTitle;
                AppManager.Uis.LatelyProjectTipUi.UiControl.TipContent = AppManager.Systems.LanguageSystem.LatelyProjectTipContent + "\n" +
                                                                         "\" " + StringTool.Clamp(_source.Name, 20) + " \"";

                //把数据传递给提示界面
                AppManager.Uis.LatelyProjectTipUi.UiControl.Tag = _source;

                //打开提示界面
                AppManager.Uis.LatelyProjectTipUi.OpenOrClose(true);
            }
        }
Example #3
0
        /// <summary>
        /// 获取[Bug]日志的文字
        /// (通过比较新Bug和旧Bug的区别,来生成日志的文字)
        /// </summary>
        /// <param name="_oldBugData">旧的Bug数据</param>
        /// <param name="_newBugData">新的Bug数据</param>
        /// <param name="_changeType">改变的类型</param>
        /// <returns>Bug的修改信息</returns>
        private string GenerateBugSyncLogText(BugData _oldBugData, BugData _newBugData, ChangeType _changeType)
        {
            //容器:Bug的日志
            string _log = "";


            //判断更改的类型
            switch (_changeType)
            {
            //如果是[新建Bug]
            case ChangeType.Add:
                //文字:创建 Bug: [XXXXXXXXX]
                if (_newBugData != null)
                {
                    _log = AddString + " " + BugString + ": [" + StringTool.Clamp(_newBugData.Name.Text, 25) + "]";
                }
                else if (_oldBugData != null)
                {
                    _log = AddString + " " + BugString + ": [" + StringTool.Clamp(_oldBugData.Name.Text, 25) + "]";
                }
                break;

            //如果是[删除Bug]
            case ChangeType.Delete:
                //文字:删除 Bug: [XXXXXXXXX]
                if (_newBugData != null)
                {
                    _log = DeleteString + " " + BugString + ": [" + StringTool.Clamp(_newBugData.Name.Text, 25) + "]";
                }
                else if (_oldBugData != null)
                {
                    _log = DeleteString + " " + BugString + ": [" + StringTool.Clamp(_oldBugData.Name.Text, 25) + "]";
                }
                break;

            //如果是[修改Bug]
            case ChangeType.Change:
                //文字:修改 Bug: [XXXXXXXXX]
                if (_newBugData != null)
                {
                    _log = ChangeString + " " + BugString + ": [" + StringTool.Clamp(_newBugData.Name.Text, 25) + "]";
                }
                else if (_oldBugData != null)
                {
                    _log = ChangeString + " " + BugString + ": [" + StringTool.Clamp(_oldBugData.Name.Text, 25) + "]";
                }
                break;
            }


            //返回值
            return(_log);
        }
Example #4
0
        /// <summary>
        /// 获取[Record]日志的文字
        /// (通过比较新Record和旧Record的区别,来生成日志的文字)
        /// </summary>
        /// <param name="_oldRecordData">旧的Record数据</param>
        /// <param name="_newRecordData">新的Record数据</param>
        /// <param name="_changeType">改变的类型</param>
        /// <returns>Record的修改信息</returns>
        private string GenerateRecordSyncLogText(RecordData _oldRecordData, RecordData _newRecordData, ChangeType _changeType)
        {
            //容器:Record的日志
            string _log = "";


            //取到Bug
            BugData _oldBugData = AppManager.Systems.BugSystem.GetBugData(_oldRecordData);
            BugData _newBugData = AppManager.Systems.BugSystem.GetBugData(_newRecordData);


            //判断是否有修改?
            switch (_changeType)
            {
            //如果是[新建Record]
            case ChangeType.Add:
                //文字:添加 聊天记录: [Bug:XXXXXXXXX]
                if (_newBugData != null)
                {
                    _log = AddString + " " + RecordString + ": [Bug:" + StringTool.Clamp(_newBugData.Name.Text, 25) + "]";
                }
                else if (_oldBugData != null)
                {
                    _log = AddString + " " + RecordString + ": [Bug:" + StringTool.Clamp(_oldBugData.Name.Text, 25) + "]";
                }
                break;

            //如果是[删除Record]
            case ChangeType.Delete:
                //文字:添加 聊天记录: [Bug:XXXXXXXXX]
                if (_newBugData != null)
                {
                    _log = DeleteString + " " + RecordString + ": [Bug:" + StringTool.Clamp(_newBugData.Name.Text, 25) + "]";
                }
                else if (_oldBugData != null)
                {
                    _log = DeleteString + " " + RecordString + ": [Bug:" + StringTool.Clamp(_oldBugData.Name.Text, 25) + "]";
                }
                break;
            }


            //返回值
            return(_log);
        }
Example #5
0
        /// <summary>
        /// 当点击[记录列表的Item]的[删除]按钮的时候
        /// </summary>
        /// <param name="_source">触发事件的RecordData对象</param>
        public void ClickRecordListItemDeleteButton(RecordData _source)
        {
            //如果用户选择了Bug
            if (_source != null)
            {
                //如果[还要提示]
                if (AppManager.Datas.AppData.IsNotAgainShowDeleteRecordTip == false)
                {
                    //显示删除Bug界面
                    AppManager.Uis.DeleteRecordTipUi.UiControl.Data = _source;
                    AppManager.Uis.DeleteRecordTipUi.UiControl.Text = StringTool.Clamp(_source.Content, 25);
                    AppManager.Uis.DeleteRecordTipUi.OpenOrClose(true);
                }

                //如果[不再提示]
                else
                {
                    //直接删除Bug
                    AppManager.Systems.RecordSystem.RemoveRecord(_source);
                }
            }
        }
        /// <summary>
        /// 当点击[列表的Item]的[Base]按钮的时候
        /// </summary>
        /// <param name="_source">触发事件的LatelyProjectData对象</param>
        public void ClickListItemBaseButton(LatelyProjectData _source)
        {
            //如果文件存在
            if (File.Exists(_source.Path) == true)
            {
                //读取项目
                AppManager.Uis.MainUi.LoadProjectAll(_source.Path);
            }

            //如果文件不存在
            else
            {
                //提示:是否把这个数据从文件中移除?
                AppManager.Uis.LatelyProjectTipUi.UiControl.TipTitle   = AppManager.Systems.LanguageSystem.LatelyProjectTipTitle;
                AppManager.Uis.LatelyProjectTipUi.UiControl.TipContent = AppManager.Systems.LanguageSystem.LatelyProjectTipContent + "\n" +
                                                                         "\" " + StringTool.Clamp(_source.Name, 20) + " \"";

                //把数据传递给提示界面
                AppManager.Uis.LatelyProjectTipUi.UiControl.Tag = _source;

                //打开提示界面
                AppManager.Uis.LatelyProjectTipUi.OpenOrClose(true);
            }
        }
Example #7
0
        /// <summary>
        /// 创建项目
        /// </summary>
        /// <param name="_chooseFolderPath">用户选择的路径</param>
        /// <param name="_projectName">项目的名字</param>
        /// <param name="_modeType">项目的模式</param>
        /// <returns>是否创建成功?</returns>
        public bool CreateProject(string _chooseFolderPath, string _projectName, ModeType _modeType)
        {
            try
            {
                /* 判断文件夹是否存在 */
                DirectoryInfo _directoryInfo = new DirectoryInfo(_chooseFolderPath);//文件夹的信息
                if (_directoryInfo.Exists == false)
                {
                    return(false);
                }



                /* 去除ProjectName中的非法字符:
                 *  文件夹和文件的 名字中,不能包含:? * : " < > \ / |
                 *  并且,不能以空格开头*/
                string _projectFileName = StringTool.RemoveInvaildChat(_projectName);

                /* 如果项目名为空格,或者是去除了违规字符后为空 */
                if (_projectFileName == null || _projectFileName == "")
                {
                    //设置新的文件名字
                    _projectFileName = "New Bugs";
                }

                /*判断是否有相同的文件夹*/
                //判断是否有相同的文件夹(返回值是一个唯一的文件夹【xxxx/文件夹 (1)/】)
                string _onlyFolderPath = FolderTool.AvoidSameFolder(_chooseFolderPath + "/" + _projectFileName);
                //取到文件夹的名字(这个文件夹不会和任何文件夹重名)
                DirectoryInfo _onlyFolderInfo = new DirectoryInfo(_onlyFolderPath);
                _projectFileName = _onlyFolderInfo.Name;



                /* Project数据 */
                //创建ProjectData对象
                ProjectData _projectData = new ProjectData();
                _projectData.Id       = DateTimeTool.DateTimeToLong(DateTime.UtcNow, TimeFormatType.YearMonthDayHourMinuteSecondMillisecond);
                _projectData.Name     = _projectName;
                _projectData.FileName = _projectFileName;
                _projectData.ModeType = _modeType;

                //修改ProjectData属性
                ProjectData = _projectData;

                //工程文件夹的路径
                ProjectFolderPath = _chooseFolderPath + "\\" + _projectFileName;



                /* 创建文件和文件夹 */
                //创建:[项目文件夹]、[Bug文件夹]、[记录文件夹]、[图片文件夹]、[备份文件夹]
                CreateFolders();
                //创建:[项目文件]、[Bug文件]
                CreateFiles();



                /* 保存Project数据 */
                bool _isSave = SaveProject();
                if (_isSave == false)
                {
                    return(false);
                }


                /* 打开协同合作功能 */
                AppManager.Systems.CollaborationSystem.Handle(true);


                return(true);
            }
            catch (Exception e)
            {
                //输出错误
                AppManager.Uis.ErrorUi.UiControl.TipContent = e.ToString();
                AppManager.Uis.ErrorUi.OpenOrClose(true);
                return(false);
            }
        }