Skip to content

Commit

Permalink
Stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhanzik committed Sep 9, 2013
1 parent 1badf3d commit b353018
Show file tree
Hide file tree
Showing 48 changed files with 1,716 additions and 129 deletions.
10 changes: 5 additions & 5 deletions VGateway/TaskList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace VGateway
{
public partial class TaskList : Form
{
private List<TaskInfo> Tasks = new List<TaskInfo>();
private Dictionary<int, TaskInfo> Tasks = new Dictionary<int, TaskInfo>();

public TaskList()
{
Expand All @@ -29,11 +29,11 @@ private void InitializeTasks()
descriptions.Add(s.Substring(s.IndexOf(" ") + 1));
}
List<Type> types = (from t in Assembly.GetExecutingAssembly().GetTypes() where t.IsClass && Regex.IsMatch(t.Name, "Task(\\d)+") select t).ToList();
types.Sort((a, b) => { return a.Name.CompareTo(b.Name); });
types.Sort((a, b) => { return int.Parse(a.Name.Substring(4)).CompareTo(int.Parse(b.Name.Substring(4))); });
foreach (Type t in types)
{
int num = int.Parse(t.Name.Substring(4));
Tasks.Add(new TaskInfo(num, descriptions[num - 1], t));
Tasks.Add(num, new TaskInfo(num, descriptions[num - 1], t));
taskSelector.Items.Add(num.ToString());
}
taskSelector.SelectedIndex = taskSelector.Items.Count - 1;
Expand All @@ -44,7 +44,7 @@ private void start_Click(object sender, EventArgs e)
if (taskSelector.SelectedItem == null)
return;
int num = int.Parse((string)taskSelector.SelectedItem);
Form f = (Form)Activator.CreateInstance(Tasks[num - 1].Type);
Form f = (Form)Activator.CreateInstance(Tasks[num].Type);
f.Show();
}

Expand All @@ -56,7 +56,7 @@ private void TaskList_Load(object sender, EventArgs e)
private void taskSelector_SelectedIndexChanged(object sender, EventArgs e)
{
int num = int.Parse((string)taskSelector.SelectedItem);
textUlohy.Text = Tasks[num - 1].Description;
textUlohy.Text = Tasks[num].Description;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions VGateway/Tasks/Task1.cs → VGateway/Tasks/Task01.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

namespace VGateway.Tasks
{
public partial class Task1 : Form
public partial class Task01 : Form
{
public Task1()
public Task01()
{
InitializeComponent();
}
Expand Down
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions VGateway/Tasks/Task2.cs → VGateway/Tasks/Task02.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

namespace VGateway.Tasks
{
public partial class Task2 : Form
public partial class Task02 : Form
{
public Task2()
public Task02()
{
InitializeComponent();
}
Expand Down
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions VGateway/Tasks/Task3.cs → VGateway/Tasks/Task03.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

namespace VGateway.Tasks
{
public partial class Task3 : Form
public partial class Task03 : Form
{
public Task3()
public Task03()
{
InitializeComponent();
}
Expand Down
File renamed without changes.
168 changes: 168 additions & 0 deletions VGateway/Tasks/Task04.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions VGateway/Tasks/Task04.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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 VGateway.Tasks
{
public partial class Task04 : Form
{
public Task04()
{
InitializeComponent();
}

private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
Recalculate();
}

private void numericUpDown2_ValueChanged(object sender, EventArgs e)
{
Recalculate();
}

private void Recalculate()
{
float mass = (float)numericUpDown1.Value;
float height = (float)numericUpDown2.Value;
float BMI = mass / (height * height);
label4.Text = BMI.ToString("F2");
string text = "";
if (BMI <= 16.5f)
{
text = "těžká podvýživa";
}
else if (BMI <= 18.5f)
{
text = "podváha";
}
else if (BMI <= 25f)
{
text = "ideální váha";
}
else if (BMI <= 30f)
{
text = "nadváha";
}
else if (BMI <= 35f)
{
text = "mírná obezita";
}
else if (BMI <= 40f)
{
text = "střední obezita";
}
else
{
text = "morbidní obezita";
}
label5.Text = text;
}
}
}
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions VGateway/Tasks/Task4.cs → VGateway/Tasks/Task05.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

namespace VGateway.Tasks
{
public partial class Task4 : Form
public partial class Task05 : Form
{
public Task4()
public Task05()
{
InitializeComponent();
}
Expand Down
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions VGateway/Tasks/Task5.cs → VGateway/Tasks/Task06.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

namespace VGateway.Tasks
{
public partial class Task5 : Form
public partial class Task06 : Form
{
public Task5()
public Task06()
{
InitializeComponent();
}
Expand Down
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions VGateway/Tasks/Task6.cs → VGateway/Tasks/Task07.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

namespace VGateway.Tasks
{
public partial class Task6 : Form
public partial class Task07 : Form
{
public Task6()
public Task07()
{
InitializeComponent();
}
Expand Down
File renamed without changes.
Loading

0 comments on commit b353018

Please sign in to comment.