Skip to content

Commit aeaf337

Browse files
committed
.NET Core Conversion Part 2 of 3
1 parent b58b9ff commit aeaf337

10 files changed

Lines changed: 247 additions & 16 deletions

NCX-Installer/About.xaml.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,8 @@ public About()
2626

2727
private void Button_Click(object sender, RoutedEventArgs e)
2828
{
29-
string message = "Haven't figured out how to open web pages in .NET Core yet so, uh, yeah.";
30-
string caption = "Currently Unavailable";
31-
MessageBoxButton buttons = MessageBoxButton.OK;
32-
MessageBoxImage icon = MessageBoxImage.Error;
33-
if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.OK)
34-
{
35-
36-
}
29+
string url = "https://github.com/NinjaCheetah/NCX-Installer";
30+
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
3731
}
3832
}
3933
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Window x:Class="NCX_Installer.ArchivedProjects"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:NCX_Installer"
7+
mc:Ignorable="d"
8+
Title="ArchivedProjects" Height="225" Width="225">
9+
<Grid>
10+
<Label Content="Archived Projects" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="16" FontWeight="Bold"/>
11+
<Button Content="VBCol1" HorizontalAlignment="Left" Margin="10,56,0,0" VerticalAlignment="Top" Click="Button_Click"/>
12+
<Button Content="AutoMod" HorizontalAlignment="Left" Margin="10,81,0,0" VerticalAlignment="Top" Click="Button_Click_1"/>
13+
<Button Content="Back" HorizontalAlignment="Left" Margin="10,31,0,0" VerticalAlignment="Top" FontWeight="Bold" Click="Button_Click_2"/>
14+
15+
</Grid>
16+
</Window>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using System.Windows;
5+
using System.Windows.Controls;
6+
using System.Windows.Data;
7+
using System.Windows.Documents;
8+
using System.Windows.Input;
9+
using System.Windows.Media;
10+
using System.Windows.Media.Imaging;
11+
using System.Windows.Shapes;
12+
using System.Diagnostics;
13+
14+
namespace NCX_Installer
15+
{
16+
/// <summary>
17+
/// Interaction logic for ArchivedProjects.xaml
18+
/// </summary>
19+
public partial class ArchivedProjects : Window
20+
{
21+
public ArchivedProjects()
22+
{
23+
InitializeComponent();
24+
}
25+
26+
private void Button_Click(object sender, RoutedEventArgs e)
27+
{
28+
string url = "https://github.com/NinjaCheetah/VisualBasic-Collection-Vol.1";
29+
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
30+
}
31+
32+
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
33+
{
34+
base.OnClosing(e);
35+
Environment.Exit(0);
36+
}
37+
38+
private void Button_Click_1(object sender, RoutedEventArgs e)
39+
{
40+
string url = "https://github.com/NinjaCheetah/AutoMod";
41+
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
42+
}
43+
44+
private void Button_Click_2(object sender, RoutedEventArgs e)
45+
{
46+
MainWindow win = new MainWindow();
47+
win.Show();
48+
Hide();
49+
}
50+
}
51+
}

NCX-Installer/FirstTime1.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ private void btn1_Click(object sender, RoutedEventArgs e)
3030

3131
private void btn2_Click(object sender, RoutedEventArgs e)
3232
{
33-
33+
FirstTime2 win = new FirstTime2();
34+
win.Show();
35+
Hide();
3436
}
3537
}
3638
}

