Skip to content

Commit

Permalink
Added a progressbar and backgroundworker. Small text additions in con…
Browse files Browse the repository at this point in the history
…firmation label.
  • Loading branch information
Gobluebro committed Apr 22, 2017
1 parent 8b057f7 commit f8b99fa
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 20 deletions.
4 changes: 3 additions & 1 deletion PC Room App/FormAboutDev.Designer.cs

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

35 changes: 31 additions & 4 deletions PC Room App/FormSettings.Designer.cs

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

58 changes: 43 additions & 15 deletions PC Room App/FormSettings.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System;
using Microsoft.VisualBasic.FileIO;
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using Microsoft.VisualBasic.FileIO;
using System.Reflection;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

namespace PC_Room_App
{
Expand Down Expand Up @@ -172,6 +172,7 @@ private void Settings_Load(object sender, EventArgs e)
}
#endregion

#region ChangeSettings
private void LaunchBattleNetApp()
{
string args = "";
Expand Down Expand Up @@ -215,19 +216,17 @@ private void BtnChangeSettings_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(currentProfile.WoWPath) == false && string.IsNullOrEmpty(currentProfile.WoWAddonsPath) == false)
{
//taken from visualbasic because it's so good
//if you wanted to give people the option of overriding or not through windows use UIOption.AllDialogs instead of true
FileSystem.CopyDirectory(currentProfile.WoWAddonsPath, currentProfile.WoWPath, true);
//TODO: look into fading in and out(timers)
lblConfirmation.Text = "Addons -> WoW" + Environment.NewLine + "Files have been copied";
lblConfirmation.Text = "Addons -> WoW";
lblConfirmation.Visible = true;
progressBar1.Visible = true;
backgroundWorkerAddonsToWoW.RunWorkerAsync();
lastMovedAddonsTime = DateTime.Now.ToString();
}

//only launch it if blizz app is not open already
Process[] blizzApp = Process.GetProcessesByName("battle.net");
if (blizzApp.Length == 0)
{
if (blizzApp.Length == 0 && (!(string.IsNullOrEmpty(currentProfile.BlizzAppPath))))
{
LaunchBattleNetApp();
}
if (!(currentProfile.ProgramFiles[0] == ""))
Expand All @@ -254,6 +253,22 @@ private void BtnChangeSettings_Click(object sender, EventArgs e)
}
}

private void BackgroundWorkerAddonsToWoW_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
//taken from visualbasic because it's so good
//if you wanted to give people the option of overriding or not through windows use UIOption.AllDialogs instead of true
FileSystem.CopyDirectory(currentProfile.WoWAddonsPath, currentProfile.WoWPath, true);
}

private void BackgroundWorkerAddonsToWoW_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{
progressBar1.Visible = false;
//TODO: look into fading in and out(timers)
lblConfirmation.Text = "Addons -> WoW" + Environment.NewLine + "Files have been copied";
}
#endregion

#region SaveAddons
private void BtnSaveAddons_Click(object sender, EventArgs e)
{
if (!(string.IsNullOrEmpty(currentProfile.ProfileName)))
Expand All @@ -272,10 +287,10 @@ private void BtnSaveAddons_Click(object sender, EventArgs e)
"Are you sure want to override your Addons? ", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
FileSystem.CopyDirectory(currentProfile.WoWPath + @"\WTF", currentProfile.WoWAddonsPath + @"\WTF", true);
FileSystem.CopyDirectory(currentProfile.WoWPath + @"\Interface", currentProfile.WoWAddonsPath + @"\Interface", true);
lblConfirmation.Text = "WoW -> Addons" + Environment.NewLine + "Files have been copied";
lblConfirmation.Text = "WoW -> Addons";
lblConfirmation.Visible = true;
progressBar1.Visible = true;
backgroundWorkerWoWToAddons.RunWorkerAsync();
}
}
catch
Expand All @@ -290,6 +305,19 @@ private void BtnSaveAddons_Click(object sender, EventArgs e)
}
}

private void BackgroundWorkerWoWToAddons_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
FileSystem.CopyDirectory(currentProfile.WoWPath + @"\WTF", currentProfile.WoWAddonsPath + @"\WTF", true);
FileSystem.CopyDirectory(currentProfile.WoWPath + @"\Interface", currentProfile.WoWAddonsPath + @"\Interface", true);
}

private void BackgroundWorkerWoWToAddons_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{
progressBar1.Visible = false;
lblConfirmation.Text = "WoW -> Addons" + Environment.NewLine + "Files have been copied";
}
#endregion

private void NewProfile_Click(object sender, EventArgs e)
{
Hide();
Expand Down
6 changes: 6 additions & 0 deletions PC Room App/FormSettings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>255, 17</value>
</metadata>
<metadata name="backgroundWorkerAddonsToWoW.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>411, 17</value>
</metadata>
<metadata name="backgroundWorkerWoWToAddons.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>760, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down

0 comments on commit f8b99fa

Please sign in to comment.