Multi instance, tab handling
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,14 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.VisualTree;
|
||||
using FileTime.App.Core.Services;
|
||||
using FileTime.App.Core.ViewModels;
|
||||
using FileTime.Core.Models;
|
||||
using FileTime.GuiApp.App.Services;
|
||||
using FileTime.GuiApp.App.Settings;
|
||||
using FileTime.GuiApp.App.ViewModels;
|
||||
using FileTime.Providers.Local;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -68,6 +70,7 @@ public partial class MainWindow : Window, IUiAccessor
|
||||
{
|
||||
var viewModel = DI.ServiceProvider.GetRequiredService<MainWindowViewModel>();
|
||||
viewModel.FocusDefaultElement = () => Focus();
|
||||
viewModel.ShowWindow = Activate;
|
||||
ViewModel = viewModel;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -128,17 +131,6 @@ public partial class MainWindow : Window, IUiAccessor
|
||||
{
|
||||
path = placeInfoPath;
|
||||
}
|
||||
/*else if (control.DataContext is IElement element && element.GetParent() is IContainer parentContainer)
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
await ViewModel.AppState.SelectedTab.OpenContainer(parentContainer);
|
||||
await ViewModel.AppState.SelectedTab.SetCurrentSelectedItem(element);
|
||||
});
|
||||
});
|
||||
}*/
|
||||
|
||||
if (path is null) return;
|
||||
|
||||
@@ -253,4 +245,13 @@ public partial class MainWindow : Window, IUiAccessor
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void SettingsButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var settingsWindow = new SettingsWindow
|
||||
{
|
||||
DataContext = DI.ServiceProvider.GetRequiredService<ISettingsViewModel>()
|
||||
};
|
||||
settingsWindow.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<Window
|
||||
Background="{DynamicResource AppBackgroundColor}"
|
||||
Height="500"
|
||||
Title="Settings"
|
||||
Width="600"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d"
|
||||
x:Class="FileTime.GuiApp.App.Views.SettingsWindow"
|
||||
x:CompileBindings="True"
|
||||
x:DataType="settings:ISettingsViewModel"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:settings="clr-namespace:FileTime.GuiApp.App.Settings"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Grid RowDefinitions="Auto * Auto">
|
||||
<TabStrip
|
||||
HorizontalAlignment="Center"
|
||||
ItemsSource="{Binding PaneItems}"
|
||||
SelectedItem="{Binding SelectedPaneItem}">
|
||||
<TabStrip.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Header}" />
|
||||
</DataTemplate>
|
||||
</TabStrip.ItemTemplate>
|
||||
</TabStrip>
|
||||
<Grid Grid.Row="1" Margin="10">
|
||||
<StackPanel IsVisible="{Binding SelectedPane, Converter={StaticResource EqualsConverter}, ConverterParameter={x:Static settings:SettingsPane.Advanced}}" VerticalAlignment="Top">
|
||||
|
||||
<ToggleSwitch IsChecked="{Binding SetAsDefaultIsChecked, Mode=TwoWay}">
|
||||
<ToggleSwitch.OnContent>Set as default file browser</ToggleSwitch.OnContent>
|
||||
<ToggleSwitch.OffContent>Set as default file browser</ToggleSwitch.OffContent>
|
||||
</ToggleSwitch>
|
||||
|
||||
<ToggleSwitch IsChecked="{Binding SetAsWinEHandlerIsChecked, Mode=TwoWay}">
|
||||
<ToggleSwitch.OnContent>Set Win+E shortcut</ToggleSwitch.OnContent>
|
||||
<ToggleSwitch.OffContent>Set Win+E shortcut</ToggleSwitch.OffContent>
|
||||
</ToggleSwitch>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace FileTime.GuiApp.App.Views;
|
||||
|
||||
public partial class SettingsWindow : Window
|
||||
{
|
||||
public SettingsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user