NCX-Installer/FirstTime2.xaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Window x:Class="NCX_Installer.FirstTime2"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:NCX_Installer"
7+
mc:Ignorable="d"
8+
Title="Settings" Height="222" Width="473">
9+
<Grid>
10+
<Label Content="Settings" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="26" FontWeight="Bold"/>
11+
<Label Content="Your Name (Optional)" HorizontalAlignment="Left" Margin="0,45,0,0" VerticalAlignment="Top"/>
12+
<TextBox x:Name="textBox1" HorizontalAlignment="Left" Margin="5,71,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="156" Height="19"/>
13+
<CheckBox x:Name="checkBox1" Content="Enable Older Versions (WIP)" HorizontalAlignment="Left" Margin="0,103,0,0" VerticalAlignment="Top"/>
14+
<CheckBox x:Name="checkBox3" Content="Enable Archived Projects" HorizontalAlignment="Left" Margin="0,143,0,0" VerticalAlignment="Top"/>
15+
<CheckBox x:Name="checkBox2" Content="Enable Beta Versions (WIP)" HorizontalAlignment="Left" Margin="0,123,0,0" VerticalAlignment="Top"/>
16+
<Button x:Name="btn1" Content="Done" HorizontalAlignment="Left" Margin="366,146,0,0" VerticalAlignment="Top" Width="75" Height="23" Click="btn1_Click"/>
17+
<Button x:Name="btn2" Content="Cancel" HorizontalAlignment="Left" Margin="287,146,0,0" VerticalAlignment="Top" Width="74" Height="23" Visibility="Hidden"/>
18+
<Button x:Name="btn3" Content="RESET" HorizontalAlignment="Left" Margin="366,118,0,0" VerticalAlignment="Top" Width="75" Height="23" Click="btn3_Click"/>
19+
20+
</Grid>
21+
</Window>

NCX-Installer/FirstTime2.xaml.cs

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Text;
5+
using System.Windows;
6+
using System.Windows.Controls;
7+
using System.Windows.Data;
8+
using System.Windows.Documents;
9+
using System.Windows.Input;
10+
using System.Windows.Media;
11+
using System.Windows.Media.Imaging;
12+
using System.Windows.Shapes;
13+
14+
namespace NCX_Installer
15+
{
16+
/// <summary>
17+
/// Interaction logic for FirstTime2.xaml
18+
/// </summary>
19+
public partial class FirstTime2 : Window
20+
{
21+
public FirstTime2()
22+
{
23+
InitializeComponent();
24+
InitializeComponent();
25+
textBox1.Text = Settings1.Default.name;
26+
checkBox1.IsChecked = Settings1.Default.oldVer;
27+
checkBox2.IsChecked = Settings1.Default.betaVer;
28+
checkBox3.IsChecked = Settings1.Default.arch;
29+
if (Settings1.Default.firstTime == false)
30+
{
31+
btn2.Visibility = Visibility.Visible;
32+
}
33+
}
34+
35+
private void btn1_Click(object sender, RoutedEventArgs e)
36+
{
37+
Settings1.Default.firstTime = false;
38+
Settings1.Default.name = textBox1.Text;
39+
Settings1.Default.oldVer = (bool)checkBox1.IsChecked;
40+
Settings1.Default.betaVer = (bool)checkBox2.IsChecked;
41+
Settings1.Default.arch = (bool)checkBox3.IsChecked;
42+
Settings1.Default.Save();
43+
btn1.Visibility = Visibility.Hidden;
44+
45+
string message = "It is recommended that you restart the program after initial setup. Would you like to restart now?";
46+
string caption = "Restart Recommended";
47+
MessageBoxButton buttons = MessageBoxButton.YesNo;
48+
MessageBoxImage icon = MessageBoxImage.Information;
49+
if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.Yes)
50+
{
51+
Process.Start(Application.ResourceAssembly.Location);
52+
Application.Current.Shutdown();
53+
}
54+
else if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.No)
55+
{
56+
string message2 = "Some changes may not take effect until you restart the program.";
57+
string caption2 = "Restart Recommended";
58+
MessageBoxButton buttons2 = MessageBoxButton.OK;
59+
MessageBoxImage icon2 = MessageBoxImage.Exclamation;
60+
if (MessageBox.Show(message2, caption2, buttons2, icon2) == MessageBoxResult.OK)
61+
{
62+
this.Close();
63+
}
64+
}
65+
}
66+
67+
private void btn3_Click(object sender, RoutedEventArgs e)
68+
{
69+
string message = "Are you sure you want to reset your settings? This will restart the program and go through setup again.";
70+
string caption = "Reset settings?";
71+
MessageBoxButton buttons = MessageBoxButton.YesNo;
72+
MessageBoxImage icon = MessageBoxImage.Exclamation;
73+
if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.Yes)
74+
{
75+
Settings1.Default.firstTime = true;
76+
Settings1.Default.name = "";
77+
Settings1.Default.oldVer = false;
78+
Settings1.Default.betaVer = false;
79+
Settings1.Default.arch = false;
80+
Settings1.Default.Save();
81+
Process.Start(Application.ResourceAssembly.Location);
82+
Application.Current.Shutdown();
83+
}
84+
else if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.No)
85+
{
86+
this.Close();
87+
}
88+
}
89+
}
90+
}

