Skip to content

Commit dfe03f5

Browse files
committed
Final pre-release commit, added launching News+ from the home menu, fixed the installation of News+, and fixed all bugs I found in the previous commit
1 parent a2130c4 commit dfe03f5

7 files changed

Lines changed: 59 additions & 14 deletions

File tree

NCX-Installer/FirstTime2.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private void btn1_Click(object sender, RoutedEventArgs e)
5151
Process.Start(Application.ResourceAssembly.Location);
5252
Application.Current.Shutdown();
5353
}
54-
else if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.No)
54+
else
5555
{
5656
string message2 = "Some changes may not take effect until you restart the program.";
5757
string caption2 = "Restart Recommended";

NCX-Installer/MainWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Label Content="v2.7" HorizontalAlignment="Left" Margin="707,0,0,0" VerticalAlignment="Top" Foreground="White"/>
1212
<Label x:Name="label2" Content="News:" HorizontalAlignment="Left" Margin="10,42,0,0" VerticalAlignment="Top" FontSize="16" FontWeight="Bold" Foreground="White"/>
1313
<Label Content="Quick Launch" HorizontalAlignment="Left" Margin="10,88,0,0" VerticalAlignment="Top" FontSize="18" FontWeight="Bold" Foreground="White"/>
14-
<Button x:Name="btn1" Content="" HorizontalAlignment="Left" Margin="99,122,0,0" VerticalAlignment="Top" Height="82" Width="82" Click="Button_Click_1" Visibility="Visible">
14+
<Button x:Name="btn1" Content="" HorizontalAlignment="Left" Margin="99,122,0,0" VerticalAlignment="Top" Height="82" Width="82" Click="Button_Click_1" Visibility="Hidden">
1515
<Button.Background>
1616
<ImageBrush ImageSource="image/csharpcol.png"/>
1717
</Button.Background>
@@ -24,7 +24,7 @@
2424
<Button x:Name="btn8" Content="X-Store" HorizontalAlignment="Left" Margin="12,391,0,0" VerticalAlignment="Top" Height="36" Width="104" FontSize="16" Click="btn8_Click" Foreground="White" Background="Black" BorderBrush="#FFA6A6A6"/>
2525
<Button x:Name="btn9" Content="Archived Projects" HorizontalAlignment="Left" Margin="121,391,0,0" VerticalAlignment="Top" Height="36" Width="104" Visibility="Visible" Click="btn9_Click" Background="Black" Foreground="White"/>
2626
<TextBlock x:Name="label3" HorizontalAlignment="Left" Margin="65,49,0,0" Text="Fetching News... Please wait." TextWrapping="Wrap" VerticalAlignment="Top" Height="37" Width="635" FontSize="14" Foreground="White"/>
27-
<Button x:Name="btn10" Content="" HorizontalAlignment="Left" Margin="186,122,0,0" VerticalAlignment="Top" Height="82" Width="82" Click="Button_Click_1_Copy" Visibility="Hidden">
27+
<Button x:Name="btn10" Content="" HorizontalAlignment="Left" Margin="186,122,0,0" VerticalAlignment="Top" Height="82" Width="82" Click="btn10_Click" Visibility="Hidden">
2828
<Button.Background>
2929
<ImageBrush ImageSource="image/ncxnewsplus.png"/>
3030
</Button.Background>

NCX-Installer/MainWindow.xaml.cs

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,31 @@ public MainWindow()
4141
{
4242
btn9.Visibility = Visibility.Visible;
4343
}
44-
using (WebClient wc = new WebClient())
44+
45+
if (NavSettings.Default.mainReload == false)
4546
{
46-
wc.DownloadFileCompleted += DownloadCompleted;
47-
wc.DownloadFileAsync(
48-
// Param1 = Link of file
49-
new System.Uri("https://github.com/NinjaCheetah/NCX-Installer-News/releases/latest/download/newsLatest.txt"),
50-
// Param2 = Path to save
51-
System.IO.Path.Combine(SavePath, "newsLatest.txt")
52-
);
47+
using (WebClient wc = new WebClient())
48+
{
49+
wc.DownloadFileCompleted += DownloadCompleted;
50+
wc.DownloadFileAsync(
51+
// Param1 = Link of file
52+
new System.Uri("https://github.com/NinjaCheetah/NCX-Installer-News/releases/latest/download/newsLatest.txt"),
53+
// Param2 = Path to save
54+
System.IO.Path.Combine(SavePath, "newsLatest.txt")
55+
);
56+
}
5357
}
58+
else if (NavSettings.Default.mainReload == true)
59+
{
60+
NavSettings.Default.mainReload = false;
61+
TextReader tr = new StreamReader(System.IO.Path.Combine(SavePath, "newsLatest.txt"));
62+
string newsString = tr.ReadLine();
63+
newstext = Convert.ToString(newsString);
64+
tr.Close();
65+
label3.Text = newsString;
66+
}
67+
68+
5469
if (File.Exists("C:/Program Files/NCX/CSharp Collection/CSharpCollectionVol1.exe"))
5570
{
5671
btn1.Visibility = Visibility.Visible;
@@ -144,5 +159,12 @@ private void Button_Click_1_Copy(object sender, RoutedEventArgs e)
144159
//no code here it just closes the box
145160
}
146161
}
162+
163+
private void btn10_Click(object sender, RoutedEventArgs e)
164+
{
165+
if (File.Exists(System.IO.Path.Combine(SavePath, "NCX-Core/NCXNewsPlus/XWare.exe"))) {
166+
Process.Start(System.IO.Path.Combine(SavePath, "NCX-Core/NCXNewsPlus/XWare.exe"));
167+
}
168+
}
147169
}
148170
}

