Merge branch 'main' of https://git.azuze.fr/kawa/Sharepoint-Toolbox
This commit is contained in:
@@ -50,7 +50,6 @@ public partial class MainWindowViewModel : ObservableRecipient
|
||||
? string.Format(Localization.TranslationSource.Instance["toolbar.globalSites.count"], GlobalSelectedSites.Count)
|
||||
: Localization.TranslationSource.Instance["toolbar.globalSites.none"];
|
||||
|
||||
public IAsyncRelayCommand ConnectCommand { get; }
|
||||
public IAsyncRelayCommand ClearSessionCommand { get; }
|
||||
public RelayCommand ManageProfilesCommand { get; }
|
||||
public RelayCommand OpenGlobalSitePickerCommand { get; }
|
||||
@@ -64,7 +63,6 @@ public partial class MainWindowViewModel : ObservableRecipient
|
||||
_sessionManager = sessionManager;
|
||||
_logger = logger;
|
||||
|
||||
ConnectCommand = new AsyncRelayCommand(ConnectAsync, () => SelectedProfile != null);
|
||||
ClearSessionCommand = new AsyncRelayCommand(ClearSessionAsync, () => SelectedProfile != null);
|
||||
ManageProfilesCommand = new RelayCommand(OpenProfileManagement);
|
||||
OpenGlobalSitePickerCommand = new RelayCommand(ExecuteOpenGlobalSitePicker, () => SelectedProfile != null);
|
||||
@@ -96,7 +94,6 @@ public partial class MainWindowViewModel : ObservableRecipient
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(new TenantSwitchedMessage(value));
|
||||
}
|
||||
ConnectCommand.NotifyCanExecuteChanged();
|
||||
ClearSessionCommand.NotifyCanExecuteChanged();
|
||||
// Clear global site selection on tenant switch (sites belong to a tenant)
|
||||
GlobalSelectedSites.Clear();
|
||||
@@ -121,22 +118,6 @@ public partial class MainWindowViewModel : ObservableRecipient
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ConnectAsync()
|
||||
{
|
||||
if (SelectedProfile == null) return;
|
||||
try
|
||||
{
|
||||
ConnectionStatus = "Connecting...";
|
||||
await _sessionManager.GetOrCreateContextAsync(SelectedProfile, CancellationToken.None);
|
||||
ConnectionStatus = SelectedProfile.Name;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ConnectionStatus = "Connection failed";
|
||||
_logger.LogError(ex, "Failed to connect to tenant {TenantUrl}.", SelectedProfile.TenantUrl);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ClearSessionAsync()
|
||||
{
|
||||
if (SelectedProfile == null) return;
|
||||
|
||||
Reference in New Issue
Block a user