-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindowModel.cs
61 lines (54 loc) · 1.59 KB
/
MainWindowModel.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
using System.Windows;
using System.Collections.Generic;
using System.Text;
using System;
namespace GenerateQRCode
{
public class MainWindowModel : NotifyPropertyChanged
{
//public MainWindow main;
/**
* Get set for code value
*/
private string _codeContent;
public string codeContent
{
get
{
return _codeContent;
}
set
{
_codeContent = value;
RaisePropertyChange("codeContent");
}
}
//public MainWindowModel(MainWindow mainWin)
//{
// this.main = mainWin;
//}
public void clearText()
{
//this.main.txtbarcodecontent.Text = null;
//this.main.imgbarcode.Source = null;
//this.main.tbkbarcodecontent.Text = null;
}
public void getRandomLink()
{
var arlist1 = new List<string>();
int counter = 0;
// Read the file and display it line by line.
foreach (string line in System.IO.File.ReadLines("C:\\Users\\TDL_User\\Documents\\sites.txt"))
{
System.Console.WriteLine(line);
arlist1.Add(line);
counter++;
}
Random random = new Random();
int index = random.Next(arlist1.Count);
var name = arlist1[index].ToString();
arlist1.RemoveAt(index);
codeContent = name;
}
}
}