NCX-Installer/NavSettings.Designer.cs

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NCX-Installer/NavSettings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
<Setting Name="comingFrom" Type="System.String" Scope="User">
66
<Value Profile="(Default)" />
77
</Setting>
8+
<Setting Name="mainReload" Type="System.Boolean" Scope="User">
9+
<Value Profile="(Default)">False</Value>
10+
</Setting>
811
</Settings>
912
</SettingsFile>

NCX-Installer/XWareHome.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public XWareHome()
2525

2626
private void btn1_Click(object sender, RoutedEventArgs e)
2727
{
28-
XWareHome page = new XWareHome();
28+
XStoreHome page = new XStoreHome();
2929
NavigationService.Navigate(page);
3030
}
3131

NCX-Installer/XWareNews.xaml.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private void Button_Click_4(object sender, RoutedEventArgs e)
7474
{
7575
btn5.Visibility = Visibility.Hidden;
7676
label1.Visibility = Visibility.Visible;
77+
wc.DownloadProgressChanged += wc_DownloadProgressChanged;
7778
wc.DownloadFileCompleted += DownloadCompleted;
7879
wc.DownloadFileAsync(
7980
// Param1 = Link of file
@@ -88,9 +89,11 @@ private void Button_Click_4(object sender, RoutedEventArgs e)
8889
{
8990
Directory.CreateDirectory(System.IO.Path.Combine(SavePath, "NCX-Core"));
9091
Directory.CreateDirectory(System.IO.Path.Combine(SavePath, "NCX-Core/NCXNewsPlus"));
91-
Directory.CreateDirectory(System.IO.Path.Combine(SavePath, "NCX-Core/NCXNewsPlus"));
9292
using (WebClient wc = new WebClient())
9393
{
94+
btn5.Visibility = Visibility.Hidden;
95+
label1.Visibility = Visibility.Visible;
96+
wc.DownloadProgressChanged += wc_DownloadProgressChanged;
9497
wc.DownloadFileCompleted += DownloadCompleted;
9598
wc.DownloadFileAsync(
9699
// Param1 = Link of file
@@ -107,6 +110,11 @@ public void DownloadCompleted(object sender, EventArgs e)
107110
ZipFile.ExtractToDirectory(System.IO.Path.Combine(SavePath, "NCX-Core/NCXNewsPlus/NCXNewsPlus.zip"), System.IO.Path.Combine(SavePath, "NCX-Core/NCXNewsPlus"), true);
108111
File.Delete(System.IO.Path.Combine(SavePath, "NCX-Core/NCXNewsPlus/NCXNewsPlus.zip"));
109112
label1.Content = "Download Complete";
113+
NavSettings.Default.mainReload = true;
114+
MainWindow win = new MainWindow();
115+
win.Hide();
116+
MainWindow win2 = new MainWindow();
117+
win2.Show();
110118
}
111119

112120
void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)

0 commit comments

Comments
 (0)