private Point GetEndPoint(TimelineSection section) { int endX = CalculateX(section.End.Value); int y = GetTimelineY(); return(new Point(endX, y)); }
private Rectangle GetLineBounds(TimelineSection section) { var startPoint = GetStartPoint(section); var endPoint = GetEndPoint(section); return(new Rectangle(startPoint.X, startPoint.Y - TimelineThickness / 2, endPoint.X - startPoint.X, TimelineThickness)); }
private Point GetStartPoint(TimelineSection section) { int startX = CalculateX(section.Start.Value); int y = GetTimelineY(); return(new Point(startX, y)); }
private Rectangle GetEndBounds(TimelineSection section) { var endPoint = GetEndPoint(section); var size = IsMajorTickline(section.End) ? MajorTicklineSize : MinorTicklineSize; return(new Rectangle(endPoint.X - size.Width / 2, endPoint.Y - size.Height / 2, size.Width, size.Height)); }
private Rectangle GetStartBounds(TimelineSection section) { var startPoint = GetStartPoint(section); var size = IsMajorTickline(section.Start) ? MajorTicklineSize : MinorTicklineSize; return(new Rectangle(startPoint.X - size.Width / 2, startPoint.Y - size.Height / 2, size.Width, size.Height)); }
/// <summary> /// Initialize the timeline section /// </summary> /// <param name="_newSection"></param> section of timeline with appropriate data /// <param name="position"></param>Where to position this timeline? Right after previous section /// <param name="width"></param>How long is this section (width) public void Initialize(TimelineSection _newSection, Vector2 position, float width) { mySection = _newSection; sectionText.text = mySection.appName + "\n" + mySection.startTime + " - " + mySection.endTime; RectTransform rect = GetComponent <RectTransform>(); rect.anchoredPosition = position; rect.sizeDelta = new Vector2(width, rect.sizeDelta.y); myImage = GetComponent <Image>(); myImage.color = mySection.color; hoverColor = mySection.color; hoverColor.a = .5f; }
private Color GetForeColor(TimelineSection section, TimelineSectionComponents component) { bool isActivelyHighlighted = section.MouseOver == component; bool isInActivelyHighlighted = !isActivelyHighlighted && section.MouseOver != TimelineSectionComponents.None; IThemed componentItem = section; if (component == TimelineSectionComponents.StartSeparator) { componentItem = section.Start; } else if (component == TimelineSectionComponents.EndSeparator) { componentItem = section.End; } return(GetForeColor(componentItem, isActivelyHighlighted, isInActivelyHighlighted)); }
public static void GenerateTimelinePage(this List <NunitGoTest> tests, string fullPath) { try { var reportMenuTitle = new SectionName("Tests timeline"); var timeline = new TimelineSection(tests); var page = new HtmlPage("Timeline page") { PageStylePaths = new List <string> { Output.Files.ReportStyleFile, Output.Files.PrimerStyleFile }, PageBodyCode = reportMenuTitle.HtmlCode + timeline.HtmlCode }; page.SavePage(fullPath); } catch (Exception ex) { Log.Exception(ex, "Exception while generating timeline page"); } }
public IActionResult GetTimeline() { var userFromAuth = UserService.GetUserFromClaims(this.User, UserRepo, RequestLogger); var userTimeline = new List <TimelineSection>(); var thisYear = DateTime.Now.Year; var thisMonth = DateTime.Now.ToString("MMMM"); var lastYear = -1; var lastMonth = ""; TimelineSection lastUserTimelineSection = null; foreach (var userAccomplishment in userFromAuth.UserAccomplishments.OrderByDescending((ua) => ua.CreatedOn)) { var currentYear = userAccomplishment.CreatedOn.Year; var currentMonth = userAccomplishment.CreatedOn.ToString("MMMM"); if (currentYear != lastYear || currentMonth != lastMonth) { lastYear = currentYear; lastMonth = currentMonth; lastUserTimelineSection = new TimelineSection() { SectionLabel = $"{currentMonth} of {currentYear.ToString()}" }; userTimeline.Add(lastUserTimelineSection); } lastUserTimelineSection.SectionData.Add(new TimelineItem() { Date = userAccomplishment.CreatedOn.ToString("dddd, MMMM dd"), Title = userAccomplishment.Title, Content = userAccomplishment.Description, Icon = userAccomplishment.Icon, IconBg = !userAccomplishment.IsAcknowledged ? "#81c784" : "" }); } return(Ok(userTimeline)); }
public IActionResult GetNews() { var news = NewsRepo.FindAllNews(); var newsTimeline = new List <TimelineSection>(); var thisYear = DateTime.Now.Year; int lastYear = -1; TimelineSection lastNewsTimelineSection = null; foreach (var newsItem in news) { if (newsItem.PublishedOn.HasValue) { var currentYear = newsItem.PublishedOn.Value.Year; if (currentYear != lastYear) { lastYear = currentYear; lastNewsTimelineSection = new TimelineSection() { SectionLabel = currentYear.ToString() }; newsTimeline.Add(lastNewsTimelineSection); } lastNewsTimelineSection.SectionData.Add(new TimelineItem() { Date = newsItem.PublishedOn.Value.ToString("dddd, MMMM dd") + " at " + newsItem.PublishedOn.Value.ToString("hh:mm tt"), Title = newsItem.Title, Content = newsItem.Text, Icon = newsItem.ItemType == 1 ? "icofont-info-square" : "icofont-fire-burn", }); } } return(Ok(newsTimeline)); }
private void DrawSeparator(PaintEventArgs e, TimelineSection section, TimelineSectionComponents component) { Rectangle bounds; bool isMajor; switch (component) { case TimelineSectionComponents.StartSeparator: bounds = GetStartBounds(section); isMajor = IsMajorTickline(section.Start); break; case TimelineSectionComponents.EndSeparator: if (!section.End.IsVisible) { return; } bounds = GetEndBounds(section); isMajor = IsMajorTickline(section.End); break; default: throw new NotImplementedException(); } if (isMajor) { e.Graphics.FillRectangle(new SolidBrush(GetForeColor(section, component)), bounds); e.Graphics.DrawRectangle(new Pen(GetEdgeColor(section, component), 1), bounds); } else { e.Graphics.FillRectangle(new SolidBrush(GetForeColor(section, component)), bounds); e.Graphics.DrawRectangle(new Pen(GetEdgeColor(section, component), 1), bounds); } }
private Pen GetPen(TimelineSection section, TimelineSectionComponents component) { return(new Pen(GetForeColor(section, component), TimelineThickness)); }
/// <summary> /// Called everytime an application loses focus - creates a new timeline section in the list and adjusts total time. /// </summary> /// <param name="newSection"></param> public void AddTimelineSection(TimelineSection newSection) { appTimeline.Add(newSection); totalTime += newSection.secLength; }