|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Diagnostics; |
| 4 | +using System.IO; |
| 5 | +using System.Linq; |
| 6 | +using System.Net; |
| 7 | +using System.Text; |
| 8 | +using System.Threading.Tasks; |
| 9 | +using System.Windows; |
| 10 | +using System.Windows.Controls; |
| 11 | +using System.Windows.Data; |
| 12 | +using System.Windows.Documents; |
| 13 | +using System.Windows.Input; |
| 14 | +using System.Windows.Media; |
| 15 | +using System.Windows.Media.Imaging; |
| 16 | +using System.Windows.Navigation; |
| 17 | +using System.Windows.Shapes; |
| 18 | + |
| 19 | +namespace NCX_Installer |
| 20 | +{ |
| 21 | + /// <summary> |
| 22 | + /// Interaction logic for MainWindow.xaml |
| 23 | + /// </summary> |
| 24 | + public partial class MainWindow : Window |
| 25 | + { |
| 26 | + static readonly string SavePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); |
| 27 | + public string newstext; |
| 28 | + |
| 29 | + public MainWindow() |
| 30 | + { |
| 31 | + InitializeComponent(); |
| 32 | + using (WebClient wc = new WebClient()) |
| 33 | + { |
| 34 | + wc.DownloadFileCompleted += DownloadCompleted; |
| 35 | + wc.DownloadFileAsync( |
| 36 | + // Param1 = Link of file |
| 37 | + new System.Uri("https://github.com/NinjaCheetah/NCX-Installer-News/releases/latest/download/newsLatest.txt"), |
| 38 | + // Param2 = Path to save |
| 39 | + System.IO.Path.Combine(SavePath, "newsLatest.txt") |
| 40 | + ); |
| 41 | + } |
| 42 | + if (File.Exists("C:/Program Files/NCX/CSharp Collection/CSharpCollectionVol1.exe")) |
| 43 | + { |
| 44 | + btn1.Visibility = Visibility.Visible; |
| 45 | + } |
| 46 | + if (File.Exists("C:/Program Files/NCX/AutoMod/AutoMod.exe")) |
| 47 | + { |
| 48 | + btn2.Visibility = Visibility.Visible; |
| 49 | + } |
| 50 | + if (Settings1.Default.firstTime == true) |
| 51 | + { |
| 52 | + FirstTime1 win = new FirstTime1(); |
| 53 | + win.Show(); |
| 54 | + win.Topmost = true; |
| 55 | + } |
| 56 | + } |
| 57 | + |
| 58 | + private void Button_Click(object sender, RoutedEventArgs e) |
| 59 | + { |
| 60 | + Environment.Exit(0); |
| 61 | + } |
| 62 | + |
| 63 | + private void Button_Click_1(object sender, RoutedEventArgs e) |
| 64 | + { |
| 65 | + if (File.Exists("C:/Program Files/NCX/CSharp Collection/CSharpCollectionVol1.exe")) |
| 66 | + { |
| 67 | + Process.Start("C:/Program Files/NCX/CSharp Collection/CSharpCollectionVol1.exe"); |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + private void Button_Click_2(object sender, RoutedEventArgs e) |
| 72 | + { |
| 73 | + if (File.Exists("C:/Program Files/NCX/AutoMod/AutoMod.exe")) |
| 74 | + { |
| 75 | + Process.Start("C:/Program Files/NCX/AutoMod/AutoMod.exe"); |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + public void DownloadCompleted(object sender, EventArgs e) |
| 80 | + { |
| 81 | + TextReader tr = new StreamReader(System.IO.Path.Combine(SavePath, "newsLatest.txt")); |
| 82 | + string newsString = tr.ReadLine(); |
| 83 | + newstext = Convert.ToString(newsString); |
| 84 | + tr.Close(); |
| 85 | + label3.Content = newsString; |
| 86 | + } |
| 87 | + |
| 88 | + private void Button_Click_3(object sender, RoutedEventArgs e) |
| 89 | + { |
| 90 | + Window1 win = new Window1(); |
| 91 | + win.Show(); |
| 92 | + Hide(); |
| 93 | + } |
| 94 | + |
| 95 | + private void btn5_Click(object sender, RoutedEventArgs e) |
| 96 | + { |
| 97 | + Updates win = new Updates(); |
| 98 | + win.Show(); |
| 99 | + Hide(); |
| 100 | + } |
| 101 | + |
| 102 | + protected override void OnClosing(System.ComponentModel.CancelEventArgs e) |
| 103 | + { |
| 104 | + base.OnClosing(e); |
| 105 | + Environment.Exit(0); |
| 106 | + } |
| 107 | + |
| 108 | + private void btn4_Click(object sender, RoutedEventArgs e) |
| 109 | + { |
| 110 | + About win = new About(); |
| 111 | + win.Show(); |
| 112 | + } |
| 113 | + } |
| 114 | +} |
0 commit comments