private void AddResults(LabelResult r, int configId, string targetName, BazelContext.BazelLabel?other = null, int?otherId = null) { if (other == null) { r.ConfigCache.AddConfiguration( new BuildRequestConfiguration(configId, new BuildRequestData(r.Label.ToString(), new Dictionary <string, string>(), "Current", new [] { "build" }, null), "Current")); } if (other != null) { r.ConfigMap[configId] = other.ToString(); r.OriginalIds[configId] = otherId !.Value; } else { r.OriginalIds[configId] = configId; } var silly = new BuildResult(); silly.AddResultsForTarget(targetName, new TargetResult(Array.Empty <ProjectItemInstance.TaskItem>(), new WorkUnitResult())); var actual = new BuildResult(silly, -1, configId, -1, -1, -1); // whatever r.Results = r.Results.Append(actual).ToArray(); //.AddResult(actual); }
private void ResetValues() { LabelResult.SetText(""); ButtonScissors.SetBackgroundColor(UIColor.White); ButtonRock.SetBackgroundColor(UIColor.White); ButtonPaper.SetBackgroundColor(UIColor.White); LabelResult.SetTextColor(UIColor.Blue); }
/// <summary> /// 閉じる /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClose_Click(object sender, EventArgs e) { try { Result = LabelResult.Close; Close(); } catch (Exception ex) { CommonUtil.PutMessage(CommonEnums.MessageType.Error, ex.Message); } }
private void CheckMoves(Moves moveSelect) { ResetValues(); var random = new Random(); var position = random.Next(0, Options.Length); var machineChoose = Options[position]; Debug.WriteLine("Computador escolheu: " + machineChoose); if (machineChoose == moveSelect) { LabelResult.SetTextColor(UIColor.Orange); LabelResult.SetText(Results.EMPATE.ToString()); } else if (moveSelect == Moves.Rock && machineChoose == Moves.Scissors) { ButtonScissors.SetBackgroundColor(UIColor.Orange); LabelResult.SetText(Results.VITORIA.ToString()); } else if (moveSelect == Moves.Scissors && machineChoose == Moves.Paper) { ButtonPaper.SetBackgroundColor(UIColor.Orange); LabelResult.SetText(Results.VITORIA.ToString()); } else if (moveSelect == Moves.Paper && machineChoose == Moves.Rock) { ButtonRock.SetBackgroundColor(UIColor.Orange); LabelResult.SetText(Results.VITORIA.ToString()); } else { if (machineChoose == Moves.Rock) { ButtonRock.SetBackgroundColor(UIColor.Orange); } else if (machineChoose == Moves.Scissors) { ButtonScissors.SetBackgroundColor(UIColor.Orange); } else { ButtonPaper.SetBackgroundColor(UIColor.Orange); } // resultado LabelResult.SetTextColor(UIColor.Red); LabelResult.SetText(Results.PERDEU.ToString()); } }
private LabelResult Result(string name) { var r = new LabelResult { OriginalIds = new Dictionary <int, int>(), ConfigCache = new ConfigCache(), Results = Array.Empty <BuildResult>(), Label = new Label("wkspc", "pkg", name) }; _caches[r.Label.ToString()] = r; _cachesInOrder.Add(r); return(r); }
public async Task <List <GeneralReportResult> > GetGeneralReportResults() { // 1. Gather all cards // 2. Compute a card's start date // 3. Compute a card's completed date var results = new List <GeneralReportResult>(); var trelloLists = await this.GetTrelloLists(); var trelloLabels = await this.GetTrelloLabels(); var trelloMembers = await this.GetTrelloMembers(); var trelloCards = await this.GetAllTrelloCards(); var trelloCardMoveActions = await this.GetAllTrelloCardMoveActions(); var trelloCardCreatedActions = await this.GetAllTrelloCardCreateActions(); var trelloCardCopyActions = await this.GetAllTrelloCardCopyActions(); // Pre-sort trelloCardMoveActions .OrderBy(x => x.data.card) .ThenBy(x => x.date); // Step 1 foreach (var card in trelloCards) { var result = new GeneralReportResult(); result.CardId = card.id; result.CardTitle = card.name; result.CardCurrentListId = card.idList; result.CardCurrentListTitle = trelloLists.SingleOrDefault(x => x.id == card.idList)?.name; result.CardUrl = card.url; foreach (var labelId in card.idLabels) { var trelloLabel = trelloLabels.SingleOrDefault(x => x.id == labelId); if (trelloLabel != null) { var cardLabel = new LabelResult(); cardLabel.Id = trelloLabel.id; cardLabel.Name = trelloLabel.name; cardLabel.Color = trelloLabel.color; result.CardLabels.Add(cardLabel); } } foreach (var memberId in card.idMembers) { var trelloMember = trelloLabels.SingleOrDefault(x => x.id == memberId); result.CardMembers.Add ( trelloMembers.SingleOrDefault(x => x.id == memberId)?.id, trelloMembers.SingleOrDefault(x => x.id == memberId)?.fullName ); } // Step 2 // Card in backlog and committed aren't considered started. if ((result.CardCurrentListTitle != SolutionConstants.TrelloLists.Backlog) && (result.CardCurrentListTitle != SolutionConstants.TrelloLists.Committed)) { // 2.a) The start date is taken from the first action that moved the card in the 'In Progress' list. var action = trelloCardMoveActions .Where ( x => (x.data.card.id == card.id) && (x.data.listAfter.name == SolutionConstants.TrelloLists.InProgress) ) .OrderBy(x => x.date) .FirstOrDefault(); // 2.b) If the card wasn't moved into the 'In Progress' list, but was directly created in a list, // then the start date is taken from its create action. if (action == null) { action = trelloCardCreatedActions .Where(x => x.data.card.id == card.id) .OrderBy(x => x.date) .FirstOrDefault(); } // 2.c) If the card wasn't created in the 'In Progress' list, but was directly copied in a list, // then the start date is taken from its copy action. if (action == null) { action = trelloCardCopyActions .Where(x => x.data.card.id == card.id) .OrderBy(x => x.date) .FirstOrDefault(); } result.CardDateStarted = action?.date; } // Step 3 // Only cards in done are considered completed. if (result.CardCurrentListTitle == SolutionConstants.TrelloLists.Done) { // 3.a) The card completed date is taken from the last action that placed the card in the 'Done' list. var action = trelloCardMoveActions .Where ( x => (x.data.card.id == card.id) && (x.data.listAfter.name == SolutionConstants.TrelloLists.Done) ) .OrderByDescending(x => x.date) .FirstOrDefault(); // 3.b) If the card wasn't moved into the 'Done' list, but was directly created in it, // then the start date is taken from its create action. if (action == null) { action = trelloCardCreatedActions .Where(x => x.data.card.id == card.id) .OrderBy(x => x.date) .FirstOrDefault(); } // 3.c) If the card wasn't created in the 'Done' list, but was directly copied in it, // then the start date is taken from its copy action. if (action == null) { action = trelloCardCopyActions .Where(x => x.data.card.id == card.id) .OrderBy(x => x.date) .FirstOrDefault(); } result.CardDateCompleted = action?.date; } results.Add(result); } return(results); }
internal static Item LocationToSearchResult(SectorMap.Milieu map, ResourceManager resourceManager, ItemLocation location) { if (location is WorldLocation) { Sector sector; World world; ((WorldLocation)location).Resolve(map, resourceManager, out sector, out world); if (sector == null || world == null) { return(null); } WorldResult r = new WorldResult(); r.SectorX = sector.X; r.SectorY = sector.Y; r.SectorTags = sector.TagString; r.HexX = world.X; r.HexY = world.Y; r.Name = world.Name; r.Sector = sector.Names[0].Text; r.Uwp = world.UWP; r.Importance = world.ImportanceValue; return(r); } if (location is SubsectorLocation) { Sector sector; Subsector subsector; ((SubsectorLocation)location).Resolve(map, out sector, out subsector); if (sector == null || subsector == null) { return(null); } SubsectorResult r = new SubsectorResult(); r.SectorX = sector.X; r.SectorY = sector.Y; r.SectorTags = sector.TagString; r.Name = subsector.Name; r.Index = subsector.Index; r.Sector = sector.Names[0].Text; return(r); } if (location is SectorLocation) { Sector sector = ((SectorLocation)location).Resolve(map); if (sector == null) { return(null); } SectorResult r = new SectorResult(); r.SectorX = sector.X; r.SectorY = sector.Y; r.SectorTags = sector.TagString; r.Name = sector.Names[0].Text; return(r); } if (location is LabelLocation) { LabelLocation label = location as LabelLocation; Location l = Astrometrics.CoordinatesToLocation(label.Coords); Sector sector = label.Resolve(map); LabelResult r = new LabelResult(); r.Name = label.Label; r.SectorX = l.Sector.X; r.SectorY = l.Sector.Y; r.HexX = l.Hex.X;; r.HexY = l.Hex.Y; r.Scale = label.Radius > 80 ? 4 : label.Radius > 40 ? 8 : label.Radius > 20 ? 32 : 64; r.SectorTags = sector.TagString; return(r); } throw new ArgumentException(string.Format("Unexpected result type: {0}", location.GetType().Name), "location"); }
internal static Item LocationToSearchResult(SectorMap.Milieu map, ResourceManager resourceManager, ItemLocation location) { if (location is WorldLocation) { Sector sector; World world; ((WorldLocation)location).Resolve(map, resourceManager, out sector, out world); if (sector == null || world == null) return null; WorldResult r = new WorldResult(); r.SectorX = sector.X; r.SectorY = sector.Y; r.SectorTags = sector.TagString; r.HexX = world.X; r.HexY = world.Y; r.Name = world.Name; r.Sector = sector.Names[0].Text; r.Uwp = world.UWP; r.Importance = world.ImportanceValue; return r; } if (location is SubsectorLocation) { Sector sector; Subsector subsector; ((SubsectorLocation)location).Resolve(map, out sector, out subsector); if (sector == null || subsector == null) return null; SubsectorResult r = new SubsectorResult(); r.SectorX = sector.X; r.SectorY = sector.Y; r.SectorTags = sector.TagString; r.Name = subsector.Name; r.Index = subsector.Index; r.Sector = sector.Names[0].Text; return r; } if (location is SectorLocation) { Sector sector = ((SectorLocation)location).Resolve(map); if (sector == null) return null; SectorResult r = new SectorResult(); r.SectorX = sector.X; r.SectorY = sector.Y; r.SectorTags = sector.TagString; r.Name = sector.Names[0].Text; return r; } if (location is LabelLocation) { LabelLocation label = location as LabelLocation; Location l = Astrometrics.CoordinatesToLocation(label.Coords); Sector sector = label.Resolve(map); LabelResult r = new LabelResult(); r.Name = label.Label; r.SectorX = l.Sector.X; r.SectorY = l.Sector.Y; r.HexX = l.Hex.X;; r.HexY = l.Hex.Y; r.Scale = label.Radius > 80 ? 4 : label.Radius > 40 ? 8 : label.Radius > 20 ? 32 : 64; r.SectorTags = sector.TagString; return r; } throw new ArgumentException(string.Format("Unexpected result type: {0}", location.GetType().Name), "location"); }
/// <summary> /// 編集 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEdit_Click(object sender, EventArgs e) { try { // 件数確認 Result = LabelResult.Close; if (cboLabel.Items.Count == 0) { return; } // 未入力 if (string.IsNullOrEmpty(txtLabel.Text)) { CommonUtil.PutMessage(CommonEnums.MessageType.Error, "タイトルを入力してください。"); return; } // 重複 var id = (int)((DataRowView)cboLabel.SelectedItem)[TitleColumns.Id]; var preTitle = ((DataRowView)cboLabel.SelectedItem)[TitleColumns.Title].ToString(); var currentTitle = txtLabel.Text.Trim(); var ocrEngine = (int)cboUseOcrEngine.SelectedValue; var readMultiples = decimal.ToSingle(nudReadMultiples.Value); if (TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].AsEnumerable() .Any( a => a[TitleColumns.Title].ToString() != preTitle && a[TitleColumns.Title].ToString() == currentTitle)) { CommonUtil.PutMessage(CommonEnums.MessageType.Error, "入力したタイトルはすでに存在します。"); return; } // 編集 TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].AsEnumerable() .Where(w => (int)w[TitleColumns.Id] == id) .Select(s => s[TitleColumns.UseOcrEngine] = ocrEngine).ToList(); TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].AsEnumerable() .Where(w => (int)w[TitleColumns.Id] == id) .Select(s => s[TitleColumns.ReadMultiples] = readMultiples).ToList(); TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].AsEnumerable() .Where(w => w[TitleColumns.Title].ToString() == preTitle) .Select(s => s[TitleColumns.Title] = currentTitle).ToList(); var sortedDt = TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].AsEnumerable() .OrderBy(o => o[TitleColumns.Title]).ToArray().CopyToDataTable(); TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].Clear(); foreach (DataRow row in sortedDt.Rows) { TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].ImportRow(row); } // 出力 if (ProcessNameInfo.DisconnectProcess) { // デスクトップ接続 Util.WriteXml(TranslateInfo.SettingDs, TranslateInfo.DesktopConfigFilePath); } else { // 対象プロセス Util.WriteXml(TranslateInfo.SettingDs, TranslateInfo.ConfigFilePath); } // 範囲修正確認 if (CommonUtil.PutMessage(CommonEnums.MessageType.Confirm, "翻訳範囲を編集しますか?") == DialogResult.Yes) { SelectedId = id; TranslateInfo.UseOcrEngine = (int)cboUseOcrEngine.SelectedValue; TranslateInfo.ReadMultiples = decimal.ToSingle(nudReadMultiples.Value); Result = LabelResult.Edit; Close(); } } catch (Exception ex) { CommonUtil.PutMessage(CommonEnums.MessageType.Error, ex.Message); } }
/// <summary> /// 新規作成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCreate_Click(object sender, EventArgs e) { try { // 未入力 if (string.IsNullOrEmpty(txtLabel.Text)) { CommonUtil.PutMessage(CommonEnums.MessageType.Error, "タイトルを入力してください。"); return; } // 重複 if (TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].Rows.Count > 0) { if (TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].AsEnumerable() .Any(a => a[TitleColumns.Title].ToString() == txtLabel.Text)) { CommonUtil.PutMessage( CommonEnums.MessageType.Error, "入力したタイトルはすでに存在します。"); return; } } // 採番 var Ids = TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].AsEnumerable() .Select(s => (int)s[TitleColumns.Id]).ToArray(); var newId = CommonUtil.GetSerialNumber(Ids); // データ作成 var dr = TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].NewRow(); dr[TitleColumns.Id] = newId; dr[TitleColumns.Title] = txtLabel.Text; dr[TitleColumns.UseOcrEngine] = (int)cboUseOcrEngine.SelectedValue; dr[TitleColumns.ReadMultiples] = decimal.ToSingle(nudReadMultiples.Value); dr[TitleColumns.X] = 0; dr[TitleColumns.Y] = 0; dr[TitleColumns.Width] = 0; dr[TitleColumns.Height] = 0; dr[TitleColumns.TargetReturn] = false; dr[TitleColumns.IgnoreReturn] = false; TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].Rows.Add(dr); var sortedDt = TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].AsEnumerable() .OrderBy(o => o[TitleColumns.Title]).ToArray().CopyToDataTable(); TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].Clear(); foreach (DataRow row in sortedDt.Rows) { TranslateInfo.SettingDs.Tables[Util.TITLE_TABLE].ImportRow(row); } // 出力 if (ProcessNameInfo.DisconnectProcess) { // デスクトップ接続 Util.WriteXml(TranslateInfo.SettingDs, TranslateInfo.DesktopConfigFilePath); } else { // 対象プロセス Util.WriteXml(TranslateInfo.SettingDs, TranslateInfo.ConfigFilePath); ProcessNameInfo.RegisterProessName(); } SelectedId = newId; TranslateInfo.UseOcrEngine = (int)cboUseOcrEngine.SelectedValue; TranslateInfo.ReadMultiples = decimal.ToSingle(nudReadMultiples.Value); Result = LabelResult.Create; Close(); } catch (Exception ex) { CommonUtil.PutMessage(CommonEnums.MessageType.Error, ex.Message); } }