Skip to content

Commit

Permalink
Tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisxvin committed Feb 13, 2023
1 parent 246774c commit 046f2c5
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 54 deletions.
6 changes: 3 additions & 3 deletions src/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ namespace GoProPilot.ViewModels;
public class MainViewModel : ViewModelBase
{
private readonly Dispatcher _dispatcher = Dispatcher.UIThread;
private readonly MediaListViewModel _mediaListViewModel;
private readonly MediaListViewModel _mediaListVM;
private readonly SettingsViewModel _settingsVM;

public MainViewModel()
{
_mediaListViewModel = Globals.Container.Resolve<MediaListViewModel>();
_mediaListVM = Globals.Container.Resolve<MediaListViewModel>();
_settingsVM = Globals.Container.Resolve<SettingsViewModel>();
_settingsVM.PropertyChanged += SettingsVM_PropertyChanged;

Expand Down Expand Up @@ -155,7 +155,7 @@ private async void ExecuteConnect()
await Task.Delay(500);
if (IsConnected)
{
_mediaListViewModel.RefreshCommand.Execute().Subscribe();
_mediaListVM.RefreshCommand.Execute().Subscribe();
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/Views/DownloadView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,5 @@ public DownloadView()
InitializeComponent();
DataContext = Globals.Container.Resolve<DownloadViewModel>();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}

}
}
2 changes: 2 additions & 0 deletions src/Views/HomeView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
<TextBlock TextWrapping="Wrap">
<x:String xml:space="preserve">
For first time use, please go to "Settings" page, select your camera and WLAN interface, and set download folder.

Currently, after connecting to the camera, you need switch to "Media List" page manaully.
</x:String>
</TextBlock>
</StackPanel>
Expand Down
7 changes: 0 additions & 7 deletions src/Views/HomeView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace GoProPilot.Views;

Expand All @@ -9,10 +8,4 @@ public HomeView()
{
InitializeComponent();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}

}
27 changes: 7 additions & 20 deletions src/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,29 @@ namespace GoProPilot.Views;

public partial class MainView : UserControl, INavigationService
{
private Frame? _frameView;
private NavigationView? _navView;

public MainView()
{
InitializeComponent();
NavView.ItemInvoked += OnNavigationViewItemInvoked;

DataContext = Globals.Container.Resolve<MainViewModel>();
Globals.Container.RegisterInstance<INavigationService>(this, IfAlreadyRegistered.Replace);
}

public void NavigateTo(Type type)
{
_frameView?.Navigate(typeof(HomeView));
FrameView.Navigate(type);
}

protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);

_frameView = this.FindControl<Frame>("FrameView");
_navView = this.FindControl<NavigationView>("NavView");
if (_navView != null)
{
//_navView.MenuItems = GetNavigationViewItems();
//_navView.FooterMenuItems = GetFooterNavigationViewItems();
_navView.ItemInvoked += OnNavigationViewItemInvoked;

_navView.SelectedItem = _navView.MenuItems.Cast<NavigationViewItem>().FirstOrDefault();
_frameView?.Navigate(typeof(HomeView));
}
}
//_frameView = this.FindControl<Frame>("FrameView");
//_navView = this.FindControl<NavigationView>("NavView");

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
NavView.SelectedItem = NavView.MenuItems.Cast<NavigationViewItem>().FirstOrDefault();
FrameView.Navigate(typeof(HomeView));
}

private void OnNavigationViewItemInvoked(object? sender, NavigationViewItemInvokedEventArgs e)
Expand All @@ -57,7 +44,7 @@ private void OnNavigationViewItemInvoked(object? sender, NavigationViewItemInvok

if (e.InvokedItemContainer is NavigationViewItem nvi && nvi.Tag is Type t)
{
_frameView?.Navigate(t, null, e.RecommendedNavigationTransitionInfo);
FrameView.Navigate(t, null, e.RecommendedNavigationTransitionInfo);
}
}
}
5 changes: 0 additions & 5 deletions src/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ private void ApplicationActualThemeVariantChanged(object? sender, EventArgs e)
}
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}

private void TryEnableMicaEffect()
{
// The background colors for the Mica brush are still based around SolidBackgroundFillColorBase resource
Expand Down
6 changes: 0 additions & 6 deletions src/Views/MediaListView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using DryIoc;
using FluentAvalonia.UI.Controls;
using GoProPilot.ViewModels;
Expand All @@ -19,11 +18,6 @@ public MediaListView()
_downloadVM = Globals.Container.Resolve<DownloadViewModel>();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}

private void MediaFileHyperlink_Click(object sender, RoutedEventArgs e)
{
if (sender is HyperlinkButton btn)
Expand Down
7 changes: 0 additions & 7 deletions src/Views/SettingsView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using DryIoc;
using GoProPilot.ViewModels;

Expand All @@ -13,11 +12,5 @@ public SettingsView()

DataContext = Globals.Container.Resolve<SettingsViewModel>();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}

}
}

0 comments on commit 046f2c5

Please sign in to comment.