-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.cs
119 lines (106 loc) · 3.43 KB
/
MainWindow.xaml.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MlabToExcelExport
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private SetViewModel GenerateSet()
{
double startMIC = 0.125;
var MIClist = new List<double>();
for (int i = 1; i <= 10; i++)
{
MIClist.Add(startMIC);
startMIC = startMIC * 2;
}
startMIC = 0.03125;
var ControlMIClist = new List<double>();
for (int i = 1; i <= 10; i++)
{
ControlMIClist.Add(startMIC);
startMIC = startMIC * 2;
}
var MOlist = new List<SetRow>();
for (int i = 2; i <= 93; i++)
{
MOlist.Add(new SetRow
{
Cell = "A" + i,
MO = "Oranism " + i,
MuseumNumber = "MARAFON-"+(120 + i).ToString(),
Number = i
});
}
var ControlMOlist = new List<SetRow>();
for (int i = 1; i <= 3; i++)
{
ControlMOlist.Add(new SetRow
{
Cell = "",
MO = "Control Oranism " + i,
MuseumNumber = "control" + i,
Number = i
});
}
var collection = new ObservableCollection<SetItem>();
for (int i = 0; i <= 10; i++)
{
collection.Add(new SetItem
{
AB = "Antibiotic " + i,
Set = "Set Number " + i,
Project = "Project " + i,
TestMethod = "Метод разведения в агаре",
MICList = MIClist,
ControlMICList = ControlMIClist,
MOList = MOlist,
ControlMOList = ControlMOlist
});
}
var obj = new SetViewModel();
obj.Set = collection;
return obj;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
SetViewModel data = GenerateSet();
MessageBox.Show(ExportToExcel.GetExcelDocumentSetPDF(data, null, 1));
}
private void Button_Click_Other(object sender, RoutedEventArgs e)
{
SetViewModel data = GenerateSet();
MessageBox.Show(ExportToExcel.GetExcelDocumentSet(data, null, 2));
}
private void Button_Click_Other2(object sender, RoutedEventArgs e)
{
if (ExportToExcel.OpenExcelDocument(@"C:\Users\Inspiron\Desktop\maestro_output.xls") == 1)
{
MessageBox.Show("File OPened Succesfully");
}
else
{
MessageBox.Show("Can not open file, probabli incorrect filename");
}
}
}
}