From 37744138158c145c7f14f226ff7aca550dc21996 Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Mon, 11 Sep 2023 13:07:18 -0700 Subject: [PATCH 1/6] bitbucket: drop WPF-based UI helper for Bitbucket --- Git-Credential-Manager.sln | 13 -- .../Assets/Styles.xaml | 6 - .../Assets/atlassian-logo.png | Bin 13455 -> 0 bytes .../Atlassian.Bitbucket.UI.Windows.csproj | 25 ---- .../Commands/CredentialsCommandImpl.cs | 20 --- .../Controls/TesterWindow.xaml | 35 ----- .../Controls/TesterWindow.xaml.cs | 38 ------ .../Atlassian.Bitbucket.UI.Windows/Program.cs | 45 ------- .../Views/CredentialsView.xaml | 121 ------------------ .../Views/CredentialsView.xaml.cs | 73 ----------- .../Installer.Windows.csproj | 1 - src/windows/Installer.Windows/layout.ps1 | 6 - 12 files changed, 383 deletions(-) delete mode 100644 src/windows/Atlassian.Bitbucket.UI.Windows/Assets/Styles.xaml delete mode 100644 src/windows/Atlassian.Bitbucket.UI.Windows/Assets/atlassian-logo.png delete mode 100644 src/windows/Atlassian.Bitbucket.UI.Windows/Atlassian.Bitbucket.UI.Windows.csproj delete mode 100644 src/windows/Atlassian.Bitbucket.UI.Windows/Commands/CredentialsCommandImpl.cs delete mode 100644 src/windows/Atlassian.Bitbucket.UI.Windows/Controls/TesterWindow.xaml delete mode 100644 src/windows/Atlassian.Bitbucket.UI.Windows/Controls/TesterWindow.xaml.cs delete mode 100644 src/windows/Atlassian.Bitbucket.UI.Windows/Program.cs delete mode 100644 src/windows/Atlassian.Bitbucket.UI.Windows/Views/CredentialsView.xaml delete mode 100644 src/windows/Atlassian.Bitbucket.UI.Windows/Views/CredentialsView.xaml.cs diff --git a/Git-Credential-Manager.sln b/Git-Credential-Manager.sln index 75e1254b7..dfbb59868 100644 --- a/Git-Credential-Manager.sln +++ b/Git-Credential-Manager.sln @@ -43,8 +43,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "linux", "linux", "{8F9D7E67 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.UI.Windows", "src\windows\GitHub.UI.Windows\GitHub.UI.Windows.csproj", "{0A86ED89-1FC5-42AA-925C-4578FA30607A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Atlassian.Bitbucket.UI.Windows", "src\windows\Atlassian.Bitbucket.UI.Windows\Atlassian.Bitbucket.UI.Windows.csproj", "{3F015046-DAF2-4D2A-96EC-F9782F169E45}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitLab", "src\shared\GitLab\GitLab.csproj", "{570897DC-A85C-4598-B793-9A00CF710119}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitLab.Tests", "src\shared\GitLab.Tests\GitLab.Tests.csproj", "{1AF9F7C5-FA2E-48F1-B216-4D5E9A27F393}" @@ -275,16 +273,6 @@ Global {0A86ED89-1FC5-42AA-925C-4578FA30607A}.MacRelease|Any CPU.ActiveCfg = Release|Any CPU {0A86ED89-1FC5-42AA-925C-4578FA30607A}.WindowsRelease|Any CPU.ActiveCfg = Release|Any CPU {0A86ED89-1FC5-42AA-925C-4578FA30607A}.WindowsRelease|Any CPU.Build.0 = Release|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.MacDebug|Any CPU.ActiveCfg = Debug|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.WindowsDebug|Any CPU.ActiveCfg = Debug|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.WindowsDebug|Any CPU.Build.0 = Debug|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.LinuxDebug|Any CPU.ActiveCfg = Debug|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.LinuxRelease|Any CPU.ActiveCfg = Release|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.MacRelease|Any CPU.ActiveCfg = Release|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.WindowsRelease|Any CPU.ActiveCfg = Release|Any CPU - {3F015046-DAF2-4D2A-96EC-F9782F169E45}.WindowsRelease|Any CPU.Build.0 = Release|Any CPU {570897DC-A85C-4598-B793-9A00CF710119}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {570897DC-A85C-4598-B793-9A00CF710119}.Debug|Any CPU.Build.0 = Debug|Any CPU {570897DC-A85C-4598-B793-9A00CF710119}.MacDebug|Any CPU.ActiveCfg = Debug|Any CPU @@ -361,7 +349,6 @@ Global {8F9D7E67-7DD7-4E32-9134-423281AF00E9} = {A7FC1234-95E3-4496-B5F7-4306F41E6A0E} {AD2A935F-3720-4802-8119-6A9B35B254DF} = {8F9D7E67-7DD7-4E32-9134-423281AF00E9} {0A86ED89-1FC5-42AA-925C-4578FA30607A} = {66722747-1B61-40E4-A89B-1AC8E6D62EA9} - {3F015046-DAF2-4D2A-96EC-F9782F169E45} = {66722747-1B61-40E4-A89B-1AC8E6D62EA9} {570897DC-A85C-4598-B793-9A00CF710119} = {D5277A0E-997E-453A-8CB9-4EFCC8B16A29} {1AF9F7C5-FA2E-48F1-B216-4D5E9A27F393} = {D5277A0E-997E-453A-8CB9-4EFCC8B16A29} {83EAC1F9-8E1F-41FC-8FC9-2C452452D64E} = {66722747-1B61-40E4-A89B-1AC8E6D62EA9} diff --git a/src/windows/Atlassian.Bitbucket.UI.Windows/Assets/Styles.xaml b/src/windows/Atlassian.Bitbucket.UI.Windows/Assets/Styles.xaml deleted file mode 100644 index 67fe8a512..000000000 --- a/src/windows/Atlassian.Bitbucket.UI.Windows/Assets/Styles.xaml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/src/windows/Atlassian.Bitbucket.UI.Windows/Assets/atlassian-logo.png b/src/windows/Atlassian.Bitbucket.UI.Windows/Assets/atlassian-logo.png deleted file mode 100644 index 6226f936d1adeafa210967f8bbf704e1557349ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13455 zcmeHu_d8rs*LD&qL=8!_K|~O}B!f{CBBIyPOBf=$8PQu3M6?+sIwK<5=tS>zlng-_ zT^PMHdVNox=lvtT>$~0`&K!H6b9PyK?X~W;?k!A9Ly7V>)9ou)u23q!dZBaW%5}(< zD^~?bZvr*fcIsq-8=31XBeyG8?sNXTt}5$1+P-q-!4>5f&-J`gH>LtnpfMl%Z47QY z`g*IE_Otiz#}uz#+7&O}7(Knco?k=8u2LfOnUwu^-|b);a^vEUoWa3Ghm<7;I<;BhnO~Pp8zt!nqmnR*__0d4(*VWqA+F~@)+*XM-$#ou@W9X#KBFQC_ zes2w#6dW%wu=kS<3yjx+KU5yf1HV_o|L^wyg$TAQb4oEqas`_P(0%8ljdB;+BD6cz zHDHBf_50tHcgrf^+4S+rTA3IOGhh12atbP6DNXL520U_D?S--ylSwei)n1g;PI=!2 zDqoFQD(hwg&y*>gKzA5Y}}XS3L}{U9LQ!{(_mW20Ao?4&&1_ zP1V5vntJ4H9|uB7q8yd}w)dgM5$^b4=N{?4+P@6gmV&~T~%v%1#D{b{E~oXw!$ zDiC$0`R8ybH*RopkzfqPVP%JVimP@2*>1JMXF_HS$_XT}6!f1^?uee5l-XmW^L@oW zbi(VM)P__Rw)*|FSTo=wD!SE0{}V?Hlx=^uyJE!ckKei{RX9w}Z_?i12^VPo z6P>e^6dHwk*g(D7$FX4N{CisUZ{0}&29w#Bx$t>Ed8#9atipr=;kRoCXIC19W);^l zPw3!UimYzJ>FpZhvGgF4dG5Ftg1NsJ!V{3!Pa#iv89E|dvbqK5=&2ALn=QIP1cq6cs=y=WAW)$a zwkGfAn_=;4ApAC@b)*!=wT^*|eu^exFb*fdc2mD;Yp+>R-zAU*Gp{|RTM+iWb#P(U4OU6pV1s4i(sGy z&7OO7f}&c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8(#3{{XDzhR6T_ diff --git a/src/windows/Atlassian.Bitbucket.UI.Windows/Atlassian.Bitbucket.UI.Windows.csproj b/src/windows/Atlassian.Bitbucket.UI.Windows/Atlassian.Bitbucket.UI.Windows.csproj deleted file mode 100644 index f74d8c2b8..000000000 --- a/src/windows/Atlassian.Bitbucket.UI.Windows/Atlassian.Bitbucket.UI.Windows.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - Exe - net472 - true - Atlassian.Bitbucket.UI.Windows - Atlassian.Bitbucket.UI - Atlassian.Bitbucket.UI.Windows.Program - - - - - - - - - - - - - - - - diff --git a/src/windows/Atlassian.Bitbucket.UI.Windows/Commands/CredentialsCommandImpl.cs b/src/windows/Atlassian.Bitbucket.UI.Windows/Commands/CredentialsCommandImpl.cs deleted file mode 100644 index ecfc6b891..000000000 --- a/src/windows/Atlassian.Bitbucket.UI.Windows/Commands/CredentialsCommandImpl.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Atlassian.Bitbucket.UI.Commands; -using Atlassian.Bitbucket.UI.ViewModels; -using Atlassian.Bitbucket.UI.Windows.Views; -using GitCredentialManager; -using GitCredentialManager.UI.Windows; - -namespace Atlassian.Bitbucket.UI.Windows.Commands -{ - public class CredentialsCommandImpl : CredentialsCommand - { - public CredentialsCommandImpl(ICommandContext context) : base(context) { } - - protected override Task ShowAsync(CredentialsViewModel viewModel, CancellationToken ct) - { - return Gui.ShowDialogWindow(viewModel, () => new CredentialsView(), GetParentHandle()); - } - } -} diff --git a/src/windows/Atlassian.Bitbucket.UI.Windows/Controls/TesterWindow.xaml b/src/windows/Atlassian.Bitbucket.UI.Windows/Controls/TesterWindow.xaml deleted file mode 100644 index f221e6f13..000000000 --- a/src/windows/Atlassian.Bitbucket.UI.Windows/Controls/TesterWindow.xaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/windows/Core.UI.Windows/Controls/WpfDialogWindow.xaml.cs b/src/windows/Core.UI.Windows/Controls/WpfDialogWindow.xaml.cs deleted file mode 100644 index d6fc69f1d..000000000 --- a/src/windows/Core.UI.Windows/Controls/WpfDialogWindow.xaml.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Threading; -using GitCredentialManager.UI.Controls; -using GitCredentialManager.UI.ViewModels; - -namespace GitCredentialManager.UI.Windows.Controls -{ - public partial class WpfDialogWindow : Window - { - private readonly UserControl _view; - - public WpfDialogWindow(UserControl view) - { - InitializeComponent(); - - DataContextChanged += OnDataContextChanged; - - _view = view; - ContentHolder.Content = _view; - } - - private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) - { - if (DataContext is WindowViewModel vm) - { - vm.Accepted += (s, _) => - { - DialogResult = true; - Close(); - }; - - vm.Canceled += (s, _) => - { - DialogResult = false; - Close(); - }; - } - - if (_view is IFocusable focusable) - { - // Send a focus request to the child view on idle - System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => focusable.SetFocus())); - } - } - - private void CloseButton_Click(object sender, RoutedEventArgs e) - { - if (DataContext is WindowViewModel vm) - { - vm.Cancel(); - } - } - - private void Border_MouseDown(object sender, MouseButtonEventArgs e) - { - if (e.ChangedButton == MouseButton.Left) - { - DragMove(); - } - } - } -} diff --git a/src/windows/Core.UI.Windows/Converters/BooleanConverters.cs b/src/windows/Core.UI.Windows/Converters/BooleanConverters.cs deleted file mode 100644 index be195a751..000000000 --- a/src/windows/Core.UI.Windows/Converters/BooleanConverters.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Globalization; -using System.Linq; -using System.Windows; -using System.Windows.Data; - -namespace GitCredentialManager.UI.Windows.Converters -{ - [ValueConversion(typeof(bool), typeof(bool))] - public class BooleanNotConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return !(bool)value; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return Binding.DoNothing; - } - } - - [ValueConversion(typeof(bool), typeof(bool))] - public class BooleanOrConverter : IMultiValueConverter - { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) - { - return values.Cast().Aggregate(false, (x, y) => x || y); - } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) - { - return new[] { Binding.DoNothing }; - } - } - - [ValueConversion(typeof(bool), typeof(Visibility))] - public class BooleanToVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return ConverterHelper.GetConditionalVisibility((bool)value, parameter); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return Binding.DoNothing; - } - } - - [ValueConversion(typeof(bool), typeof(Visibility))] - public class BooleanOrToVisibilityConverter : IMultiValueConverter - { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) - { - bool show = values.Cast().Aggregate(false, (x, y) => x || y); - return ConverterHelper.GetConditionalVisibility(show, parameter); - } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) - { - return new[] { Binding.DoNothing }; - } - } - - [ValueConversion(typeof(bool), typeof(Visibility))] - public class BooleanAndToVisibilityConverter : IMultiValueConverter - { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) - { - bool show = values.Cast().Aggregate(true, (x, y) => x && y); - return ConverterHelper.GetConditionalVisibility(show, parameter); - } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) - { - return new[] { Binding.DoNothing }; - } - } -} diff --git a/src/windows/Core.UI.Windows/Converters/ConverterUtils.cs b/src/windows/Core.UI.Windows/Converters/ConverterUtils.cs deleted file mode 100644 index bf91e1e78..000000000 --- a/src/windows/Core.UI.Windows/Converters/ConverterUtils.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Windows; - -namespace GitCredentialManager.UI.Windows.Converters -{ - public class ConverterHelper - { - private static char[] s_commaSeparator = new char[] { ',' }; - - /// - /// Returns true if parameter contains the specified option text. - /// - /// comma-separated options - /// option to search - /// true if parameter contains option, false otherwise - private static bool ParameterContains(object parameter, String option) - { - string arg = parameter as string; - if (!string.IsNullOrEmpty(arg)) - { - string[] optionArgs = arg.Split(s_commaSeparator, StringSplitOptions.RemoveEmptyEntries); - foreach (string optionArg in optionArgs) - { - if (optionArg.Equals(option, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - } - return false; - } - - /// - /// Returns true if parameter contains "Not", "!", or "Invert". - /// - /// comma-separated options - /// true if parameter has the invert option - public static bool GetInvert(object parameter) - { - string arg = parameter as String; - if (!string.IsNullOrEmpty(arg)) - { - string[] options = arg.Split(s_commaSeparator, StringSplitOptions.RemoveEmptyEntries); - foreach (string option in options) - { - if (option.Equals("Not", StringComparison.OrdinalIgnoreCase) || - option.Equals("!", StringComparison.OrdinalIgnoreCase) || - option.Equals("Invert", StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - } - return false; - } - - /// - /// Returns the appropriate Visibility based on the show condition - /// and the preferred Visibility.Collaped or Visibility.Hidden option - /// in parameter. - /// - /// true to get Visibility.Visible, - /// false for Visibility.Collapsed or Visibility.Hidden depending on parameter. - /// comma-separated options. "Not", "!", or "Invert" to invert - /// the bool evaluation before converting to Visibility. "Hidden" to get - /// Visibility.Hidden (where the default is Visibility.Collapsed). - /// Visibility.Collapsed or Visibility.Hidden - public static Visibility GetConditionalVisibility(bool show, object parameter) - { - return GetConditionalVisibility(show, parameter, false); - } - - /// - /// Returns the appropriate Visibility based on the show condition - /// and the preferred Visibility.Collaped or Visibility.Hidden option - /// in parameter. - /// - /// true to get Visibility.Visible, - /// false for Visibility.Collapsed or Visibility.Hidden depending on parameter. - /// comma-separated options. "Not", "!", or "Invert" to invert - /// the bool evaluation before converting to Visibility. "Hidden" to get - /// Visibility.Hidden (where the default is Visibility.Collapsed). - /// true to ignore the Invert option in parameter. - /// This is used to avoid double-inverting. - /// Visibility.Collapsed or Visibility.Hidden - public static Visibility GetConditionalVisibility(bool show, object parameter, bool ignoreInvert) - { - bool result = show; - if (!ignoreInvert && GetInvert(parameter)) - { - result = !show; - } - return result ? Visibility.Visible : GetCollapsedOrHidden(parameter); - } - - /// - /// Returns Visibility.Hidden if parameter contains "Hidden". Default is - /// Visibility.Collapsed. - /// - /// comma-separated options. "Hidden" to get - /// Visibility.Hidden. Default is Visibility.Collapsed. - /// Visibility.Collapsed or Visibility.Hidden - internal static Visibility GetCollapsedOrHidden(object parameter) - { - return ParameterContains(parameter, "Hidden") ? Visibility.Hidden : Visibility.Collapsed; - } - - /// - /// Returns Visibility.Hidden if parameter[argIndex] contains "Hidden". Default is - /// Visibility.Collapsed. - /// - /// parameter[argIndex] as comma-separated options. - /// "Hidden" to get Visibility.Hidden. Default is Visibility.Collapsed. - /// index to the actual argument to use in the parameter String[] - /// Visibility - public static Visibility GetCollapsedOrHiddenFromArray(object parameter, int argIndex) - { - object[] args = parameter as object[]; - if (args != null && args.Length >= argIndex + 1) - { - return GetCollapsedOrHidden(args[argIndex] as string); - } - return Visibility.Collapsed; - } - } -} diff --git a/src/windows/Core.UI.Windows/Converters/NonEmptyStringToVisibleConverter.cs b/src/windows/Core.UI.Windows/Converters/NonEmptyStringToVisibleConverter.cs deleted file mode 100644 index 6fda85bd2..000000000 --- a/src/windows/Core.UI.Windows/Converters/NonEmptyStringToVisibleConverter.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Globalization; -using System.Windows; -using System.Windows.Data; - -namespace GitCredentialManager.UI.Windows.Converters -{ - [ValueConversion(typeof(string), typeof(Visibility))] - public class NonEmptyStringToVisibleConverter : IValueConverter - { - public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return ConverterHelper.GetConditionalVisibility(!string.IsNullOrEmpty(value as string), parameter); - } - - public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return Binding.DoNothing; - } - } - - [ValueConversion(typeof(string), typeof(Visibility))] - public class NonNullToVisibleConverter : IValueConverter - { - public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return ConverterHelper.GetConditionalVisibility(value != null, parameter); - } - - public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return Binding.DoNothing; - } - } -} diff --git a/src/windows/Core.UI.Windows/Core.UI.Windows.csproj b/src/windows/Core.UI.Windows/Core.UI.Windows.csproj deleted file mode 100644 index ba14edca4..000000000 --- a/src/windows/Core.UI.Windows/Core.UI.Windows.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net472 - true - GitCredentialManager.UI.Windows - gcmcoreuiwpf - - - - - - - - - - - diff --git a/src/windows/Core.UI.Windows/Gui.cs b/src/windows/Core.UI.Windows/Gui.cs deleted file mode 100644 index 81508bf9f..000000000 --- a/src/windows/Core.UI.Windows/Gui.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using GitCredentialManager.UI.ViewModels; -using GitCredentialManager.UI.Windows.Controls; - -namespace GitCredentialManager.UI.Windows -{ - public static class Gui - { - /// - /// Present the user with a . - /// - /// factory. - /// Parent window handle. - /// - /// Returns `` if the user completed the dialog; otherwise `` - /// if the user canceled or abandoned the dialog. - /// - public static Task ShowWindow(Func windowCreator, IntPtr parentHwnd) - { - return StartSTATask(() => ShowDialog(windowCreator(), parentHwnd)); - } - - /// - /// Present the user with a . - /// - /// - /// Returns `` if the user completed the dialog and the view model is valid; - /// otherwise `` if the user canceled or abandoned the dialog, or the view - /// model is invalid. - /// - /// Window view model. - /// Window content factory. - /// Parent window handle. - public static Task ShowDialogWindow(WindowViewModel viewModel, Func contentCreator, IntPtr parentHwnd) - { - return ShowWindow(() => new WpfDialogWindow(contentCreator()) { DataContext = viewModel }, parentHwnd); - } - - private static Task StartSTATask(Action action) - { - var completionSource = new TaskCompletionSource(); - var thread = new Thread(() => - { - try - { - action(); - completionSource.SetResult(null); - } - catch (Exception e) - { - completionSource.SetException(e); - } - }); - - thread.SetApartmentState(ApartmentState.STA); - thread.Start(); - - return completionSource.Task; - } - - public static bool? ShowDialog(Window window, IntPtr parentHwnd) - { - // Zero is not a valid window handle - if (parentHwnd == IntPtr.Zero) - { - return window.ShowDialog(); - } - - // Set the parent window handle and ensure the dialog starts in the correct location - new System.Windows.Interop.WindowInteropHelper(window).Owner = parentHwnd; - window.WindowStartupLocation = WindowStartupLocation.CenterOwner; - - const int ERROR_INVALID_WINDOW_HANDLE = 1400; - - try - { - return window.ShowDialog(); - } - catch (Win32Exception ex) when (ex.NativeErrorCode == ERROR_INVALID_WINDOW_HANDLE) - { - // The window handle given was invalid - clear the owner and show the dialog centered on the screen - window.Owner = null; - window.WindowStartupLocation = WindowStartupLocation.CenterScreen; - return window.ShowDialog(); - } - } - } -} diff --git a/src/windows/Installer.Windows/Installer.Windows.csproj b/src/windows/Installer.Windows/Installer.Windows.csproj index 936bdb98e..99253c445 100644 --- a/src/windows/Installer.Windows/Installer.Windows.csproj +++ b/src/windows/Installer.Windows/Installer.Windows.csproj @@ -11,7 +11,6 @@ - From 1e904d1035641393ce87c8297670574ff0197f32 Mon Sep 17 00:00:00 2001 From: Matthew Cheetham Date: Mon, 11 Sep 2023 14:47:27 -0700 Subject: [PATCH 6/6] msauth: replace WPF progress window with Avalonia --- .../Authentication/MicrosoftAuthentication.cs | 96 ++----------------- .../Core/UI/Controls/ProgressWindow.axaml | 14 +++ .../Core/UI/Controls/ProgressWindow.axaml.cs | 37 +++++++ 3 files changed, 61 insertions(+), 86 deletions(-) create mode 100644 src/shared/Core/UI/Controls/ProgressWindow.axaml create mode 100644 src/shared/Core/UI/Controls/ProgressWindow.axaml.cs diff --git a/src/shared/Core/Authentication/MicrosoftAuthentication.cs b/src/shared/Core/Authentication/MicrosoftAuthentication.cs index 0dd0fefa4..b39cc1a73 100644 --- a/src/shared/Core/Authentication/MicrosoftAuthentication.cs +++ b/src/shared/Core/Authentication/MicrosoftAuthentication.cs @@ -11,13 +11,12 @@ using System.Text; using System.Threading; using GitCredentialManager.UI; +using GitCredentialManager.UI.Controls; using GitCredentialManager.UI.ViewModels; using GitCredentialManager.UI.Views; using Microsoft.Identity.Client.AppConfig; #if NETFRAMEWORK -using System.Drawing; -using System.Windows.Forms; using Microsoft.Identity.Client.Broker; #endif @@ -118,10 +117,6 @@ public class MicrosoftAuthentication : AuthenticationBase, IMicrosoftAuthenticat "live", "liveconnect", "liveid", }; -#if NETFRAMEWORK - private DummyWindow _dummyWindow; -#endif - public MicrosoftAuthentication(ICommandContext context) : base(context) { } @@ -130,6 +125,8 @@ public MicrosoftAuthentication(ICommandContext context) public async Task GetTokenForUserAsync( string authority, string clientId, Uri redirectUri, string[] scopes, string userName, bool msaPt) { + var uiCts = new CancellationTokenSource(); + // Check if we can and should use OS broker authentication bool useBroker = CanUseBroker(); Context.Trace.WriteLine(useBroker @@ -144,7 +141,7 @@ public async Task GetTokenForUserAsync( try { // Create the public client application for authentication - IPublicClientApplication app = await CreatePublicClientApplicationAsync(authority, clientId, redirectUri, useBroker, msaPt); + IPublicClientApplication app = await CreatePublicClientApplicationAsync(authority, clientId, redirectUri, useBroker, msaPt, uiCts); AuthenticationResult result = null; @@ -261,10 +258,8 @@ public async Task GetTokenForUserAsync( } finally { -#if NETFRAMEWORK - // If we created a dummy window during authentication we should dispose of it now that we're done - _dummyWindow?.Dispose(); -#endif + // If we created some global UI (e.g. progress) during authentication we should dismiss them now that we're done + uiCts.Cancel(); } } @@ -451,8 +446,8 @@ private async Task GetAccessTokenSilentlyAsync( } } - private async Task CreatePublicClientApplicationAsync( - string authority, string clientId, Uri redirectUri, bool enableBroker, bool msaPt) + private async Task CreatePublicClientApplicationAsync(string authority, + string clientId, Uri redirectUri, bool enableBroker, bool msaPt, CancellationTokenSource uiCts) { var httpFactoryAdaptor = new MsalHttpClientFactoryAdaptor(Context.HttpClientFactory); @@ -495,11 +490,8 @@ private async Task CreatePublicClientApplicationAsync( } else if (enableBroker) // Only actually need to set a parent window when using the Windows broker { -#if NETFRAMEWORK - Context.Trace.WriteLine($"Using dummy parent window for MSAL authentication dialogs."); - _dummyWindow = new DummyWindow(); - appBuilder.WithParentActivityOrWindow(_dummyWindow.ShowAndGetHandle); -#endif + Context.Trace.WriteLine("Using progress parent window for MSAL authentication dialogs."); + appBuilder.WithParentActivityOrWindow(() => ProgressWindow.ShowAndGetHandle(uiCts.Token)); } } } @@ -899,73 +891,5 @@ public MsalResult(AuthenticationResult msalResult) public string AccessToken => _msalResult.AccessToken; public string AccountUpn => _msalResult.Account?.Username; } - -#if NETFRAMEWORK - private class DummyWindow : IDisposable - { - private readonly Thread _staThread; - private readonly ManualResetEventSlim _readyEvent; - private Form _window; - private IntPtr _handle; - - public DummyWindow() - { - _staThread = new Thread(ThreadProc); - _staThread.SetApartmentState(ApartmentState.STA); - _readyEvent = new ManualResetEventSlim(); - } - - public IntPtr ShowAndGetHandle() - { - _staThread.Start(); - _readyEvent.Wait(); - return _handle; - } - - public void Dispose() - { - _window?.Invoke(() => _window.Close()); - - if (_staThread.IsAlive) - { - _staThread.Join(); - } - } - - private void ThreadProc() - { - System.Windows.Forms.Application.EnableVisualStyles(); - _window = new Form - { - TopMost = true, - ControlBox = false, - MaximizeBox = false, - MinimizeBox = false, - ClientSize = new Size(182, 46), - FormBorderStyle = FormBorderStyle.None, - StartPosition = FormStartPosition.CenterScreen, - }; - - var progress = new ProgressBar - { - Style = ProgressBarStyle.Marquee, - Location = new Point(12, 12), - Size = new Size(158, 23), - MarqueeAnimationSpeed = 30, - }; - - _window.Controls.Add(progress); - _window.Shown += (s, e) => - { - _handle = _window.Handle; - _readyEvent.Set(); - }; - - _window.ShowDialog(); - _window.Dispose(); - _window = null; - } - } -#endif } } diff --git a/src/shared/Core/UI/Controls/ProgressWindow.axaml b/src/shared/Core/UI/Controls/ProgressWindow.axaml new file mode 100644 index 000000000..3bfc20f5c --- /dev/null +++ b/src/shared/Core/UI/Controls/ProgressWindow.axaml @@ -0,0 +1,14 @@ + + + diff --git a/src/shared/Core/UI/Controls/ProgressWindow.axaml.cs b/src/shared/Core/UI/Controls/ProgressWindow.axaml.cs new file mode 100644 index 000000000..7dc46dac6 --- /dev/null +++ b/src/shared/Core/UI/Controls/ProgressWindow.axaml.cs @@ -0,0 +1,37 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace GitCredentialManager.UI.Controls; + +public partial class ProgressWindow : Window +{ + public ProgressWindow() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + + public static IntPtr ShowAndGetHandle(CancellationToken ct) + { + var tsc = new TaskCompletionSource(); + + Window CreateWindow() + { + var window = new ProgressWindow(); + window.Loaded += (s, e) => tsc.SetResult(window.TryGetPlatformHandle()?.Handle ?? IntPtr.Zero); + return window; + } + + Task _ = AvaloniaUi.ShowWindowAsync(CreateWindow, IntPtr.Zero, ct); + + return tsc.Task.GetAwaiter().GetResult(); + } +}