-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtinyDisplay.cs
More file actions
123 lines (113 loc) · 4.05 KB
/
Copy pathtinyDisplay.cs
File metadata and controls
123 lines (113 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using LiveChartsCore.SkiaSharpView.Extensions;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using System.Windows.Forms;
namespace DesktopWeather
{
public partial class tinyDisplay : Form
{
public int tinyTempValue;
public int windValue;
public double pressureValue;
public double humidityValue;
private weatherForm myparent;
public tinyDisplay()
{
InitializeComponent();
}
public tinyDisplay(weatherForm parent)
{
InitializeComponent();
myparent = parent;
}
private void DrawTemperature()
{
int tmoSize = this.tmoTinyBackgd.Height;
int newTempHeight = tmoSize * (tinyTempValue - 20) / 100;
this.tinythermometer.Top = tmoTinyBackgd.Bottom - newTempHeight;
this.tinythermometer.Height = newTempHeight;
}
private void DrawWind()
{
pieTinyWind.Series = new ISeries[]
{
new PieSeries<int> { Values = new int[] { 5 } }
};
pieTinyWind.InitialRotation = -95 + windValue;
}
private void DrawPressure()
{
this.pieTinyPressure.Series =
GaugeGenerator.BuildSolidGauge(
new GaugeItem(
pressureValue, // the gauge value
series => // the series style
{
series.MaxRadialColumnWidth = 8;
series.DataLabelsSize = 8;
series.DataLabelsPosition = LiveChartsCore.Measure.PolarLabelsPosition.ChartCenter;
series.DataLabelsPaint = new SolidColorPaint(SKColors.White);
series.Fill = new SolidColorPaint(SKColors.DarkGreen);
series.CornerRadius = 1;
})
);
}
private void DrawHumidity()
{
this.pieTinyHumidity.Series =
GaugeGenerator.BuildSolidGauge(
new GaugeItem(
humidityValue, // the gauge value
series => // the series style
{
series.MaxRadialColumnWidth = 8;
series.DataLabelsSize = 8;
series.DataLabelsPosition = LiveChartsCore.Measure.PolarLabelsPosition.End;
series.DataLabelsPaint = new SolidColorPaint(SKColors.White);
series.Fill = new SolidColorPaint(SKColors.Blue);
series.CornerRadius = 1;
})
);
}
public void RedrawTiny()
{
DrawTemperature();
DrawHumidity();
DrawPressure();
DrawWind();
}
private void tinyDisplay_Click(object sender, System.EventArgs e)
{
this.Visible = false;
if (!myparent.weAreOffline && myparent.itsBeenAday)
{
myparent.restartProgramFlag = true;
myparent.tmrStartup.Enabled = true;
return;
}
myparent.WindowState = FormWindowState.Normal;
myparent.lblStatusBox.Text = "Checking Internet...";
myparent.pbNatlWeather.Invalidate();
if (myparent.weAreOffline) { myparent.tmrStartup.Enabled = true; }
else { myparent.UpdateGaugeDisplays(); }
}
public class TransparentPanel : Panel
{
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00000020; // WS_EX_TRANSPARENT
return cp;
}
}
protected override void OnPaintBackground(PaintEventArgs e)
{
//base.OnPaintBackground(e);
}
}
}
}