Skip to content

Commit

Permalink
Merge pull request #135 from DHancock/Dev
Browse files Browse the repository at this point in the history
Attempt to keep windows defender at bay
  • Loading branch information
DHancock authored Dec 29, 2023
2 parents f3d42ee + 8a542e4 commit a5e6b0a
Show file tree
Hide file tree
Showing 56 changed files with 16 additions and 146 deletions.
14 changes: 1 addition & 13 deletions Countdown/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public partial class App : Application
{
public const string cDisplayName = "Countdown";
public static App Instance => (App)Current;
public static bool IsPackaged { get; } = GetIsPackaged();

private MainWindow? m_window;

Expand All @@ -34,16 +33,5 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
m_window = new MainWindow();
}

internal static MainWindow? MainWindow { get => ((App)Current).m_window; }

private static bool GetIsPackaged()
{
#if DEBUG
uint length = 0;
WIN32_ERROR error = PInvoke.GetCurrentPackageFullName(ref length, null);
return error == WIN32_ERROR.ERROR_INSUFFICIENT_BUFFER;
#else
return false;
#endif
}
internal static MainWindow? MainWindow { get => Instance.m_window; }
}
Binary file removed Countdown/Assets/LargeTile.scale-100.png
Binary file not shown.
Binary file removed Countdown/Assets/LargeTile.scale-125.png
Binary file not shown.
Binary file removed Countdown/Assets/LargeTile.scale-150.png
Binary file not shown.
Binary file removed Countdown/Assets/LargeTile.scale-200.png
Binary file not shown.
Binary file removed Countdown/Assets/LargeTile.scale-400.png
Binary file not shown.
Binary file removed Countdown/Assets/LockScreenLogo.scale-200.png
Binary file not shown.
Binary file removed Countdown/Assets/SmallTile.scale-100.png
Binary file not shown.
Binary file removed Countdown/Assets/SmallTile.scale-125.png
Binary file not shown.
Binary file removed Countdown/Assets/SmallTile.scale-150.png
Binary file not shown.
Binary file removed Countdown/Assets/SmallTile.scale-200.png
Binary file not shown.
Binary file removed Countdown/Assets/SmallTile.scale-400.png
Binary file not shown.
Binary file removed Countdown/Assets/SplashScreen.scale-100.png
Binary file not shown.
Binary file removed Countdown/Assets/SplashScreen.scale-125.png
Binary file not shown.
Binary file removed Countdown/Assets/SplashScreen.scale-150.png
Binary file not shown.
Binary file removed Countdown/Assets/SplashScreen.scale-200.png
Binary file not shown.
Binary file removed Countdown/Assets/SplashScreen.scale-400.png
Binary file not shown.
Binary file removed Countdown/Assets/Square150x150Logo.scale-100.png
Binary file not shown.
Binary file removed Countdown/Assets/Square150x150Logo.scale-125.png
Binary file not shown.
Binary file removed Countdown/Assets/Square150x150Logo.scale-150.png
Binary file not shown.
Binary file removed Countdown/Assets/Square150x150Logo.scale-200.png
Binary file not shown.
Binary file removed Countdown/Assets/Square150x150Logo.scale-400.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed Countdown/Assets/Square44x44Logo.scale-100.png
Diff not rendered.
Binary file removed Countdown/Assets/Square44x44Logo.scale-125.png
Diff not rendered.
Binary file removed Countdown/Assets/Square44x44Logo.scale-150.png
Diff not rendered.
Binary file removed Countdown/Assets/Square44x44Logo.scale-200.png
Diff not rendered.
Binary file removed Countdown/Assets/Square44x44Logo.scale-400.png
Diff not rendered.
Binary file removed Countdown/Assets/Square44x44Logo.targetsize-16.png
Diff not rendered.
Binary file removed Countdown/Assets/Square44x44Logo.targetsize-24.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed Countdown/Assets/Square44x44Logo.targetsize-32.png
Diff not rendered.
Binary file removed Countdown/Assets/Square44x44Logo.targetsize-48.png
Diff not rendered.
Binary file removed Countdown/Assets/StoreLogo.scale-100.png
Diff not rendered.
Binary file removed Countdown/Assets/StoreLogo.scale-125.png
Diff not rendered.
Binary file removed Countdown/Assets/StoreLogo.scale-150.png
Diff not rendered.
Binary file removed Countdown/Assets/StoreLogo.scale-200.png
Diff not rendered.
Binary file removed Countdown/Assets/StoreLogo.scale-400.png
Diff not rendered.
Binary file removed Countdown/Assets/Wide310x150Logo.scale-100.png
Diff not rendered.
Binary file removed Countdown/Assets/Wide310x150Logo.scale-125.png
Diff not rendered.
Binary file removed Countdown/Assets/Wide310x150Logo.scale-150.png
Diff not rendered.
Binary file removed Countdown/Assets/Wide310x150Logo.scale-200.png
Diff not rendered.
Binary file removed Countdown/Assets/Wide310x150Logo.scale-400.png
Diff not rendered.
6 changes: 3 additions & 3 deletions Countdown/Countdown.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net6.0-windows10.0.22621.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Countdown</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
Expand All @@ -24,8 +24,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AssyntSoftware.WinUI3Controls" Version="2.1.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.5.1" />
<PackageReference Include="AssyntSoftware.WinUI3Controls" Version="2.2.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.1.1" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.46-beta">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
48 changes: 0 additions & 48 deletions Countdown/Package.appxmanifest

