Skip to content

Commit

Permalink
Merge branch 'vnext' of https://github.com/nor0x/Dots into vnext
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/App.axaml
#	src/App.axaml.cs
  • Loading branch information
nor0x committed Oct 19, 2023
2 parents 6976bde + cb47c0d commit 40c7084
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 13 deletions.
11 changes: 11 additions & 0 deletions src/AboutWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
using Dots.Helpers;
using Newtonsoft.Json.Linq;

#if MACOS
using Foundation;
#endif

namespace Dots
{
public partial class AboutWindow : Window
Expand All @@ -20,8 +24,15 @@ public partial class AboutWindow : Window
public AboutWindow()
{
InitializeComponent();
#if WINDOWS
var version = Assembly.GetEntryAssembly().GetName().Version;
VersionRun.Text = version.ToString(3);
#endif

#if MACOS
var v = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleVersion")?.ToString();
VersionRun.Text = v;
#endif
}

private void OpenSourceButton_Clicked(object? sender, Avalonia.Input.TappedEventArgs e)
Expand Down
11 changes: 6 additions & 5 deletions src/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:helpers="using:Dots.Helpers"
xmlns:hyper="clr-namespace:HyperText.Avalonia;assembly=HyperText.Avalonia"
x:Class="Dots.App"
Name="Dots"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Resources>
Expand Down Expand Up @@ -50,9 +51,9 @@
<hyper:HyperLinkStyle />
<StyleInclude Source="/Styles.axaml" />
</Application.Styles>
<NativeMenu.Menu>
<NativeMenu>
<NativeMenuItem Header="About Dots" Click="NativeMenuItem_Click" />
</NativeMenu>
</NativeMenu.Menu>
<NativeMenu.Menu>
<NativeMenu>
<NativeMenuItem Header="About Dots" Click="AboutMenu_Clicked" />
</NativeMenu>
</NativeMenu.Menu>
</Application>
15 changes: 14 additions & 1 deletion src/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace Dots
{
public partial class App : Application
{
AboutWindow _aboutWindow = new AboutWindow();
bool _aboutWindowOpen = false;
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
Expand All @@ -24,8 +26,19 @@ public override void OnFrameworkInitializationCompleted()
base.OnFrameworkInitializationCompleted();
}

private void NativeMenuItem_Click(object? sender, System.EventArgs e)
private void AboutMenu_Clicked(object? sender, System.EventArgs e)
{
if (_aboutWindowOpen)
{
_aboutWindow.Close();
_aboutWindowOpen = false;
}
else
{
_aboutWindow = new AboutWindow();
_aboutWindow.Show();
_aboutWindowOpen = true;
}
}
}
}
12 changes: 6 additions & 6 deletions src/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Dots
{
public partial class MainWindow : Window
{
MainViewModel _vm = new MainViewModel(new Services.DotnetService(),new Helpers.ErrorPopupHelper());
MainViewModel _vm = new MainViewModel(new Services.DotnetService(), new Helpers.ErrorPopupHelper());
AboutWindow _aboutWindow = new AboutWindow();
bool _aboutWindowOpen = false;

Expand All @@ -29,7 +29,7 @@ protected override void OnSizeChanged(SizeChangedEventArgs e)
protected override async void OnInitialized()
{
base.OnInitialized();
if(!await BlobCache.UserAccount.ContainsKey(Constants.LastCheckedKey))
if (!await BlobCache.UserAccount.ContainsKey(Constants.LastCheckedKey))
{
await BlobCache.UserAccount.InsertObject(Constants.LastCheckedKey, DateTime.Now);
}
Expand Down Expand Up @@ -72,16 +72,16 @@ private void ToggleDetails_Tapped(object? sender, Avalonia.Input.TappedEventArgs
SdkList.SelectedItem = null;
SdkList.Selection = null;
}
}
}

private void TextBox_TextChanged(object? sender, Avalonia.Controls.TextChangedEventArgs e)
{
_vm.FilterSdksCommand.Execute(MainSearchBar.Text);
}

private void SdkItem_Tapped(object? sender, Avalonia.Input.TappedEventArgs e)
{
if(e.Source is Control control && (control.Parent is Button || control.Parent.Parent is Button))
if (e.Source is Control control && (control.Parent is Button || control.Parent.Parent is Button))
{
//workaround for button click inside ListBox item
return;
Expand All @@ -90,7 +90,7 @@ private void SdkItem_Tapped(object? sender, Avalonia.Input.TappedEventArgs e)
paneWidth = paneWidth < 200 ? 200 : paneWidth;
MainSplitView.OpenPaneLength = Math.Min(paneWidth, 500);
var unselect = _vm.SetSelectedSdk((Sdk)((Avalonia.Controls.Grid)sender).DataContext);
if(unselect)
if (unselect)
{
SdkList.SelectedItem = null;
SdkList.Selection = null;
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.123
2.0.0

0 comments on commit 40c7084

Please sign in to comment.