NCX-Installer/MainWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
<Button x:Name="btn6" Content="Exit" HorizontalAlignment="Left" Margin="663,351,0,0" VerticalAlignment="Top" Height="23" Width="75" Click="Button_Click"/>
2828
<Button x:Name="btn5" Content="Updates" HorizontalAlignment="Left" Margin="584,351,0,0" VerticalAlignment="Top" Height="23" Width="74" Click="btn5_Click"/>
2929
<Button x:Name="btn4" Content="About" HorizontalAlignment="Left" Margin="505,351,0,0" VerticalAlignment="Top" Height="23" Width="74" Click="btn4_Click"/>
30-
<Button x:Name="btn7" Content="" HorizontalAlignment="Left" Margin="706,314,0,0" VerticalAlignment="Top" Height="32" Width="32">
30+
<Button x:Name="btn7" Content="" HorizontalAlignment="Left" Margin="706,314,0,0" VerticalAlignment="Top" Height="32" Width="32" Click="btn7_Click">
3131
<Button.Background>
3232
<ImageBrush ImageSource="image/settings.png"/>
3333
</Button.Background>
3434
</Button>
3535
<Button x:Name="btn8" Content="X-Store" HorizontalAlignment="Left" Margin="12,338,0,0" VerticalAlignment="Top" Height="36" Width="104" FontSize="16"/>
36-
<Button x:Name="btn9" Content="Archived Projects" HorizontalAlignment="Left" Margin="121,338,0,0" VerticalAlignment="Top" Height="36" Width="104"/>
36+
<Button x:Name="btn9" Content="Archived Projects" HorizontalAlignment="Left" Margin="121,338,0,0" VerticalAlignment="Top" Height="36" Width="104" Visibility="Hidden" Click="btn9_Click"/>
3737

3838
</Grid>
3939
</Window>

NCX-Installer/MainWindow.xaml.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ public partial class MainWindow : Window
2929
public MainWindow()
3030
{
3131
InitializeComponent();
32+
if (Settings1.Default.name != "")
33+
{
34+
label1.Content = "Welcome back, " + Settings1.Default.name + "!";
35+
}
36+
else if (Settings1.Default.name == "")
37+
{
38+
label1.Content = "Welcome back!";
39+
}
40+
if (Settings1.Default.arch == true)
41+
{
42+
btn9.Visibility = Visibility.Visible;
43+
}
3244
using (WebClient wc = new WebClient())
3345
{
3446
wc.DownloadFileCompleted += DownloadCompleted;
@@ -110,5 +122,18 @@ private void btn4_Click(object sender, RoutedEventArgs e)
110122
About win = new About();
111123
win.Show();
112124
}
125+
126+
private void btn7_Click(object sender, RoutedEventArgs e)
127+
{
128+
FirstTime2 win = new FirstTime2();
129+
win.Show();
130+
}
131+
132+
private void btn9_Click(object sender, RoutedEventArgs e)
133+
{
134+
ArchivedProjects win = new ArchivedProjects();
135+
win.Show();
136+
Hide();
137+
}
113138
}
114139
}