This file was deleted.

71 changes: 2 additions & 69 deletions Countdown/ViewModels/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Countdown.ViewModels;

// Windows.Storage.ApplicationData isn't supported in unpackaged apps.

// For the unpackaged variant, settings are serialized to a json text file.
// Adding or deleting properties is safe. The missing, or extra data is ignored.
// Changing the type of an existing property may cause problems though. Best not
Expand Down Expand Up @@ -58,37 +56,7 @@ public Inner()
{
}

public static async Task Save(Settings settings)
{
if (App.IsPackaged)
SavePackaged(settings);
else
await SaveUnpackaged(settings);
}

private static void SavePackaged(Settings settings)
{
try
{
IPropertySet properties = ApplicationData.Current.LocalSettings.Values;

properties[nameof(ChooseNumbersIndex)] = settings.ChooseNumbersIndex;
properties[nameof(ChooseLettersIndex)] = settings.ChooseLettersIndex;
properties[nameof(CurrentTheme)] = (int)settings.CurrentTheme;
properties[nameof(VolumePercentage)] = settings.VolumePercentage;
properties[nameof(WindowState)] = (int)settings.WindowState;
properties[nameof(RectInt32.X)] = settings.RestoreBounds.X;
properties[nameof(RectInt32.Y)] = settings.RestoreBounds.Y;
properties[nameof(RectInt32.Width)] = settings.RestoreBounds.Width;
properties[nameof(RectInt32.Height)] = settings.RestoreBounds.Height;
}
catch (Exception ex)
{
Debug.Fail(ex.ToString());
}
}

private static async Task SaveUnpackaged(Settings settings)
internal static async Task Save(Settings settings)
{
try
{
Expand All @@ -107,42 +75,7 @@ private static async Task SaveUnpackaged(Settings settings)
}
}

public static Settings Load()
{
if (App.IsPackaged)
return LoadPackaged();

return LoadUnpackaged();
}

private static Settings LoadPackaged()
{
Settings settings = new Settings();

try
{
IPropertySet properties = ApplicationData.Current.LocalSettings.Values;

settings.ChooseNumbersIndex = (int)properties[nameof(ChooseNumbersIndex)];
settings.ChooseLettersIndex = (int)properties[nameof(ChooseLettersIndex)];
settings.CurrentTheme = (ElementTheme)properties[nameof(CurrentTheme)];
settings.VolumePercentage = (int)properties[nameof(VolumePercentage)];
settings.WindowState = (WindowState)properties[nameof(WindowState)];
settings.RestoreBounds = new RectInt32((int)properties[nameof(RectInt32.X)],
(int)properties[nameof(RectInt32.Y)],
(int)properties[nameof(RectInt32.Width)],
(int)properties[nameof(RectInt32.Height)]);
}
catch (Exception ex)
{
settings.IsFirstRun = true;
Debug.WriteLine(ex.ToString());
}

return settings;
}

private static Settings LoadUnpackaged()
internal static Settings Load()
{
string path = GetSettingsFilePath();

Expand Down
23 changes: 10 additions & 13 deletions Countdown/Views/LettersView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,18 @@ public LettersView()

Loaded += (s, e) =>
{
if (textBox is null)
textBox ??= FindChild<TextBox>(SuggestionBox);

if (textBox is not null)
{
textBox = FindChild<TextBox>(SuggestionBox);
textBox.CharacterCasing = CharacterCasing.Lower;
textBox.MaxLength = Models.WordModel.cMaxLetters;

if (textBox is not null)
textBox.BeforeTextChanging += (s, a) =>
{
textBox.CharacterCasing = CharacterCasing.Lower;
textBox.MaxLength = Models.WordModel.cMaxLetters;

textBox.BeforeTextChanging += (s, a) =>
{
if (a.NewText.Length > 0)
a.Cancel = a.NewText.Any(c => c is < 'a' or > 'z');
};
}
if (a.NewText.Length > 0)
a.Cancel = a.NewText.Any(c => c is < 'a' or > 'z');
};
}

if (firstLoad)
Expand Down Expand Up @@ -334,7 +331,7 @@ internal sealed class WordTreeTemplateSelector : DataTemplateSelector
public DataTemplate? HeadingTemplate { get; set; }
public DataTemplate? WordTemplate { get; set; }

protected override DataTemplate? SelectTemplateCore(object obj)
protected override DataTemplate? SelectTemplateCore(object obj, DependencyObject container)
{
bool IsHeading = ((TreeViewNode)obj).Content is WordHeading;

Expand Down

0 comments on commit a5e6b0a

Please sign in to comment.