Example #1
0
        /// <summary>
        /// 当点击[提交]按钮的时候
        /// </summary>
        public void ClickSubmitButton()
        {
            /* 如果输入框的文字为空,就返回 */
            if ((this.UiControl.InputBoxText == null || this.UiControl.InputBoxText == "") &&
                (this.UiControl.InputBoxImagePaths == null || this.UiControl.InputBoxImagePaths.Count <= 0))
            {
                return;
            }

            //修改标识符
            isSubmit = true;

            //显示[省略号]
            UiControl.IsShowSubmitButtonAnimation = true;

            //获取相关的数据
            BugData _bugData = AppManager.Datas.OtherData.ShowBugItemData.Data;
            string  _content = UiControl.InputBoxText;
            ObservableCollection <string> _images = UiControl.InputBoxImagePaths;

            //创建数据
            AppManager.Systems.RecordSystem.AddRecord(_bugData, _content, _images);

            //删除所有的数据
            UiControl.InputBoxText       = "";
            UiControl.InputBoxImagePaths = new ObservableCollection <string>();
            UiControl.RecordInputBoxControl.UpdateImageCurrentNumber();

            //把ListBox的滚动条设置到最下面
            UiControl.RecordListBoxScrollToEnd();

            //修改Bug的更新次数
            AppManager.Systems.BugSystem.SetUpdateNumber(_bugData);
            AppManager.Systems.BugSystem.SaveBug(AppManager.Systems.CollaborationSystem.ModeType, _bugData.Id);
        }
        /// <summary>
        /// 把[Data对象]转换为[BaseData对象]
        /// </summary>
        /// <param name="_data">要转换的Data对象</param>
        /// <returns>转换后的BaseData对象</returns>
        public static BugBaseData DataToBaseData(BugData _data)
        {
            if (_data != null)
            {
                BugBaseData _baseData = new BugBaseData();

                _baseData.Id         = _data.Id;
                _baseData.Name       = _data.Name.Text;
                _baseData.Progress   = (int)_data.Progress;
                _baseData.Priority   = (int)_data.Priority;
                _baseData.CreateTime = new List <int>()
                {
                    _data.CreateTime.Year, _data.CreateTime.Month, _data.CreateTime.Day, _data.CreateTime.Hour, _data.CreateTime.Minute, _data.CreateTime.Second
                };
                _baseData.SolveTime = new List <int>()
                {
                    _data.SolveTime.Year, _data.SolveTime.Month, _data.SolveTime.Day, _data.SolveTime.Hour, _data.SolveTime.Minute, _data.SolveTime.Second
                };
                _baseData.UpdateTime = new List <int>()
                {
                    _data.UpdateTime.Year, _data.UpdateTime.Month, _data.UpdateTime.Day, _data.UpdateTime.Hour, _data.UpdateTime.Minute, _data.UpdateTime.Second
                };
                _baseData.UpdateNumber  = _data.UpdateNumber;
                _baseData.TemperamentId = _data.TemperamentId;
                _baseData.IsDelete      = _data.IsDelete;

                return(_baseData);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 过滤
        /// (根据搜索文字,过滤Bug)
        /// </summary>
        /// <param name="_searchText">搜索的文字</param>
        /// <returns>过滤后的Bugs</returns>
        private ObservableCollection <BugData> Filter(string _searchText)
        {
            //获取到排序过后的[Bug数据]
            ObservableCollection <BugData> _sortBugDatas = AppManager.Systems.SortSystem.SortBugDatas;


            //如果没有[搜索文字]
            if (_searchText == null || _searchText == "")
            {
                if (_sortBugDatas != null)
                {
                    for (int i = 0; i < _sortBugDatas.Count; i++)
                    {
                        if (_sortBugDatas[i] != null)
                        {
                            //让文字不高亮
                            _sortBugDatas[i].Name.Highlight = "";
                        }
                    }

                    return(_sortBugDatas);
                }

                else
                {
                    return(new ObservableCollection <BugData>());
                }
            }

            //如果有[搜索文字]
            else
            {
                //把_searchText改为小写
                string _newSearchText = _searchText.ToLower();//把字符串str中的所有字符转换为小写

                //容器:所有搜索到的相关的Bug
                ObservableCollection <BugData> _searchBugDatas = new ObservableCollection <BugData>();

                //进行过滤
                if (_sortBugDatas != null)
                {
                    for (int i = 0; i < _sortBugDatas.Count; i++)
                    {
                        //取到Bug
                        BugData _bugData = _sortBugDatas[i];

                        //把BugName改为小写
                        string _newBugName = _bugData.Name.Text.ToLower();//把字符串str中的所有字符转换为小写

                        if (_newBugName.Contains(_newSearchText) == true)
                        {
                            _bugData.Name.Highlight = _searchText; //更改高亮
                            _searchBugDatas.Add(_bugData);         //加入集合中
                        }
                    }
                }

                return(_searchBugDatas);
            }
        }
Example #4
0
        /// <summary>
        /// 修改Bug
        /// </summary>
        /// <param name="_bugData">要修改的Bug数据</param>
        /// <param name="_oldName">旧的名字</param>
        /// <param name="_newName">新的名字</param>
        /// <param name="_oldProgress">旧的进度</param>
        /// <param name="_newProgress">新的进度</param>
        /// <param name="_oldPriority">旧的优先级</param>
        /// <param name="_newPriority">新的优先级</param>
        public void ChangeBug(BugData _bugData,
                              string _oldName, string _newName,
                              ProgressType _oldProgress, ProgressType _newProgress,
                              PriorityType _oldPriority, PriorityType _newPriority)
        {
            /* 判断是否有改变 */
            if (_oldName == _newName && _oldProgress == _newProgress && _oldPriority == _newPriority)
            {
                return;
            }


            /* 如果有改变,就修改数据 */
            if (_bugData != null)
            {
                //修改数据
                _bugData.Name.Text = _newName;
                _bugData.Progress  = _newProgress;
                _bugData.Priority  = _newPriority;

                //触发[完成度改变]的方法
                if (_oldProgress != _newProgress)
                {
                    OnChangeBugProgress(_bugData);
                }

                //修改Bug
                ChangeBug(_bugData);
            }
        }
        /// <summary>
        /// 获取[页码]
        /// (根据BugData,获取Bug所在的页面)
        /// </summary>
        /// <param name="_bugData">跳转到哪个Bug所在的页面?</param>
        /// <returns>Bug所在的页面(从1开始)(如果这个Bug不存在,就返回-1)</returns>
        public int GetPageNumber(BugData _bugData)
        {
            int _pageNumber = -1;//bug所在的页数(从1开始)


            if (_bugData != null)
            {
                //获取到过滤后的文字
                ObservableCollection <BugData> _filterBugDatas = AppManager.Systems.SearchSystem.FilterBugDatas;

                //然后,查找到Bug所在的索引
                int _bugIndex = -1;//bug的索引(从0开始)
                if (_filterBugDatas != null)
                {
                    for (int i = 0; i < _filterBugDatas.Count; i++)
                    {
                        if (_filterBugDatas[i].Id == _bugData.Id)
                        {
                            _bugIndex = i;
                            break;
                        }
                    }
                }

                //查找到Bug所在的页数
                if (_bugIndex > -1)
                {
                    _pageNumber = (_bugIndex / ShowBugNumber) + 1;
                }
            }


            //返回值
            return(_pageNumber);
        }
Example #6
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);
                }
            }
        }
