Beispiel #1
0
        private void Label_MouseUp(object sender, MouseButtonEventArgs e)
        {
            //鼠标中键点击,打开searh窗口
            if (e.ChangedButton == MouseButton.Middle && e.MiddleButton == MouseButtonState.Released)
            {
                ItemBase ib = null;
                Label    lb = sender as Label;
                switch (lb.Name)
                {
                case "lbBugCount":
                    ib = new BugItem();
                    break;

                case "lbTaskCount":
                    ib = new TaskItem();
                    break;

                case "lbStoryCount":
                    ib = new StoryItem();
                    break;

                default:
                    break;
                }

                SearchItem si = new SearchItem(ib);
                si.Top  = this.Top;
                si.Left = this.Left + this.ActualWidth;
                si.ShowDialog();
            }
        }
Beispiel #2
0
        public override bool Action()
        {
            bool isSuccess = false;

            NewItemCount = 0;

            List <int> productIds = GetProductId();

            string[] jsonList = new string[productIds.Count];

            try
            {
                ApplicationConfig appconfig = IOHelper.LoadIsolatedData();

                for (int i = 0; i < productIds.Count; i++)
                {
                    string json = string.Format(appconfig.GetUnclosedStoryUrl, productIds[i]);
                    json = WebTools.Download(string.Format("{0}&{1}={2}", json, SessionName, SessionID));

                    jsonList[i] = json;
                }

                bool isNewJson = IsNewJson(string.Concat(jsonList));

                if (!isNewJson)
                {
                    return(true);
                }

                ItemCollectionBackup.AddRange(itemsList.Select(f => f.ID));
                itemsList.Clear();

                foreach (string strjson in jsonList)
                {
                    string json = strjson;

                    if (!string.IsNullOrEmpty(json) && isNewJson)
                    {
                        var jsObj = JsonConvert.DeserializeObject(json) as JObject;

                        if (jsObj != null && jsObj["status"].Value <string>() == "success")
                        {
                            json = jsObj["data"].Value <string>();

                            jsObj = JsonConvert.DeserializeObject(json) as JObject;

                            if (jsObj["stories"] != null)
                            {
                                JArray jsArray = (JArray)JsonConvert.DeserializeObject(jsObj["stories"].ToString());

                                foreach (var j in jsArray)
                                {
                                    //unclosedStory 显示未关闭
                                    if (j["status"].Value <string>() != "closed" && j["status"].Value <string>() != "resolved")
                                    {
                                        StoryItem bi = new StoryItem()
                                        {
                                            Priority = Convert.Pri(j["pri"].Value <string>())
                                            ,
                                            ID = j["id"].Value <int>()
                                            ,
                                            Title = Util.EscapeXmlTag(j["title"].Value <string>())
                                            ,
                                            OpenDate = j["openedDate"].Value <string>()
                                            ,
                                            Stage = Convert.Stage(j["stage"].Value <string>())
                                            ,
                                            Tip = "未关闭的全部需求"
                                        };

                                        if (!ItemCollectionBackup.Contains(bi.ID))
                                        {
                                            NewItemCount = NewItemCount == 0 ? bi.ID : (NewItemCount > 0 ? -2 : NewItemCount - 1);
                                        }

                                        itemsList.Add(bi);
                                    }
                                }
                            }
                            isSuccess = true;
                        }
                    }
                }

                if (OnNewItemArrive != null &&
                    NewItemCount != 0)
                {
                    OnNewItemArrive(ItemType.Bug, NewItemCount);
                }

                ItemCollectionBackup.Clear();
            }
            catch (Exception exp)
            {
                logger.Error(string.Format("GetUnclosedStory Error: {0}", exp.ToString()));
            }

            return(isSuccess);
        }
Beispiel #3
0
        public override bool Action()
        {
            bool isSuccess = false;

            NewItemCount = 0;

            try
            {
                ApplicationConfig appconfig = IOHelper.LoadIsolatedData();

                string json = WebTools.Download(string.Format("{0}&{1}={2}", appconfig.GetStoryUrl, SessionName, SessionID));

                if (!string.IsNullOrEmpty(json) && IsNewJson(json))
                {
                    ItemCollectionBackup.AddRange(itemsList.Select(f => f.ID));
                    itemsList.Clear();

                    var jsObj = JsonConvert.DeserializeObject(json) as JObject;

                    if (jsObj != null && jsObj["status"].Value <string>() == "success")
                    {
                        json = jsObj["data"].Value <string>();

                        jsObj = JsonConvert.DeserializeObject(json) as JObject;

                        if (jsObj["stories"] != null)
                        {
                            JArray jsArray = (JArray)JsonConvert.DeserializeObject(jsObj["stories"].ToString());

                            foreach (var j in jsArray)
                            {
                                StoryItem bi = new StoryItem()
                                {
                                    Priority = j["pri"].Value <string>()
                                    ,
                                    ID = j["id"].Value <int>()
                                    ,
                                    Title = Util.EscapeXmlTag(j["title"].Value <string>())
                                    ,
                                    OpenDate = j["openedDate"].Value <string>()
                                    ,
                                    Stage = ConvertStage(j["stage"].Value <string>())
                                    ,
                                    Tip = "需求"
                                };

                                if (!ItemCollectionBackup.Contains(bi.ID))
                                {
                                    NewItemCount = NewItemCount == 0 ? bi.ID : (NewItemCount > 0 ? -2 : NewItemCount - 1);
                                }

                                itemsList.Add(bi);
                            }

                            if (OnNewItemArrive != null &&
                                NewItemCount != 0)
                            {
                                OnNewItemArrive(ItemType.Story, NewItemCount);
                            }
                        }

                        isSuccess = true;

                        ItemCollectionBackup.Clear();
                    }
                }
            }
            catch (Exception exp)
            {
                logger.Error(string.Format("GetBug Error: {0}", exp.ToString()));
            }

            return(isSuccess);
        }