-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form2.cs
104 lines (82 loc) · 3.28 KB
/
Form2.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
98
99
100
101
102
103
104
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;
namespace tpfinal
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
/* protected override void OnShown(EventArgs e)
{
base.OnShown(e);
Estrategia estrategia = new Estrategia();
progressBar1.Maximum = Utils.lineCount;
progressBar1.Step = 1;
using (TextFieldParser parser = new TextFieldParser(@Utils.get_patron()))
{
parser.TextFieldType = FieldType.Delimited;
parser.SetDelimiters(";");
string[] columns = parser.ReadFields();
string[] fields = parser.ReadFields();
string nombre = Utils.RemoveSpecialCharacters(fields[0]);
string tiempo = Utils.RemoveSpecialCharacters(fields[1]);
string prioridad = Utils.RemoveSpecialCharacters(fields[2]);
while (!parser.EndOfData)
{
fields = parser.ReadFields();
nombre = Utils.RemoveSpecialCharacters(fields[0]);
tiempo = Utils.RemoveSpecialCharacters(fields[1]);
prioridad = Utils.RemoveSpecialCharacters(fields[2]);
Backend.datos.Add(new Proceso(nombre, Int32.Parse(tiempo), Int32.Parse(prioridad)));
progressBar1.PerformStep();
}
}
Form1 buscador = new Form1();
buscador.Show();
this.Close();
}*/
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
Estrategia estrategia = new Estrategia();
progressBar1.Maximum = Utils.lineCount;
progressBar1.Step = 1;
using (var stream = File.OpenRead(Utils.get_patron()))
using (var reader = new StreamReader(stream))
{
var data = Utils.Parse(reader, ';', '"');
foreach (var line in data)
{
string nombre = Utils.RemoveSpecialCharacters(line[0]);
string tiempo = Utils.RemoveSpecialCharacters(line[1]);
string prioridad = Utils.RemoveSpecialCharacters(line[2]);
Backend.datos.Add(new Proceso(nombre, Int32.Parse(tiempo), Int32.Parse(prioridad)));
progressBar1.PerformStep();
}
}
Form1 buscador = new Form1();
buscador.Show();
this.Close();
}
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam);
private void barra_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
}
}