Example #7
0
        /// <summary>
        /// 修改Bug
        /// </summary>
        /// <param name="_bugData">要修改的Bug数据</param>
        public void ChangeBug(BugData _bugData)
        {
            if (_bugData != null)
            {
                //修改Bug
                SetUpdateNumber(_bugData);

                //重新获取Bug的个数
                AppManager.Systems.BugSystem.CalculatedBugsNumber();

                //重新排序
                AppManager.Systems.SortSystem.Sort();

                //重新过滤
                AppManager.Systems.SearchSystem.Filter();

                //获取到Bug的新页码
                int _pageNumber = AppManager.Systems.PageSytem.GetPageNumber(_bugData);

                //显示跳转的页码
                _bugData.ItemData.GoToPageNumber = _pageNumber;

                //保存Bug文件
                this.SaveBug(AppManager.Datas.ProjectData.ModeType, _bugData.Id);
            }
        }
        /// <summary>
        /// 把[BaseData对象]转换为[Data对象]
        /// </summary>
        /// <param name="_baseData">要转换的BaseData对象</param>
        /// <returns>转换后的Data对象</returns>
        public static BugData BaseDataToData(BugBaseData _baseData)
        {
            if (_baseData != null)
            {
                BugData _data = new BugData();

                _data.Id   = _baseData.Id;
                _data.Name = new HighlightText()
                {
                    Text = _baseData.Name, Highlight = ""
                };
                _data.Progress      = (ProgressType)_baseData.Progress;
                _data.Priority      = (PriorityType)_baseData.Priority;
                _data.CreateTime    = new DateTime(_baseData.CreateTime[0], _baseData.CreateTime[1], _baseData.CreateTime[2], _baseData.CreateTime[3], _baseData.CreateTime[4], _baseData.CreateTime[5]);
                _data.SolveTime     = new DateTime(_baseData.SolveTime[0], _baseData.SolveTime[1], _baseData.SolveTime[2], _baseData.SolveTime[3], _baseData.SolveTime[4], _baseData.SolveTime[5]);
                _data.UpdateTime    = new DateTime(_baseData.UpdateTime[0], _baseData.UpdateTime[1], _baseData.UpdateTime[2], _baseData.UpdateTime[3], _baseData.UpdateTime[4], _baseData.UpdateTime[5]);
                _data.UpdateNumber  = _baseData.UpdateNumber;
                _data.TemperamentId = _baseData.TemperamentId;
                _data.IsDelete      = _baseData.IsDelete;

                return(_data);
            }
            else
            {
                return(null);
            }
        }
