Skip to content

Commit

Permalink
Fix #3
Browse files Browse the repository at this point in the history
- Add missing Process.Start(Info) for Report Issue button
- Added code for checking updates automatically on startup.

Co-Authored-By: Ryan Walpole <69621127+RyanWalpole@users.noreply.github.com>
  • Loading branch information
RWELabs and RyanWalpole committed Mar 21, 2023
1 parent 57eae36 commit dfe37cc
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 71 deletions.
106 changes: 59 additions & 47 deletions src/Moxo QuickWeb/Dashboard.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 86 additions & 24 deletions src/Moxo QuickWeb/Dashboard.cs
Expand Up @@ -19,40 +19,52 @@ public Dashboard()
{
InitializeComponent();
Version.Text = "Version: " + Properties.Settings.Default.Version + "(" + Properties.Settings.Default.BuildVersion + ")";

if(Properties.Settings.Default.CheckUpdate == "TRUE")
{
UpdateCheck.RunWorkerAsync();
}
}

private void CheckForUpdates_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
CheckForUpdates.Text = "Checking for updates...";
string CurrentUpdateVersion = "https://raw.githubusercontent.com/RyanWalpoleEnterprises/Moxo-QuickWeb/main/installer/cver.txt";

//View current stable version number
WebClient client = new WebClient();
client.Proxy = null;
Stream stream = client.OpenRead(CurrentUpdateVersion);
StreamReader reader = new StreamReader(stream);
String CVER = reader.ReadToEnd();

if(CVER == Properties.Settings.Default.Version)
try
{
//Current version matches the web's most up to date version
CheckForUpdates.Text = "No updates available.";
}
else
{
CheckForUpdates.Text = "Updates available.";
DialogResult result = MessageBox.Show("Moxo QuickWeb Studio has available updates. Would you like to download and install these updates now?","Moxo QuickWeb Studio",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if(result == DialogResult.Yes)
CheckForUpdates.Text = "Checking for updates...";
string CurrentUpdateVersion = "https://raw.githubusercontent.com/RyanWalpoleEnterprises/Moxo-QuickWeb/main/installer/cver.txt";

//View current stable version number
WebClient client = new WebClient();
client.Proxy = null;
Stream stream = client.OpenRead(CurrentUpdateVersion);
StreamReader reader = new StreamReader(stream);
String CVER = reader.ReadToEnd();

if (CVER.Contains(Properties.Settings.Default.Version))
{
Update update = new Update();
update.ShowDialog();
this.Hide();
Properties.Settings.Default.UpdateReady = "FALSE";
}
else
else if (!CVER.Contains(Properties.Settings.Default.Version))
{
//
Properties.Settings.Default.UpdateReady = "TRUE";
CheckForUpdates.Text = "Updates available";
DialogResult result = MessageBox.Show("Moxo QuickWeb Studio has available updates. Would you like to download and install these updates now?", "Moxo QuickWeb Studio", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
Update update = new Update();
update.ShowDialog();
this.Hide();
}
else
{
//
}
}
}
catch
{

}
}

private void StartDotNet_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -83,5 +95,55 @@ private void StartDotLX_Click(object sender, EventArgs e)
newproject.Show();
this.Hide();
}

private void UpdateCheck_DoWork(object sender, DoWorkEventArgs e)
{
CheckForUpdates.Text = "Checking for updates...";
string CurrentUpdateVersion = "https://raw.githubusercontent.com/RyanWalpoleEnterprises/Moxo-QuickWeb/main/installer/cver.txt";

//View current stable version number
WebClient client = new WebClient();
client.Proxy = null;
Stream stream = client.OpenRead(CurrentUpdateVersion);
StreamReader reader = new StreamReader(stream);
String CVER = reader.ReadToEnd();

if (CVER.Contains(Properties.Settings.Default.Version))
{
Properties.Settings.Default.UpdateReady = "FALSE";
}
else if(!CVER.Contains(Properties.Settings.Default.Version))
{
Properties.Settings.Default.UpdateReady = "TRUE";
}
}

private void UpdateCheck_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if(Properties.Settings.Default.UpdateReady == "TRUE")
{
CheckForUpdates.Text = "Updates available";
DialogResult result = MessageBox.Show("Moxo QuickWeb Studio has available updates. Would you like to download and install these updates now?", "Moxo QuickWeb Studio", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
Update update = new Update();
update.ShowDialog();
this.Hide();
}
else
{
//
}
}
else if(Properties.Settings.Default.UpdateReady == "FALSE")
{
CheckForUpdates.Text = "No updates available";
}
}

private void IssueReport_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://github.com/RyanWalpoleEnterprises/Moxo-QuickWeb/issues");
}
}
}

0 comments on commit dfe37cc

Please sign in to comment.