mirror of
https://github.com/k1tbyte/Wand-Enhancer.git
synced 2026-08-30 21:01:20 +00:00
e04e313fa3
Introduce IShellView and IFileDialogs so MainWindowVm no longer holds the concrete window or reaches through MainWindow.Instance, and file pickers are injectable. Run Restore off the UI thread like Patch and gate both buttons on IsBusy. Gate the log commands on a non-empty log. Move runtime log messages into the locale dictionaries and add the 14 new keys to all 12 languages. Track the injected locale dictionary so switching language replaces it instead of appending a new one each time. Remove the unused InfoItem control, ToVisibilityInvertedConverter, mw_title and the popup placeholder title.
65 lines
1.8 KiB
C#
65 lines
1.8 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
|
|
namespace WandEnhancer.View.MainWindow
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : IShellView
|
|
{
|
|
public static MainWindow Instance;
|
|
public readonly MainWindowVm ViewModel;
|
|
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
this.ViewModel = new MainWindowVm(this, new WindowsFileDialogs());
|
|
this.DataContext = ViewModel;
|
|
VersionLabel.Text = Constants.Version.ToString();
|
|
Instance = this;
|
|
}
|
|
|
|
public void OpenPopup(FrameworkElement content, string title = null)
|
|
{
|
|
this.PopupHost.PopupContent = content;
|
|
PopupHost.Title.Text = title;
|
|
PopupHost.IsOpen = true;
|
|
}
|
|
|
|
public void ScrollLogIntoView(LogEntry entry)
|
|
{
|
|
this.LogList.ScrollIntoView(entry);
|
|
}
|
|
|
|
private void OnDragMove(object sender, MouseButtonEventArgs e)
|
|
{
|
|
this.DragMove();
|
|
}
|
|
|
|
private void OnClosing(object sender, RoutedEventArgs e)
|
|
{
|
|
Application.Current.Shutdown();
|
|
}
|
|
|
|
public void ClosePopup()
|
|
{
|
|
PopupHost.IsOpen = false;
|
|
}
|
|
|
|
private void OpenSourceClicked(object sender, MouseButtonEventArgs e)
|
|
{
|
|
// No browser association, or the shell refuses the URL: not worth killing the app.
|
|
try
|
|
{
|
|
System.Diagnostics.Process.Start(Constants.RepositoryUrl);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
ViewModel.ReportRepositoryLinkFailure(Constants.RepositoryUrl);
|
|
}
|
|
}
|
|
}
|
|
} |