Skip to content

Commit

Permalink
Hide LocationDialog after OK clicked and handle no theme correctly in…
Browse files Browse the repository at this point in the history
… ThemeDialog
  • Loading branch information
t1m0thyj committed Oct 23, 2018
1 parent 2cbae9e commit e51fde5
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 32 deletions.
12 changes: 0 additions & 12 deletions src/InputDialog.Designer.cs

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

13 changes: 6 additions & 7 deletions src/InputDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public InputDialog()

private void UpdateGuiState()
{
inputBox.Enabled = !locationCheckBox.Checked;
okButton.Enabled = inputBox.TextLength > 0 || locationCheckBox.Checked;
}

Expand Down Expand Up @@ -56,16 +57,13 @@ private async void locationCheckBox_CheckedChanged(object sender, EventArgs e)
{
JsonConfig.settings.useWindowsLocation = true;
locationCheckBox.Checked = true;
inputBox.Enabled = false;
okButton.Enabled = true;
}

locationCheckBox.CheckedChanged += locationCheckBox_CheckedChanged;
}
else
{
JsonConfig.settings.useWindowsLocation = false;
inputBox.Enabled = true;
}

locationCheckBox.Enabled = true;
Expand All @@ -86,6 +84,8 @@ private async void okButton_Click(object sender, EventArgs e)
JsonConfig.settings.latitude = data.lat;
JsonConfig.settings.longitude = data.lon;

this.Hide();

if (ThemeManager.isReady)
{
AppContext.wcsService.RunScheduler();
Expand All @@ -106,8 +106,7 @@ private async void okButton_Click(object sender, EventArgs e)
}
else
{
progressBar1.Visible = true;

this.Hide();
bool locationUpdated = await UwpLocation.UpdateGeoposition();

if (locationUpdated)
Expand All @@ -121,10 +120,10 @@ private async void okButton_Click(object sender, EventArgs e)
}
else
{
progressBar1.Visible = false;

MessageBox.Show("Failed to get location from Windows location service.",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);

this.Show();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2")]
[assembly: AssemblyVersion("2.1.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
18 changes: 17 additions & 1 deletion src/ThemeDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void LoadPreviewImage(int imageNumber)
private void ThemeDialog_Load(object sender, EventArgs e)
{
darkModeCheckbox.Checked = JsonConfig.settings.darkMode;
string currentTheme = JsonConfig.settings.themeName ?? "Mojave_Desert";
string currentTheme = JsonConfig.settings.themeName;

ImageList imageList = new ImageList();
imageList.ColorDepth = ColorDepth.Depth32Bit;
Expand All @@ -134,6 +134,18 @@ private void ThemeDialog_Load(object sender, EventArgs e)
imageList.Images.Add(ShrinkImage(windowsWallpaper, 192, 108));
listView1.Items.Add("None", 0);

if (currentTheme == null)
{
if (JsonConfig.firstRun)
{
currentTheme = "Mojave_Desert";
}
else
{
listView1.Items[0].Selected = true;
}
}

for (int i = 0; i < ThemeManager.themeSettings.Count; i++)
{
ThemeConfig theme = ThemeManager.themeSettings[i];
Expand Down Expand Up @@ -191,6 +203,8 @@ private void darkModeCheckbox_CheckedChanged(object sender, EventArgs e)

private void okButton_Click(object sender, EventArgs e)
{
okButton.Enabled = false;

string themeName = listView1.SelectedItems[0].Text.Replace(' ', '_');
JsonConfig.settings.themeName = themeName;
JsonConfig.settings.darkMode = darkModeCheckbox.Checked;
Expand Down Expand Up @@ -221,6 +235,7 @@ private void okButton_Click(object sender, EventArgs e)
UwpDesktop.GetHelper().SetWallpaper(windowsWallpaper);
}

okButton.Enabled = true;
this.Close();
}

Expand All @@ -241,6 +256,7 @@ private void OnFormClosing(object sender, FormClosingEventArgs e)
if (result != DialogResult.Yes)
{
e.Cancel = true;
this.Show();
}
}
}
Expand Down
14 changes: 6 additions & 8 deletions src/WinDynamicDesktop.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\Costura.Fody.3.1.5\build\Costura.Fody.props" Condition="Exists('packages\Costura.Fody.3.1.5\build\Costura.Fody.props')" />
<Import Project="packages\Costura.Fody.3.1.6\build\Costura.Fody.props" Condition="Exists('packages\Costura.Fody.3.1.6\build\Costura.Fody.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -38,8 +38,8 @@
<ApplicationIcon>WinDynamicDesktop.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Costura, Version=3.1.5.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>packages\Costura.Fody.3.1.5\lib\net46\Costura.dll</HintPath>
<Reference Include="Costura, Version=3.1.6.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>packages\Costura.Fody.3.1.6\lib\net46\Costura.dll</HintPath>
</Reference>
<Reference Include="DesktopBridge.Helpers, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\DesktopBridge.Helpers.1.1\lib\net45\DesktopBridge.Helpers.dll</HintPath>
Expand Down Expand Up @@ -167,10 +167,8 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Costura.Fody.3.1.5\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.3.1.5\build\Costura.Fody.props'))" />
<Error Condition="!Exists('packages\Costura.Fody.3.1.5\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.3.1.5\build\Costura.Fody.targets'))" />
<Error Condition="!Exists('packages\Fody.3.2.11\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Fody.3.2.11\build\Fody.targets'))" />
<Error Condition="!Exists('packages\Costura.Fody.3.1.6\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.3.1.6\build\Costura.Fody.props'))" />
<Error Condition="!Exists('packages\Fody.3.2.13\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Fody.3.2.13\build\Fody.targets'))" />
</Target>
<Import Project="packages\Costura.Fody.3.1.5\build\Costura.Fody.targets" Condition="Exists('packages\Costura.Fody.3.1.5\build\Costura.Fody.targets')" />
<Import Project="packages\Fody.3.2.11\build\Fody.targets" Condition="Exists('packages\Fody.3.2.11\build\Fody.targets')" />
<Import Project="packages\Fody.3.2.13\build\Fody.targets" Condition="Exists('packages\Fody.3.2.13\build\Fody.targets')" />
</Project>
4 changes: 2 additions & 2 deletions src/packages.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Angle" version="2.0.0" targetFramework="net461" />
<package id="Costura.Fody" version="3.1.5" targetFramework="net461" />
<package id="Costura.Fody" version="3.1.6" targetFramework="net461" />
<package id="DesktopBridge.Helpers" version="1.1" targetFramework="net461" />
<package id="Fody" version="3.2.11" targetFramework="net461" developmentDependency="true" />
<package id="Fody" version="3.2.13" targetFramework="net461" developmentDependency="true" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
<package id="RestSharp" version="106.5.4" targetFramework="net461" />
<package id="SolarCalculator" version="2.0.4" targetFramework="net461" />
Expand Down
2 changes: 1 addition & 1 deletion uwp/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" IgnorableNamespaces="uap mp rescap desktop">
<Identity Name="38719TimothyJohnson.WinDynamicDesktop" Publisher="CN=3C822DA5-D64C-40A9-A84A-5502C3EDD8CD" Version="2.0.2.0" />
<Identity Name="38719TimothyJohnson.WinDynamicDesktop" Publisher="CN=3C822DA5-D64C-40A9-A84A-5502C3EDD8CD" Version="2.1.0.0" />
<Properties>
<DisplayName>WinDynamicDesktop</DisplayName>
<PublisherDisplayName>Timothy Johnson</PublisherDisplayName>
Expand Down

0 comments on commit e51fde5

Please sign in to comment.