Skip to content

Commit d591553

Browse files
authored
Merge pull request #9 from True-Mining/fix-dashboard-chart
Fix dashboard chart
2 parents 877d96b + 82b8cec commit d591553

File tree

10 files changed

+170
-168
lines changed

10 files changed

+170
-168
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
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" />
4040
<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>
4141
<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>

Janelas/Dashboard.xaml.cs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ public Dashboard()
2323

2424
public event PropertyChangedEventHandler PropertyChanged;
2525

26-
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
26+
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
2727
{
28-
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
28+
if (PropertyChanged != null)
29+
{
30+
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
31+
}
2932
}
3033

3134
private string labelNextPayout;
@@ -40,19 +43,19 @@ private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
4043

4144
public static string WalletAddress { get { return User.Settings.User.Payment_Wallet; } set { } }
4245

43-
private bool firstTimeLoad;
46+
private bool firstTimeLoad = false;
4447

4548
private Saldo saldo;
4649

47-
private PlotModel chart_model_value;
48-
private OxyPlot.Series.ColumnSeries columnChartSerie_value;
49-
private PlotController chart_controller_value;
50-
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;
5154

52-
public PlotModel Chart_model { get { return chart_model_value; } set { chart_model_value = value; NotifyPropertyChanged(); } }
53-
public OxyPlot.Series.ColumnSeries ColumnChartSerie { get { return columnChartSerie_value; } set { columnChartSerie_value = value; NotifyPropertyChanged(); } }
54-
public PlotController Chart_controller { get { return chart_controller_value; } set { chart_controller_value = value; NotifyPropertyChanged(); } }
55-
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(); } }
5659

5760
private void UserControl_Loaded(object sender, RoutedEventArgs e)
5861
{
@@ -109,19 +112,19 @@ public void ChangeChartZoom(object sender, RoutedEventArgs e)
109112
{
110113
case "12h":
111114
{
112-
Chart_zoom_interval = new TimeSpan(0, 12, 0, 0);
115+
chart_zoom_interval = new TimeSpan(0, 12, 0, 0);
113116
}
114117
break;
115118

116119
case "1d":
117120
{
118-
Chart_zoom_interval = new TimeSpan(1, 0, 0, 0);
121+
chart_zoom_interval = new TimeSpan(1, 0, 0, 0);
119122
}
120123
break;
121124

122125
case "5d":
123126
{
124-
Chart_zoom_interval = new TimeSpan(5, 0, 0, 0);
127+
chart_zoom_interval = new TimeSpan(5, 0, 0, 0);
125128
}
126129
break;
127130

@@ -132,17 +135,17 @@ public void ChangeChartZoom(object sender, RoutedEventArgs e)
132135
break;
133136
}
134137

135-
ViewModel.DashboardChart.UpdateAxes(PoolAPI.XMR_nanopool.hashrateHistory_user, (int)Pages.Dashboard.Chart_zoom_interval.TotalSeconds);
138+
ViewModel.DashboardChart.UpdateAxes(PoolAPI.XMR_nanopool.hashrateHistory_user, (int)Pages.Dashboard.chart_zoom_interval.TotalSeconds);
136139
}
137140

138-
public TimeSpan Chart_zoom_interval { get; set; } = new TimeSpan(0, 24, 0, 0);
141+
public TimeSpan chart_zoom_interval { get; set; } = new TimeSpan(0, 24, 0, 0);
139142

140143
private void PackIcon_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
141144
{
142145
saldo.UpdateBalances();
143146
}
144147

145-
private void Show_warnings(object sender, RoutedEventArgs e)
148+
private void ShowWarnings(object sender, RoutedEventArgs e)
146149
{
147150
foreach (string warning in DashboardWarnings)
148151
{

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)

0 commit comments

Comments
 (0)