Example #9
0
        /// <summary>
        /// 复制一个BugData对象
        /// </summary>
        /// <param name="_bugData">要复制哪个?</param>
        /// <returns>复制出来的BugData对象</returns>
        public static BugData Copy(BugData _bugData)
        {
            if (_bugData == null)
            {
                return(null);
            }

            else
            {
                BugData _copyBugData = new BugData();

                _copyBugData.Id            = _bugData.Id;
                _copyBugData.Name          = _bugData.Name;
                _copyBugData.Progress      = _bugData.Progress;
                _copyBugData.Priority      = _bugData.Priority;
                _copyBugData.CreateTime    = _bugData.CreateTime;
                _copyBugData.SolveTime     = _bugData.SolveTime;
                _copyBugData.UpdateTime    = _bugData.UpdateTime;
                _copyBugData.UpdateNumber  = _bugData.UpdateNumber;
                _copyBugData.TemperamentId = _bugData.TemperamentId;
                _copyBugData.IsDelete      = _bugData.IsDelete;

                return(_copyBugData);
            }
        }
Example #10
0
        /// <summary>
        /// 当点击Bug的[跳转页面]按钮时
        /// </summary>
        /// <param name="_source">触发这个事件的Bug控件(Tag属性里有BugData)</param>
        public void ClickGoToPageButtonInBug(BugListItemControl _source)
        {
            //获取Bug数据
            BugItemData _bugItemData = _source.Tag as BugItemData;
            BugData     _bugData     = _bugItemData.Data;

            //跳转到Bug所在的页面,并选中Bug
            AppManager.Systems.PageSytem.Turn(_bugData);
        }
Example #11
0
        /// <summary>
        /// 当点击右键菜单中的[优先级Type]的 某一个Check时
        /// </summary>
        /// <param name="_source">触发这个事件的Bug控件(Tag属性里有BugData)</param>
        public void ClickPriorityTypeButtonInBugContextMenu(BugListItemControl _source)
        {
            //获取Bug数据
            BugItemData _bugItemData = _source.Tag as BugItemData;
            BugData     _bugData     = _bugItemData.Data;

            //通知Bug已经修改
            AppManager.Systems.BugSystem.ChangeBug(_bugData);
        }
