forked from Pai-Mei/SatTracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fmFilter.cs
97 lines (88 loc) · 1.82 KB
/
fmFilter.cs
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SatTracker
{
public partial class fmFilter : Form
{
public Double Min = -1;
public Double Max = -1;
public fmFilter()
{
InitializeComponent();
}
private bool CheckFilter()
{
if (radioButton2.Checked)
{
if (comboBoxOrbit.SelectedIndex > 0 && comboBoxOrbit.SelectedIndex < comboBoxOrbit.Items.Count)
{
if (comboBoxOrbit.SelectedIndex == 0)
{
Min = 0;
Max = 2000;
}
else if (comboBoxOrbit.SelectedIndex == 1)
{
Min = 35586;
Max = 35886;
}
return true;
}
else
{
MessageBox.Show("Выберите орбиту");
return false;
}
}
if (radioButton3.Checked)
{
if (!Double.TryParse(textBoxFrom.Text, out Min)
|| !Double.TryParse(textBoxTo.Text, out Max))
{
MessageBox.Show("Данные не валидны!");
return false;
}
if (Min > Max)
{
var tmp = Min;
Min = Max;
Max = Min;
}
return true;
}
return radioButton1.Checked;
}
private void Checking()
{
comboBoxOrbit.Enabled = radioButton2.Checked;
textBoxFrom.Enabled = radioButton3.Checked;
textBoxTo.Enabled = radioButton3.Checked;
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
Checking();
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
Checking();
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
Checking();
}
private void fmFilter_FormClosing(object sender, FormClosingEventArgs e)
{
CheckFilter();
}
}
}