Skip to content

Commit

Permalink
refactor: rename and clean unused code block
Browse files Browse the repository at this point in the history
Signed-off-by: hoyho <[email protected]>
  • Loading branch information
hoyho committed Jun 19, 2024
1 parent a262120 commit 4468729
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 45 deletions.
6 changes: 3 additions & 3 deletions Foundation/Statistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using System.IO;
using System.Linq;
using System.Text.Json;
using DynamicData;
using DynamicData.Kernel;
using iTimeSlot.Models;

namespace iTimeSlot.Foundation;

public interface IStatistics
{
DailyStat ReadTodayData();
Expand Down Expand Up @@ -164,4 +164,4 @@ public List<DailyStat> ReadWeekData()

return existed.ToList();
}
}
}
1 change: 1 addition & 0 deletions Shared/Vars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using iTimeSlot.Foundation;
using iTimeSlot.Models;


Expand Down
63 changes: 22 additions & 41 deletions ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public MainWindowViewModel()
var data = Global.StatReporter.ReadTodayData();
TotalWorkMinutes = data.TotalWorkMinutes;
TotalBreakMinutes = data.TotalBreakMinutes;
CompletedWorkTimers = data.WorkCount;
CompletedWorkCount = data.WorkCount;

var weekData = Global.StatReporter.ReadWeekData();
int displayNum = 3;
Expand All @@ -60,7 +60,20 @@ public MainWindowViewModel()
{
new Axis
{
Labels = dates.Select(x => DateTime.Parse(x).ToString("dd MMM")).ToArray()
Labels = dates.Select(x => DateTime.Parse(x).ToString("dd MMM")).ToArray(),
/*
Labels = new string[] { "17 Jun", "18 Jun", "19 Jun" },
LabelsRotation = 0,
SeparatorsPaint = new SolidColorPaint(new SKColor(200, 200, 200)),
SeparatorsAtCenter = false,
TicksPaint = new SolidColorPaint(new SKColor(35, 35, 35)),
TicksAtCenter = true,
//By default the axis tries to optimize the number of
// labels to fit the available space,
// when you need to force the axis to show all the labels then you must:
ForceStepToMin = true,
MinStep = 1,
*/
}
};

Expand Down Expand Up @@ -152,11 +165,11 @@ public int TotalBreakMinutes
set { this.SetProperty(ref _totalBreakMinutes, value); }
}

private int _completedWorkTimers;
public int CompletedWorkTimers
private int _completedWorkCount;
public int CompletedWorkCount
{
get { return _completedWorkTimers; }
set { this.SetProperty(ref _completedWorkTimers, value); }
get { return _completedWorkCount; }
set { this.SetProperty(ref _completedWorkCount, value); }
}

private bool _isTimeSlotComboBoxEnabled = true;
Expand Down Expand Up @@ -219,40 +232,8 @@ public string LabelStatus
}


public ISeries[] StatSeries { get; set; } =
{
// new ColumnSeries<double>
// {
// Name = "Total work minutes",
// Values = new double[] { 61, 113, 12 }
// },
// new ColumnSeries<double>
// {
// Name = "Total break minutes",
// Values = new double[] { 2, 15, 5 }
// }
};

public Axis[] StatXAxes { get; set; } =
{
new Axis
{
Labels = new string[] { "17 Jun", "18 Jun", "19 Jun" },
LabelsRotation = 0,

SeparatorsPaint = new SolidColorPaint(new SKColor(200, 200, 200)),
// SeparatorsPaint = new SolidColorPaint(SKColors.LightCoral),
SeparatorsAtCenter = false,
TicksPaint = new SolidColorPaint(new SKColor(35, 35, 35)),
// TicksPaint = new SolidColorPaint(SKColors.LightGreen),
//TicksAtCenter = true,
// By default the axis tries to optimize the number of
// labels to fit the available space,
// when you need to force the axis to show all the labels then you must:
// ForceStepToMin = true,
MinStep = 1,
}
};
public ISeries[] StatSeries { get; set; }
public Axis[] StatXAxes { get; set; }


public void DeleteTimeSpan(TimeSlot toDel)
Expand Down Expand Up @@ -473,7 +454,7 @@ await Dispatcher.UIThread.Invoke(async () =>
var data = Global.StatReporter.ReadTodayData();
TotalWorkMinutes = data.TotalWorkMinutes;
TotalBreakMinutes = data.TotalBreakMinutes;
CompletedWorkTimers = data.WorkCount;
CompletedWorkCount = data.WorkCount;

if (PlaySound)
{
Expand Down
2 changes: 1 addition & 1 deletion Views/WorkspaceTab.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
Height="10" />
<Run Text=" " />
<Run Text="Completed work slots: " />
<Run Text="{Binding CompletedWorkTimers}" />
<Run Text="{Binding CompletedWorkCount}" />
</TextBlock>
</StackPanel>
</StackPanel>
Expand Down

0 comments on commit 4468729

Please sign in to comment.