Skip to content

Commit b2971a9

Browse files
author
Graham Downs
committed
#1 Display the time block (and type) in the progressbar tooltip
1 parent de71964 commit b2971a9

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

MastodonFollowerTimes/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
<ProgressBar Margin="0,5,0,0"
196196
Value="{Binding StatusCount}"
197197
Maximum="{Binding ProgressBarMaximum}"
198-
ToolTip="{Binding PercentString}"
198+
ToolTip="{Binding ProgressBarTooltip}"
199199
/>
200200
</DockPanel>
201201
</HierarchicalDataTemplate>

MastodonFollowerTimes/MainWindowViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public async Task LoadData()
113113
var existingHour = list.FirstOrDefault(x => x.TimeBlock == (byte)hour);
114114
if (existingHour == null)
115115
{
116-
var statusPerHour = new StatusPerTimeBlock { TimeBlock = (byte)hour, StatusCount = 1 };
117-
statusPerHour.StatusesPerMinute.Add(new StatusPerTimeBlock { TimeBlock = (byte)minute, StatusCount = 1});
116+
var statusPerHour = new StatusPerTimeBlock(TimeBlockTypes.Hour) { TimeBlock = (byte)hour, StatusCount = 1 };
117+
statusPerHour.StatusesPerMinute.Add(new StatusPerTimeBlock(TimeBlockTypes.Minute) { TimeBlock = (byte)minute, StatusCount = 1});
118118
list.Add(statusPerHour);
119119
}
120120
else
@@ -123,7 +123,7 @@ public async Task LoadData()
123123
var existingMinute =
124124
existingHour.StatusesPerMinute.FirstOrDefault(x => x.TimeBlock == (byte)minute);
125125
if (existingMinute == null)
126-
existingHour.StatusesPerMinute.Add(new StatusPerTimeBlock
126+
existingHour.StatusesPerMinute.Add(new StatusPerTimeBlock(TimeBlockTypes.Minute)
127127
{ TimeBlock = (byte)minute, StatusCount = 1 });
128128
else
129129
existingMinute.StatusCount++;

MastodonFollowerTimes/StatusPerTimeBlock.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@ namespace MastodonFollowerTimes;
44

55
internal class StatusPerTimeBlock
66
{
7+
private readonly TimeBlockTypes _timeBlockType;
8+
79
public byte TimeBlock { get; set; }
810
public uint StatusCount { get; set; }
911
public uint TotalStatuses { get; set; }
1012
public uint ProgressBarMaximum { get; set; }
11-
public string PercentString {
13+
public string ProgressBarTooltip {
1214
get
1315
{
1416
var percent = (float)StatusCount / (float)TotalStatuses;
15-
return percent.ToString("0.00%");
17+
return $"{_timeBlockType} {TimeBlock}: {percent:0.00%}";
1618
}
1719
}
1820
public List<StatusPerTimeBlock> StatusesPerMinute { get; set; }
1921

20-
public StatusPerTimeBlock()
22+
public StatusPerTimeBlock(TimeBlockTypes type)
2123
{
24+
_timeBlockType = type;
2225
StatusesPerMinute = new List<StatusPerTimeBlock>();
2326
}
2427
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace MastodonFollowerTimes;
2+
3+
internal enum TimeBlockTypes
4+
{
5+
Hour,
6+
Minute
7+
}

0 commit comments

Comments
 (0)