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(); } }
public override bool Action() { bool isSuccess = false; NewItemCount = 0; try { ApplicationConfig appconfig = IOHelper.LoadIsolatedData(); string json = WebTools.Download(string.Format("{0}&{1}={2}", appconfig.GetBugUrl, 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["bugs"] != null) { JArray jsArray = (JArray)JsonConvert.DeserializeObject(jsObj["bugs"].ToString()); foreach (var j in jsArray) { BugItem bi = new BugItem() { priority = j["pri"].Value <string>() , Severity = j["severity"].Value <string>() , ID = j["id"].Value <int>() , Title = Util.EscapeXmlTag(j["title"].Value <string>()) , OpenDate = j["openedDate"].Value <string>() , LastEdit = j["lastEditedDate"].Value <string>() , Tip = "Bug" }; 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.Bug, NewItemCount); } } isSuccess = true; ItemCollectionBackup.Clear(); } } } catch (Exception exp) { logger.Error(string.Format("GetBug Error: {0}", exp.ToString())); } return(isSuccess); }
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.GetUnclosedBugUrl, 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["bugs"] != null) { JArray jsArray = (JArray)JsonConvert.DeserializeObject(jsObj["bugs"].ToString()); foreach (var j in jsArray) { //unclosedBug 显示未关闭 if (j["status"].Value <string>() != "closed")//&& j["status"].Value<string>() != "resolved" { BugItem bi = new BugItem() { Priority = Convert.Pri(j["pri"].Value <string>()) , Severity = Convert.Severity(j["severity"].Value <string>()) , ID = j["id"].Value <int>() , Title = Util.EscapeXmlTag(j["title"].Value <string>()) , OpenDate = j["openedDate"].Value <string>() , LastEdit = j["lastEditedDate"].Value <string>() , Tip = "未关闭的Bug" , Confirmed = Convert.Confirmed(j["confirmed"].Value <string>()) , Resolution = Convert.Resolution(j["resolution"].Value <string>()) }; 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("GetUnclosedBug Error: {0}", exp.ToString())); } return(isSuccess); }