Example #12
0
        /// <summary>
        /// 当点击Bug的[进度]按钮时
        /// </summary>
        /// <param name="_source">触发这个事件的Bug控件(Tag属性里有BugData)</param>
        public void ClickProgressButtonInBug(BugListItemControl _source)
        {
            //获取Bug数据
            BugItemData _bugItemData = _source.Tag as BugItemData;
            BugData     _bugData     = _bugItemData.Data;

            //打开Bug界面
            AppManager.Uis.ChangeBugUi.UiControl.BugData = _bugData;
            AppManager.Uis.ChangeBugUi.OpenOrClose(true);
        }
Example #13
0
        /// <summary>
        /// 删除记录
        /// (删除1个Bug中的所有记录)
        /// </summary>
        public void RemoveRecords(BugData _bugData)
        {
            //获取到Bug相关的所有记录数据
            ObservableCollection <RecordData> _recordDatas = GetRecordDatas(_bugData.Id);

            //然后删除这些记录数据
            for (int i = 0; i < _recordDatas.Count; i++)
            {
                RemoveRecord(_recordDatas[i]);
            }
        }
Example #14
0
        /// <summary>
        /// 当点击ListTip中的[查看]按钮
        /// </summary>
        public void ClickLookButtonInListTip()
        {
            //取到Tip中的BugData
            BugData _bugData = UiControl.ListTipControl.BugData;

            //关闭Tip
            UiControl.OpenOrCloseListTip(false, null);

            //跳转到Bug所在的页面
            AppManager.Systems.PageSytem.Turn(_bugData);
        }
Example #15
0
 /// <summary>
 /// 当改变Bug的完成度时
 /// </summary>
 /// <param name="_bugData">Bug的数据</param>
 public void OnChangeBugProgress(BugData _bugData)
 {
     //如果是[完成]
     if (_bugData.Progress == ProgressType.Solved)
     {
         _bugData.SolveTime = DateTime.UtcNow;
     }
     else
     {
         _bugData.SolveTime = DateTime.MinValue;
     }
 }
Example #16
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 #17
0
 /// <summary>
 /// 获取Bug的数据
 /// (通过记录,获取记录所在的Bug数据)
 /// </summary>
 /// <param name="_recordData">记录的数据</param>
 /// <returns>记录所在的Bug数据</returns>
 public BugData GetBugData(RecordData _recordData)
 {
     if (_recordData != null)
     {
         //根据记录,获取Bug
         BugData _bugData = GetBugData(_recordData.BugId);
         return(_bugData);
     }
     else
     {
         return(null);
     }
 }
        /// <summary>
        /// 翻到[某一页]
        /// (根据BugData,跳转页面)
        /// </summary>
        /// <param name="_bugData">跳转到哪个Bug所在的页面?</param>
        public void Turn(BugData _bugData)
        {
            //清空[搜索的文字]
            AppManager.Systems.SearchSystem.ClearSearchText();

            //取到Bug所在的页码
            int _pageNumber = GetPageNumber(_bugData);

            //跳转到Bug所在页
            Turn(_pageNumber);

            //然后选中Bug
            AppManager.Uis.ListUi.UiControl.SelectedBugIndex = GetBugIndexInCurrentPage(_bugData);
        }
Example #19
0
        /// <summary>
        /// 当[是否显示Bug的回复?]改变时
        /// </summary>
        /// <param name="_oldValue">旧的值</param>
        /// <param name="_newValue">新的值</param>
        public void IsShowBugReplyChange(bool _oldValue, bool _newValue)
        {
            if (AppManager.Datas.OtherData.ShowBugItemData != null)
            {
                //获取当前Bug
                BugData _bugData = AppManager.Datas.OtherData.ShowBugItemData.Data;

                //赋值Bug里的ShowRecords属性
                AppManager.Systems.RecordSystem.SetShowRecords(_bugData, AppManager.Systems.RecordSystem.IsShowBugReply);

                //把ListBox的滚动条设置到最下面
                UiControl.RecordListBoxScrollToEnd();
            }
        }
Example #20
0
 /// <summary>
 /// 设置ShowRecords属性
 /// (设置OtherData.ShowRecords属性)
 /// </summary>
 /// <param name="_bugData">要显示哪个Bug中的记录?</param>
 /// <param name="_isHaveBug">是否包含Bug?(如果为true,表示要显示Bug说的话,也要显示Bear说的话;如果为false,表示只显示Bear说的话)</param>
 public void SetShowRecords(BugData _bugData, bool _isHaveBug = true)
 {
     /*赋值ShowRecords属性*/
     //如果[Bug说的话]和[Bear说的话]都要显示
     if (_isHaveBug == true)
     {
         SetShowRecords(_bugData, ShowBugRecordType.All);
     }
     //如果只显示[Bear说的话]
     else
     {
         SetShowRecords(_bugData, ShowBugRecordType.One);
     }
 }
