/// <summary> /// Update all the times on the right pane (base time, best time, etc). /// </summary> private void UpdateTimes() { if (m_isUpdating) { return; } if (m_planEditor != null) { m_planEditor.ShowWithPluggable(this); } // Current (with implants) TimeSpan currentSpan = UpdateTimesForCharacter(m_character, lblCurrentSpan, lblCurrentDate); // Current (without implants) var noneImplantSet = m_baseCharacter.ImplantSets.None; TimeSpan baseSpan = UpdateTimesForCharacter(m_baseCharacter.After(noneImplantSet), lblBaseSpan, lblBaseDate); // This var scratchpad = CreateModifiedScratchpad(); TimeSpan thisSpan = UpdateTimesForCharacter(scratchpad, lblThisSpan, lblThisDate); // Are the new attributes better than current (without implants) ? if (thisSpan > baseSpan) { lblComparedToBase.ForeColor = Color.Red; lblComparedToBase.Text = Skill.TimeSpanToDescriptiveText(thisSpan - baseSpan, DescriptiveTextOptions.IncludeCommas) + " slower than current base"; } else { lblComparedToBase.ForeColor = SystemColors.ControlText; lblComparedToBase.Text = Skill.TimeSpanToDescriptiveText(baseSpan - thisSpan, DescriptiveTextOptions.IncludeCommas) + " better than current base"; } // Are the new attributes better than current (with implants) ? if (thisSpan > currentSpan) { lblComparedToCurrent.ForeColor = Color.Red; lblComparedToCurrent.Text = Skill.TimeSpanToDescriptiveText(thisSpan - currentSpan, DescriptiveTextOptions.IncludeCommas) + " slower than current"; } else { lblComparedToCurrent.ForeColor = SystemColors.ControlText; lblComparedToCurrent.Text = Skill.TimeSpanToDescriptiveText(currentSpan - thisSpan, DescriptiveTextOptions.IncludeCommas) + " better than current"; } }
/// <summary> /// Initializes a new instance of the <see cref="ImplantCalculatorWindow"/> class. /// Constructor used in WindowsFactory. /// </summary> /// <param name="planEditor">The plan editor.</param> public ImplantCalculatorWindow(PlanEditorControl planEditor) : this() { m_planEditor = planEditor; Plan = planEditor.Plan; planEditor.ShowWithPluggable(this); }
/// <summary> /// Updates controls on the form. /// </summary> /// <param name="remapping">An <see cref="RemappingResult"/> object</param> /// <param name="remappingList">List of remappings</param> private void UpdateForm(RemappingResult remapping, ICollection <RemappingResult> remappingList) { // Update the attributes if (remapping != null) { m_statisticsScratchpad = remapping.BestScratchpad.Clone(); UpdateForRemapping(remapping); } else { UpdateForRemappingList(remappingList); } // Update the plan order's column if ((remapping != null) || (remappingList.Count != 0)) { m_planEditor.ShowWithPluggable(this); } // Hide the throbber and the waiting message panelWait.Hide(); }
/// <summary> /// Update all the times on the right pane (base time, best time, etc). /// </summary> private async Task UpdateTimesAsync() { // Current (with implants) TimeSpan currentSpan = await UpdateTimesForCharacter(m_character.After(m_plan.ChosenImplantSet)); // Current (without implants) ImplantSet noneImplantSet = m_character.ImplantSets.None; TimeSpan baseSpan = await UpdateTimesForCharacter(m_character.After(noneImplantSet)); // This CharacterScratchpad scratchpad = CreateModifiedScratchpad(m_character.After(m_plan.ChosenImplantSet)); TimeSpan thisSpan = await UpdateTimesForCharacter(scratchpad); lblCurrentSpan.Text = currentSpan.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas); lblCurrentDate.Text = DateTime.Now.Add(currentSpan).ToString(CultureConstants.DefaultCulture); lblBaseSpan.Text = baseSpan.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas); lblBaseDate.Text = DateTime.Now.Add(baseSpan).ToString(CultureConstants.DefaultCulture); lblThisSpan.Text = thisSpan.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas); lblThisDate.Text = DateTime.Now.Add(thisSpan).ToString(CultureConstants.DefaultCulture); // Are the new attributes better than current (without implants) ? lblComparedToBase.ForeColor = thisSpan > baseSpan ? Color.Red : thisSpan < baseSpan ? Color.Green : SystemColors.ControlText; lblComparedToBase.Text = thisSpan > baseSpan ? $"{thisSpan.Subtract(baseSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)} slower than current base" : thisSpan < baseSpan ? $"{baseSpan.Subtract(thisSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)} faster than current base" : @"No time difference than current base"; // Are the new attributes better than current (with implants) ? lblComparedToCurrent.ForeColor = thisSpan > currentSpan ? Color.DarkRed : thisSpan < currentSpan ? Color.DarkGreen : SystemColors.ControlText; lblComparedToCurrent.Text = thisSpan > currentSpan ? $"{thisSpan.Subtract(currentSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)} slower than current" : thisSpan < currentSpan ? $"{currentSpan.Subtract(thisSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)} faster than current" : @"No time difference than current base"; // Update the plan's pluggable column m_planEditor?.ShowWithPluggable(this); }
/// <summary> /// Update all the times on the right pane (base time, best time, etc). /// </summary> private void UpdateTimes() { if (m_isUpdating) { return; } if (m_planEditor != null) { m_characterScratchpad = m_character.After(m_set); m_planEditor.ShowWithPluggable(this); } // Current (with implants) TimeSpan currentSpan = UpdateTimesForCharacter(m_character.After(m_plan.ChosenImplantSet), lblCurrentSpan, lblCurrentDate); // Current (without implants) var noneImplantSet = m_character.ImplantSets.None; TimeSpan baseSpan = UpdateTimesForCharacter(m_character.After(noneImplantSet), lblBaseSpan, lblBaseDate); // This var scratchpad = CreateModifiedScratchpad(); TimeSpan thisSpan = UpdateTimesForCharacter(scratchpad, lblThisSpan, lblThisDate); // Are the new attributes better than current (without implants) ? if (thisSpan > baseSpan) { lblComparedToBase.ForeColor = Color.Red; lblComparedToBase.Text = String.Format("{0} slower than current base", thisSpan.Subtract(baseSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)); } else if (thisSpan < baseSpan) { lblComparedToBase.ForeColor = Color.Green; lblComparedToBase.Text = String.Format("{0} faster than current base", baseSpan.Subtract(thisSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)); } else { lblComparedToBase.ForeColor = SystemColors.ControlText; lblComparedToBase.Text = "No time difference than current base"; } // Are the new attributes better than current (with implants) ? if (thisSpan > currentSpan) { lblComparedToCurrent.ForeColor = Color.DarkRed; lblComparedToCurrent.Text = String.Format("{0} slower than current", thisSpan.Subtract(currentSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)); } else if (thisSpan < currentSpan) { lblComparedToCurrent.ForeColor = Color.DarkGreen; lblComparedToCurrent.Text = String.Format("{0} faster than current", currentSpan.Subtract(thisSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)); } else { lblComparedToCurrent.ForeColor = SystemColors.ControlText; lblComparedToCurrent.Text = "No time difference than current"; } }