Skip to content

Commit

Permalink
Allow version in unpackaged app
Browse files Browse the repository at this point in the history
  • Loading branch information
MolotovCherry committed Nov 14, 2023
1 parent 8cf2ec9 commit 5e641b0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Virtual Display Driver Control/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Virtual_Display_Driver_Control {
public partial class App : Application {
public static Version Version = new Version(1, 0, 0);

#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public static Window Window { get; private set; }
public static IAppSettings Settings { get; private set; }
Expand Down
20 changes: 20 additions & 0 deletions Virtual Display Driver Control/Common/Version.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Devices.Bluetooth;

namespace Virtual_Display_Driver_Control.Common;

public class Version {
public uint Major;
public uint Minor;
public uint Patch;

public Version(uint major, uint minor, uint patch) {
Major = major;
Minor = minor;
Patch = patch;
}
}
9 changes: 1 addition & 8 deletions Virtual Display Driver Control/Views/SettingsView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
using Microsoft.UI.Xaml.Controls;
using System;
using Virtual_Display_Driver_Control.Helpers;
using Windows.ApplicationModel;
using Windows.Storage;
using Windows.System;

namespace Virtual_Display_Driver_Control.Views;

public sealed partial class SettingsView : Page {
public string AppInfo {
get {
var version = Package.Current.Id.Version;
var appTitle = Application.Current.Resources["AppTitleName"] as string;
var versionString = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
var versionString = $"{App.Version.Major}.{App.Version.Minor}.{App.Version.Patch}";
return $"{appTitle} - v{versionString}";
}
}
Expand Down Expand Up @@ -49,8 +46,6 @@ private void themeMode_SelectionChanged(object sender, RoutedEventArgs e) {
}

private void themeMode_load() {
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;

// do not fire callback when we change the index here
themeMode.SelectionChanged -= themeMode_SelectionChanged;

Expand All @@ -75,8 +70,6 @@ private void themeMaterial_load() {
((ComboBoxItem)themeMaterial.Items[1]).IsEnabled = false;
}

ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;

// do not fire callback when we change the index here
themeMaterial.SelectionChanged -= themeMaterial_SelectionChanged;

Expand Down

0 comments on commit 5e641b0

Please sign in to comment.