Example #21
0
 /// <summary>
 /// 验证完整性
 /// (验证1个Bug的完整性。
 /// 如果Bug是完整的,代表这个Bug是有效的;
 /// 如果Bug是不完整的,代表Bug文件还没有同步完,或者是Bug文件已损坏)
 /// </summary>
 /// <param name="_bugData">要验证的Bug</param>
 /// <returns>Bug是否是完整的</returns>
 public static bool VerifyIntegrity(BugData _bugData)
 {
     if (_bugData == null ||
         _bugData.Id < 0 ||
         _bugData.Priority == PriorityType.None ||
         _bugData.Progress == ProgressType.None ||
         _bugData.TemperamentId < 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Example #22
0
        /// <summary>
        /// 保存一个Bug
        /// </summary>
        /// <param name="_modeType">项目模式的类型</param>
        /// <param name="_bugId">要保存的Bug的编号</param>
        public void SaveBug(ModeType _modeType, long _bugId)
        {
            /* 保存 */
            try
            {
                //判断项目的模式
                switch (_modeType)
                {
                //如果项目是[默认模式]:把所有的Bug,保存到/Bug/Bugs.json文件中
                case ModeType.Default:
                    SaveBugs(ModeType.Default);
                    break;



                //如果项目是[协同合作模式]:把每一个Bug,分别保存到/Bug/Bug - 20200119080230555.json文件中
                case ModeType.Collaboration:
                    //通过Id取到Bug
                    BugData _bugData = GetBugData(_bugId);

                    if (_bugData != null)
                    {
                        //把BugData转换为BugBaseData
                        BugBaseData _bugBaseData = BugBaseData.DataToBaseData(_bugData);

                        //把BugBaseData转换为json
                        string _bugJsonText = JsonMapper.ToJson(_bugBaseData);

                        //Bug文件的路径(文件夹+文件名+后缀)
                        string _bugFilePath = BugFolderPath + "/Bug - " + _bugBaseData.Id + AppManager.Systems.ProjectSystem.OtherFileSuffix;

                        //把json文件保存到[Bug - BugId.json]文件里
                        File.WriteAllText(_bugFilePath, _bugJsonText, Encoding.Default);
                    }
                    break;
                }
            }

            /* 如果有错误,就输出错误 */
            catch (Exception e)
            {
                //输出错误
                AppManager.Uis.ErrorUi.UiControl.TipContent = e.ToString();
                AppManager.Uis.ErrorUi.OpenOrClose(true);
            }
        }
Example #23
0
        /// <summary>
        /// 当点击Bug的[更多]按钮时
        /// </summary>
        /// <param name="_source">触发这个事件的Bug控件(Tag属性里有BugData)</param>
        public void ClickMoreButtonInBug(BugListItemControl _source)
        {
            //获取Bug数据
            BugItemData _bugItemData = _source.Tag as BugItemData;
            BugData     _bugData     = _bugItemData.Data;


            //更新Bug的[显示数据]
            AppManager.Datas.OtherData.ShowBugItemData = _bugItemData;
            //更新Bug的[显示记录]
            AppManager.Systems.RecordSystem.SetShowRecords(_bugData, AppManager.Datas.OtherData.IsShowBugReply);


            //打开Bug界面
            this.OpenOrClose(false);
            AppManager.Uis.BugUi.OpenOrClose(true);
        }
Example #24
0
        /// <summary>
        /// 比较2个Bug数据
        /// </summary>
        /// <param name="_compareType">是比较所有的属性,还是只比较编号?</param>
        /// <param name="_bugData1">第1个Bug数据</param>
        /// <param name="_bugData2">第2个Bug数据</param>
        /// <returns>2个Bug数据是否相同?</returns>
        public static bool Compare(CompareType _compareType, BugData _bugData1, BugData _bugData2)
        {
            if (_bugData1 == null || _bugData2 == null)
            {
                return(false);
            }



            //是否相同?
            bool _isSame = false;

            //比较
            switch (_compareType)
            {
            case CompareType.Id:
                if (_bugData1.Id == _bugData2.Id)
                {
                    _isSame = true;
                }
                else
                {
                    _isSame = false;
                }
                break;

            case CompareType.All:
                if (_bugData1.Id == _bugData2.Id && _bugData1.Name.Text == _bugData2.Name.Text &&
                    _bugData1.Progress == _bugData2.Progress && _bugData1.Priority == _bugData2.Priority &&
                    _bugData1.CreateTime == _bugData2.CreateTime && _bugData1.SolveTime == _bugData2.SolveTime &&
                    _bugData1.UpdateTime == _bugData2.UpdateTime && _bugData1.UpdateNumber == _bugData2.UpdateNumber &&
                    _bugData1.IsDelete == _bugData2.IsDelete)
                {
                    _isSame = true;
                }
                else
                {
                    _isSame = false;
                }
                break;
            }


            //返回值
            return(_isSame);
        }
Example #25
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 #26
0
        /// <summary>
        /// 添加Bug
        /// </summary>
        /// <param name="_name">Bug的名字</param>
        /// <param name="_priority">Bug的优先级</param>
        public void AddBug(string _name, PriorityType _priority)
        {
            //创建一个Bug
            BugData _bugData = new BugData();

            _bugData.Id   = DateTimeTool.DateTimeToLong(DateTime.UtcNow, TimeFormatType.YearMonthDayHourMinuteSecondMillisecond);
            _bugData.Name = new HighlightText()
            {
                Text = _name
            };
            _bugData.Progress      = ProgressType.Undone;
            _bugData.Priority      = _priority;
            _bugData.CreateTime    = DateTime.UtcNow;
            _bugData.UpdateTime    = DateTime.UtcNow;
            _bugData.TemperamentId = 0;

            //把Bug添加到BugDatas中
            BugDatas.Add(_bugData);

            //重新获取Bug的个数+页数
            AppManager.Systems.BugSystem.CalculatedBugsNumber();
            AppManager.Systems.PageSytem.CalculatedPagesNumber();

            //重新排序
            AppManager.Systems.SortSystem.Sort();

            //重新过滤
            AppManager.Systems.SearchSystem.Filter();

            //重新计算页数
            AppManager.Systems.PageSytem.CalculatedPagesNumber();

            //显示Bug到当前页面
            AppManager.Systems.PageSytem.Insert(_bugData);

            //显示ListBug的Tip
            AppManager.Uis.ListUi.UiControl.OpenOrCloseListTip(true, true, _bugData);

            //保存Bug文件
            this.SaveBug(AppManager.Datas.ProjectData.ModeType, _bugData.Id);
        }
Example #27
0
        /// <summary>
        /// 当点击[确认]按钮时
        /// </summary>
        public void ClickYesButton()
        {
            /* 如果Bug名为null */
            if (UiControl.BugName == null || UiControl.BugName == "")
            {
                //显示提示
                UiControl.TipString = AppManager.Systems.LanguageSystem.NoBugNameTip;
                return;
            }

            /* 如果填写了BugName,就修改Bug */
            BugData _bugData = UiControl.BugData;

            AppManager.Systems.BugSystem.ChangeBug(_bugData,
                                                   _bugData.Name.Text, UiControl.BugName,
                                                   _bugData.Progress, UiControl.ProgressType,
                                                   _bugData.Priority, UiControl.PriorityType);

            /* 关闭此界面,关闭MainUi,打开ListUi */
            this.OpenOrClose(false);
        }
Example #28
0
        /// <summary>
        /// 添加记录
        /// (往Bug中,添加1条记录)
        /// </summary>
        /// <param name="_bugData">对哪个BugData进行操作?</param>
        /// <param name="_content">记录的内容</param>
        /// <param name="_images">图片的路径</param>
        public void AddRecord(BugData _bugData, string _content, ObservableCollection <string> _images = null)
        {
            /* 创建记录 */
            //创建记录数据
            RecordData _recordData = new RecordData();

            _recordData.Id      = DateTimeTool.DateTimeToLong(DateTime.UtcNow, TimeFormatType.YearMonthDayHourMinuteSecondMillisecond);
            _recordData.BugId   = _bugData.Id;
            _recordData.Content = _content;
            _recordData.Time    = DateTime.UtcNow;

            //添加到Record数据中
            AppManager.Datas.ProjectData.RecordDatas.Add(_recordData);

            //保存图片
            if (_images != null)
            {
                //遍历所有的图片
                for (int i = 0; i < _images.Count; i++)
                {
                    //保存图片(赋值图片)
                    AppManager.Systems.ImageSystem.AddImageFile(_recordData.Id, _images[i]);
                }
            }

            //赋值Bug里的ShowRecords属性
            AppManager.Systems.RecordSystem.SetShowRecords(_bugData, AppManager.Datas.OtherData.IsShowBugReply);



            /* 回复记录 (当Bear说话后,Bug需要回复一句话) */
            _recordData.ReplyId = AppManager.Systems.TemperamentSystem.RandomReply(_bugData.TemperamentId);//随机1个回复



            /* 保存记录 */
            SaveRecord(AppManager.Systems.CollaborationSystem.ModeType, _recordData.Id);
        }
Example #29
0
        /// <summary>
        /// 比较[旧Bug]和[新Bug]
        /// (看下新Bug相对旧Bug来说,进行了哪些修改?)
        /// </summary>
        /// <param name="_oldBugData">旧的Bug</param>
        /// <param name="_newBugData">新的Bug</param>
        /// <returns>修改了什么?</returns>
        public ChangeType CompareOldBugAndNewBug(BugData _oldBugData, BugData _newBugData)
        {
            /* [新建Bug] :
             * 第一种情况:Old为空,New不为空
             * 第二种情况:Old不为空,New不为空,Old已删除,New未删除*/
            if ((_oldBugData == null && _newBugData != null && _newBugData.IsDelete != true) ||
                (_oldBugData != null && _newBugData != null && _oldBugData.IsDelete == true && _newBugData.IsDelete != true))
            {
                return(ChangeType.Add);
            }


            /* [删除Bug] :
             * 第一种情况:Old不为空,并且New为空
             * 第二种情况:Old不为空,并且Old不为true,并且New不为空,并且New为true*/
            else if ((_oldBugData != null && _newBugData == null && _oldBugData.IsDelete != true) ||
                     (_oldBugData != null && _newBugData != null && _oldBugData.IsDelete != true && _newBugData.IsDelete == true))
            {
                return(ChangeType.Delete);
            }


            /* [修改Bug] */
            else if (_oldBugData != null && _newBugData != null)
            {
                if (_oldBugData.Name.Text != _newBugData.Name.Text ||
                    _oldBugData.Progress != _newBugData.Progress ||
                    _oldBugData.Priority != _newBugData.Priority)
                {
                    return(ChangeType.Change);
                }
            }


            return(ChangeType.None);
        }
Example #30
0
        /// <summary>
        /// 删除Bug
        /// </summary>
        /// <param name="_bugData">要删除的Bug数据</param>
        public void DeleteBug(BugData _bugData)
        {
            if (_bugData != null)
            {
                //把这个Bug标记为删除
                _bugData.IsDelete = true;

                //重新获取Bug的个数+页数
                AppManager.Systems.BugSystem.CalculatedBugsNumber();
                AppManager.Systems.PageSytem.CalculatedPagesNumber();

                //重新排序
                AppManager.Systems.SortSystem.Sort();

                //重新过滤
                AppManager.Systems.SearchSystem.Filter();

                //重新计算页数
                AppManager.Systems.PageSytem.CalculatedPagesNumber();

                //刷新界面
                AppManager.Systems.PageSytem.Refresh();

                //显示ListBug
                AppManager.Uis.ListUi.UiControl.OpenOrCloseListTip(true, false);

                //保存Bug文件
                this.SaveBug(AppManager.Datas.ProjectData.ModeType, _bugData.Id);

                //删除Bug中的所有记录
                AppManager.Systems.RecordSystem.RemoveRecords(_bugData);

                //把这个Bug[从Datas中]删除
                BugDatas.Remove(_bugData);
            }
        }