NCX-Installer/Window1.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
Title="Installed Programs" Height="391" Width="722">
99
<Grid>
1010
<Label x:Name="label1" Content="All Installed Programs" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="24" FontWeight="Bold"/>
11-
<Button x:Name="btn1" Content="" HorizontalAlignment="Left" Margin="10,42,0,0" VerticalAlignment="Top" Height="128" Width="128" Visibility="Hidden">
11+
<Button x:Name="btn1" Content="" HorizontalAlignment="Left" Margin="10,42,0,0" VerticalAlignment="Top" Height="128" Width="128" Visibility="Hidden" Click="btn1_Click">
1212
<Button.Background>
1313
<ImageBrush ImageSource="image/csharpcol.png"/>
1414
</Button.Background>
1515
</Button>
16-
<Button x:Name="btn3" Content="" HorizontalAlignment="Left" Margin="143,42,0,0" VerticalAlignment="Top" Height="128" Width="128" Visibility="Hidden">
16+
<Button x:Name="btn3" Content="" HorizontalAlignment="Left" Margin="143,42,0,0" VerticalAlignment="Top" Height="128" Width="128" Visibility="Hidden" Click="btn3_Click">
1717
<Button.Background>
1818
<ImageBrush ImageSource="image/automod.png"/>
1919
</Button.Background>
2020
</Button>
21-
<Button x:Name="btn2" Content="View in Store" HorizontalAlignment="Left" Margin="10,175,0,0" VerticalAlignment="Top" Height="23" Width="128" Visibility="Hidden"/>
22-
<Button x:Name="btn4" Content="View in Store" HorizontalAlignment="Left" Margin="143,175,0,0" VerticalAlignment="Top" Height="23" Width="128" Visibility="Hidden"/>
23-
<Button x:Name="btn5" Content="Download More Apps" HorizontalAlignment="Left" Margin="276,42,0,0" VerticalAlignment="Top" Height="128" Width="128" Background="{x:Null}"/>
21+
<Button x:Name="btn2" Content="View in Store" HorizontalAlignment="Left" Margin="10,175,0,0" VerticalAlignment="Top" Height="23" Width="128" Visibility="Hidden" Click="btn2_Click"/>
22+
<Button x:Name="btn4" Content="View in Store" HorizontalAlignment="Left" Margin="143,175,0,0" VerticalAlignment="Top" Height="23" Width="128" Visibility="Hidden" Click="btn4_Click"/>
23+
<Button x:Name="btn5" Content="Download More Apps" HorizontalAlignment="Left" Margin="276,42,0,0" VerticalAlignment="Top" Height="128" Width="128" Background="{x:Null}" Click="btn5_Click"/>
2424
<Button Content="Back" HorizontalAlignment="Left" Margin="614,10,0,0" VerticalAlignment="Top" Width="75" Height="23" Click="Button_Click"/>
2525
</Grid>
2626
</Window>

NCX-Installer/Window1.xaml.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Windows.Media;
1111
using System.Windows.Media.Imaging;
1212
using System.Windows.Shapes;
13+
using System.Diagnostics;
1314

1415
namespace NCX_Installer
1516
{
@@ -45,5 +46,36 @@ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
4546
base.OnClosing(e);
4647
Environment.Exit(0);
4748
}
49+
50+
private void btn5_Click(object sender, RoutedEventArgs e)
51+
{
52+
53+
}
54+
55+
private void btn1_Click(object sender, RoutedEventArgs e)
56+
{
57+
if (File.Exists("C:/Program Files/NCX/CSharp Collection/CSharpCollectionVol1.exe"))
58+
{
59+
Process.Start("C:/Program Files/NCX/CSharp Collection/CSharpCollectionVol1.exe");
60+
}
61+
}
62+
63+
private void btn2_Click(object sender, RoutedEventArgs e)
64+
{
65+
66+
}
67+
68+
private void btn3_Click(object sender, RoutedEventArgs e)
69+
{
70+
if (File.Exists("C:/Program Files/NCX/AutoMod/AutoMod.exe"))
71+
{
72+
Process.Start("C:/Program Files/NCX/AutoMod/AutoMod.exe");
73+
}
74+
}
75+
76+
private void btn4_Click(object sender, RoutedEventArgs e)
77+
{
78+
79+
}
4880
}
4981
}

0 commit comments

Comments
 (0)