-
Notifications
You must be signed in to change notification settings - Fork 1
/
LicenseMessage.xaml.cs
79 lines (71 loc) · 2.48 KB
/
LicenseMessage.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Shapes;
using Microsoft.Win32;
using System.IO;
namespace Invoice365
{
/// <summary>
/// Interaction logic for LicenseMessage.xaml
/// </summary>
public partial class LicenseMessage : Window
{
public static string MSG = "Your Invoice365 License has expired. Please Insert a valid license file";
public static string REGISTER = "Update your Invoice365 License";
public string path { get; set; }
public LicenseMessage()
{
InitializeComponent();
this.button2.Visibility = Visibility.Hidden;
}
public LicenseMessage(string msg)
{
InitializeComponent();
this.licenseMessage.Text = msg;
this.button2.Visibility = Visibility.Visible;
}
public LicenseMessage(string msg, string title) : this(msg)
{
this.Title = title;
}
private void button1_Click(object sender, RoutedEventArgs e)
{
this.Close();
//Environment.Exit(1);
}
private void Hyperlink_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start("http://invoice365.ewebcomputing.com");
}
private void button2_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
//dlg.FileName = name;
dlg.DefaultExt = "xml";
dlg.Filter = "License File (.xml)|*.xml";
Nullable<bool> result = dlg.ShowDialog();
if (result.GetValueOrDefault())
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\license.xml";
File.Delete(path);
File.Copy(dlg.FileName, path);
if (File.Exists(dlg.FileName))
{
path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\license.xml";
this.Close();
}
else
MessageBox.Show("License File Not found");
}
}
}
}