Skip to content

Commit 82b8cec

Browse files
committed
dashboard chart fixed
1 parent 0ea1883 commit 82b8cec

File tree

10 files changed

+155
-155
lines changed

10 files changed

+155
-155
lines changed

Core/Miner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace TrueMiningDesktop.Core
88
public static class Miner
99
{
1010
private static readonly DateTime holdTime = DateTime.UtcNow;
11-
public static DateTime startedSince = holdTime.AddTicks(-holdTime.Ticks);
11+
public static DateTime StartedSince = holdTime.AddTicks(-holdTime.Ticks);
1212

1313
public static void StartMiner()
1414
{
@@ -106,7 +106,7 @@ public static bool IsMining
106106

107107
if (isMining)
108108
{
109-
startedSince = DateTime.UtcNow;
109+
StartedSince = DateTime.UtcNow;
110110

111111
Janelas.Pages.Home.GridUserWalletCoin.IsEnabled = false;
112112

@@ -131,7 +131,7 @@ public static bool IsMining
131131
}
132132
else
133133
{
134-
startedSince = holdTime.AddTicks(-holdTime.Ticks);
134+
StartedSince = holdTime.AddTicks(-holdTime.Ticks);
135135

136136
Device.cpu.IsMining = false;
137137
Device.opencl.IsMining = false;

Core/Tools.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ public static void TryChangeTaskbarIconAsSettingsOrder()
292292
{
293293
if (User.Settings.User.ChangeTbIcon)
294294
{
295-
try { MainWindow.nIcon.Icon = new System.Drawing.Icon("Resources/iconeTaskbar2.ico"); } catch { try { MainWindow.nIcon.Icon = new System.Drawing.Icon("Resources/icone.ico"); } catch { } }
295+
try { MainWindow.NotifyIcon.Icon = new System.Drawing.Icon("Resources/iconeTaskbar2.ico"); } catch { try { MainWindow.NotifyIcon.Icon = new System.Drawing.Icon("Resources/icone.ico"); } catch { } }
296296
}
297297
else
298298
{
299-
try { MainWindow.nIcon.Icon = new System.Drawing.Icon("Resources/icone.ico"); }
299+
try { MainWindow.NotifyIcon.Icon = new System.Drawing.Icon("Resources/icone.ico"); }
300300
catch { }
301301
}
302302
}
@@ -332,7 +332,7 @@ public static void RestartAsAdministrator()
332332
{
333333
if (process.Id != thisProcess.Id && process.Responding)
334334
{
335-
MainWindow.nIcon.Visible = false;
335+
MainWindow.NotifyIcon.Visible = false;
336336
thisProcess.Kill();
337337
}
338338
}

Janelas/Dashboard.xaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
</WrapPanel>
3232
<WrapPanel x:Name="xWarningWrapVisibility" Margin="35,5,20,5" Orientation="Horizontal" Visibility="{Binding WarningWrapVisibility}">
3333
<Label Content="Warnings: " FontWeight="Normal" FontFamily="Gadugi" FontSize="13" Padding="0,0,0,0"></Label>
34-
<Button Content="Click here to show your warnings" Click="show_warnings" Background="#FFE8E8E8" BorderBrush="#FF959595" Foreground="#FF404040" Padding="0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="187" Height="20" FontFamily="Gadugi" FontSize="12" />
34+
<Button Content="Click here to show your warnings" Click="ShowWarnings" Background="#FFE8E8E8" BorderBrush="#FF959595" Foreground="#FF404040" Padding="0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="187" Height="20" FontFamily="Gadugi" FontSize="12" />
3535
</WrapPanel>
3636
</WrapPanel>
37-
<oxy:PlotView Model="{Binding chart_model, Mode=OneWay}" Controller="{Binding chart_controller}" Height="155" Margin="20,5,20,120" Visibility="{Binding chart_visibility}" VerticalAlignment="Bottom" />
38-
<WrapPanel Orientation="Horizontal" Margin="20,0,25,100" HorizontalAlignment="Right" Visibility="{Binding chart_visibility}" VerticalAlignment="Bottom">
37+
<oxy:PlotView Model="{Binding ChartModel, Mode=OneWay}" Controller="{Binding ChartController}" Height="155" Margin="20,5,20,120" Visibility="{Binding ChartVisibility}" VerticalAlignment="Bottom" />
38+
<WrapPanel Orientation="Horizontal" Margin="20,0,25,100" HorizontalAlignment="Right" Visibility="{Binding ChartVisibility}" VerticalAlignment="Bottom">
3939
<Label Content="Zoom" FontFamily="Gadugi" FontSize="12" />
40-
<Button Content="12h" Click="changeChartZoom" Background="#FFE8E8E8" BorderBrush="#FF959595" Foreground="#FF404040" Padding="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="35" Height="20" Margin="10,0,0,0" FontFamily="Gadugi" FontSize="12"></Button>
41-
<Button Content="1d" Click="changeChartZoom" Background="#FFE8E8E8" BorderBrush="#FF959595" Foreground="#FF404040" Padding="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="35" Height="20" Margin="5,0,0,0" FontFamily="Gadugi" FontSize="12"></Button>
42-
<Button Content="5d" Click="changeChartZoom" Background="#FFE8E8E8" BorderBrush="#FF959595" Foreground="#FF404040" Padding="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="35" Height="20" Margin="5,0,0,0" FontFamily="Gadugi" FontSize="12"></Button>
40+
<Button Content="12h" Click="ChangeChartZoom" Background="#FFE8E8E8" BorderBrush="#FF959595" Foreground="#FF404040" Padding="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="35" Height="20" Margin="10,0,0,0" FontFamily="Gadugi" FontSize="12"></Button>
41+
<Button Content="1d" Click="ChangeChartZoom" Background="#FFE8E8E8" BorderBrush="#FF959595" Foreground="#FF404040" Padding="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="35" Height="20" Margin="5,0,0,0" FontFamily="Gadugi" FontSize="12"></Button>
42+
<Button Content="5d" Click="ChangeChartZoom" Background="#FFE8E8E8" BorderBrush="#FF959595" Foreground="#FF404040" Padding="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="35" Height="20" Margin="5,0,0,0" FontFamily="Gadugi" FontSize="12"></Button>
4343
</WrapPanel>
4444
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,25">
4545
<Button Height="35" Width="170" Margin="20,0,20,0" Click="Button_Calculator_Popup" Background="#FF2196F3">

Janelas/Dashboard.xaml.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@ private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
3333

3434
private string labelNextPayout;
3535
private string labelAccumulatedBalance;
36-
private List<string> dashboardWarnings = new List<string>();
36+
private List<string> dashboardWarnings = new();
3737
public Visibility warningWrapVisibility = Visibility.Visible;
3838

3939
public string LabelNextPayout { get { return labelNextPayout; } set { labelNextPayout = value; xLabelNextPayout.Content = value; } }
4040
public string LabelAccumulatedBalance { get { return labelAccumulatedBalance; } set { labelAccumulatedBalance = value; xLabelAccumulatedBalance.Content = value; } }
4141
public List<string> DashboardWarnings { get { return dashboardWarnings; } set { dashboardWarnings = value; NotifyPropertyChanged(); } }
4242
public Visibility WarningWrapVisibility { get { return warningWrapVisibility; } set { warningWrapVisibility = value; NotifyPropertyChanged(); } }
4343

44-
public string WalletAddress { get { return User.Settings.User.Payment_Wallet; } set { } }
44+
public static string WalletAddress { get { return User.Settings.User.Payment_Wallet; } set { } }
4545

4646
private bool firstTimeLoad = false;
4747

4848
private Saldo saldo;
4949

50-
private PlotModel chart_model_value;
51-
private OxyPlot.Series.ColumnSeries columnChartSerie_value;
52-
private PlotController chart_controller_value;
53-
private Visibility chart_visibility_value = Visibility.Hidden;
50+
private PlotModel chartModel;
51+
private OxyPlot.Series.ColumnSeries columnChartSeries;
52+
private PlotController chartControler;
53+
private Visibility chartVisibility = Visibility.Hidden;
5454

55-
public PlotModel chart_model { get { return chart_model_value; } set { chart_model_value = value; NotifyPropertyChanged(); } }
56-
public OxyPlot.Series.ColumnSeries columnChartSerie { get { return columnChartSerie_value; } set { columnChartSerie_value = value; NotifyPropertyChanged(); } }
57-
public PlotController chart_controller { get { return chart_controller_value; } set { chart_controller_value = value; NotifyPropertyChanged(); } }
58-
public Visibility chart_visibility { get { return chart_visibility_value; } set { chart_visibility_value = value; NotifyPropertyChanged(); } }
55+
public PlotModel ChartModel { get { return chartModel; } set { chartModel = value; NotifyPropertyChanged(); } }
56+
public OxyPlot.Series.ColumnSeries ColumnChartSeries { get { return columnChartSeries; } set { columnChartSeries = value; NotifyPropertyChanged(); } }
57+
public PlotController ChartControler { get { return chartControler; } set { chartControler = value; NotifyPropertyChanged(); } }
58+
public Visibility ChartVisibility { get { return chartVisibility; } set { chartVisibility = value; NotifyPropertyChanged(); } }
5959

6060
private void UserControl_Loaded(object sender, RoutedEventArgs e)
6161
{
@@ -96,7 +96,7 @@ private void Button_ExchangeRates_Popup(object sender, RoutedEventArgs e)
9696
catch { }
9797
}
9898

99-
public void changeChartZoom(object sender, RoutedEventArgs e)
99+
public void ChangeChartZoom(object sender, RoutedEventArgs e)
100100
{
101101
string content = null;
102102
if (sender != null)
@@ -145,7 +145,7 @@ private void PackIcon_MouseDoubleClick(object sender, System.Windows.Input.Mouse
145145
saldo.UpdateBalances();
146146
}
147147

148-
private void show_warnings(object sender, RoutedEventArgs e)
148+
private void ShowWarnings(object sender, RoutedEventArgs e)
149149
{
150150
foreach (string warning in DashboardWarnings)
151151
{

Janelas/SubMenuSettings/SettingsCPU.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
2626

2727
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
2828
{
29-
MainWindow.clicado = false;
29+
MainWindow.Clicado = false;
3030
}
3131
}
3232
}

MainWindow.xaml.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace TrueMiningDesktop
2323
/// </summary>
2424
public partial class MainWindow : Window
2525
{
26-
public static System.Windows.Forms.NotifyIcon nIcon = new();
26+
public static System.Windows.Forms.NotifyIcon NotifyIcon = new();
2727

2828
public static event EventHandler TapeAllRequest;
2929

@@ -136,7 +136,7 @@ internal void SwitchScreen(UserControl userControl)
136136

137137
private void Menu_SelectionChanged(object sender, SelectionChangedEventArgs e)
138138
{
139-
clicado = false;
139+
Clicado = false;
140140

141141
if (((UserControlItemMenu)((ListView)sender).SelectedItem).ListViewMenu.Items.Count <= 0)
142142
{
@@ -194,8 +194,8 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
194194
TaskbarItemInfo = new System.Windows.Shell.TaskbarItemInfo();
195195

196196
Tools.TryChangeTaskbarIconAsSettingsOrder();
197-
nIcon.Visible = true;
198-
nIcon.MouseDown += Notifier_MouseDown;
197+
NotifyIcon.Visible = true;
198+
NotifyIcon.MouseDown += Notifier_MouseDown;
199199

200200
Core.NextStart.Actions.Load();
201201

@@ -316,17 +316,17 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
316316
Application.Current.Shutdown();
317317

318318
Tools.CheckerPopup.Close();
319-
nIcon.Visible = false;
319+
NotifyIcon.Visible = false;
320320
}
321321
catch { }
322322
}
323323

324-
public static bool clicado;
324+
public static bool Clicado;
325325
private Point lm;
326326

327327
public void Down(object sender, MouseButtonEventArgs e)
328328
{
329-
clicado = true;
329+
Clicado = true;
330330

331331
lm.X = System.Windows.Forms.Control.MousePosition.X;
332332
lm.Y = System.Windows.Forms.Control.MousePosition.Y;
@@ -336,17 +336,17 @@ public void Down(object sender, MouseButtonEventArgs e)
336336

337337
public void Move(object sender, MouseEventArgs e)
338338
{
339-
if (clicado && e.LeftButton == MouseButtonState.Pressed)
339+
if (Clicado && e.LeftButton == MouseButtonState.Pressed)
340340
{
341341
Left = (System.Windows.Forms.Control.MousePosition.X + lm.X);
342342
Top = (System.Windows.Forms.Control.MousePosition.Y + lm.Y);
343343
}
344-
else { clicado = false; }
344+
else { Clicado = false; }
345345
}
346346

347347
public void Up(object sender, MouseButtonEventArgs e)
348348
{
349-
clicado = false;
349+
Clicado = false;
350350
}
351351

352352
private void PackIcon_MouseDown(object sender, MouseButtonEventArgs e)
@@ -357,7 +357,7 @@ private void PackIcon_MouseDown(object sender, MouseButtonEventArgs e)
357357
private void PackIcon_MouseDown_1(object sender, MouseButtonEventArgs e)
358358
{
359359
Hide();
360-
nIcon.ShowBalloonTip(4000, "Hiding", "True Mining was hidden in the notification bar", System.Windows.Forms.ToolTipIcon.Info);
360+
NotifyIcon.ShowBalloonTip(4000, "Hiding", "True Mining was hidden in the notification bar", System.Windows.Forms.ToolTipIcon.Info);
361361
}
362362

363363
private void PackIcon_MouseDown_2(object sender, MouseButtonEventArgs e)
@@ -372,17 +372,17 @@ private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
372372

373373
private void Window_StateChanged(object sender, EventArgs e)
374374
{
375-
if (clicado) clicado = false;
375+
if (Clicado) Clicado = false;
376376
}
377377

378378
private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
379379
{
380-
if (clicado) clicado = false;
380+
if (Clicado) Clicado = false;
381381
}
382382

383383
private void Window_LostMouseCapture(object sender, MouseEventArgs e)
384384
{
385-
if (clicado) clicado = false;
385+
if (Clicado) Clicado = false;
386386
}
387387

388388
private void TorIcon_MouseDown(object sender, MouseButtonEventArgs e)

Saldo/Saldo.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace TrueMiningDesktop.Server
1313
{
1414
public class Saldo
1515
{
16-
private System.Timers.Timer timerUpdateDashboard = new System.Timers.Timer(1000);
16+
private readonly System.Timers.Timer timerUpdateDashboard = new(1000);
1717

1818
public Saldo()
1919
{
@@ -23,15 +23,15 @@ public Saldo()
2323

2424
while (User.Settings.LoadingSettings) { Thread.Sleep(500); }
2525

26-
timerUpdateDashboard.Elapsed += timerUpdateDashboard_Elapsed;
26+
timerUpdateDashboard.Elapsed += TimerUpdateDashboard_Elapsed;
2727

2828
timerUpdateDashboard.Start();
2929

30-
timerUpdateDashboard_Elapsed(null, null);
30+
TimerUpdateDashboard_Elapsed(null, null);
3131
});
3232
}
3333

34-
private void timerUpdateDashboard_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
34+
private void TimerUpdateDashboard_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
3535
{
3636
try
3737
{
@@ -100,7 +100,7 @@ public void UpdateDashboardInfo()
100100

101101
private static DateTime lastUpdated = DateTime.Now.AddMinutes(-10);
102102

103-
private static int secondsPerAveragehashrateReportInterval = 60 * 10;
103+
private static readonly int secondsPerAveragehashrateReportInterval = 60 * 10;
104104
public decimal pointsMultiplier = secondsPerAveragehashrateReportInterval * 16;
105105
public int hashesToCompare = 1000;
106106

@@ -113,7 +113,7 @@ public void UpdateBalances()
113113
isUpdatingBalances = true;
114114

115115
lastPayment = DateTime.UtcNow.AddHours(-DateTime.UtcNow.Hour).AddMinutes(-DateTime.UtcNow.Minute).AddSeconds(-DateTime.UtcNow.Second).AddMilliseconds(-DateTime.UtcNow.Millisecond);
116-
TimeSpan sinceLastPayment = new TimeSpan(DateTime.UtcNow.Ticks - lastPayment.Ticks);
116+
TimeSpan sinceLastPayment = new(DateTime.UtcNow.Ticks - lastPayment.Ticks);
117117
Application.Current.Dispatcher.Invoke((Action)delegate
118118
{
119119
if (isUpdatingBalances)
@@ -125,10 +125,10 @@ public void UpdateBalances()
125125
while (!Tools.IsConnected()) { Thread.Sleep(5000); }
126126
try
127127
{
128-
TruePayment.Nanopool.Objects.HashrateHistory hashrateHystory_user_raw = new TruePayment.Nanopool.Objects.HashrateHistory();
129-
TruePayment.Nanopool.Objects.HashrateHistory hashrateHystory_tm_raw = new TruePayment.Nanopool.Objects.HashrateHistory();
128+
TruePayment.Nanopool.Objects.HashrateHistory hashrateHystory_user_raw = new();
129+
TruePayment.Nanopool.Objects.HashrateHistory hashrateHystory_tm_raw = new();
130130

131-
List<Task<Action>> getAPIsTask = new List<Task<Action>>();
131+
List<Task<Action>> getAPIsTask = new();
132132

133133
getAPIsTask.Add(new Task<Action>(() => { hashrateHystory_user_raw = TruePayment.Nanopool.NanopoolData.GetHashrateHystory("xmr", SoftwareParameters.ServerConfig.MiningCoins.Find(x => x.Coin.Equals("xmr", StringComparison.OrdinalIgnoreCase)).WalletTm, User.Settings.User.Payment_Wallet); return null; }));
134134
getAPIsTask.Add(new Task<Action>(() => { hashrateHystory_tm_raw = TruePayment.Nanopool.NanopoolData.GetHashrateHystory("xmr", SoftwareParameters.ServerConfig.MiningCoins.Find(x => x.Coin.Equals("xmr", StringComparison.OrdinalIgnoreCase)).WalletTm); return null; }));
@@ -258,7 +258,7 @@ public void UpdateBalances()
258258

259259
try
260260
{
261-
Pages.Dashboard.changeChartZoom(null, null);
261+
Pages.Dashboard.ChangeChartZoom(null, null);
262262
}
263263
catch { }
264264

0 commit comments

Comments
 (0)