Added logout functionality. IO-403

This commit is contained in:
Patrick Fic
2021-01-18 11:36:07 -08:00
parent 8b63557912
commit 34a5ae2292
5 changed files with 46 additions and 2 deletions

View File

@@ -60,6 +60,15 @@ namespace BodyshopPartner.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Log out.
/// </summary>
public static string Actions_Logout {
get {
return ResourceManager.GetString("Actions_Logout", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to An issue has occured. Please check the log files.. /// Looks up a localized string similar to An issue has occured. Please check the log files..
/// </summary> /// </summary>

View File

@@ -117,6 +117,9 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="Actions_Logout" xml:space="preserve">
<value>Log out</value>
</data>
<data name="Error_Generic" xml:space="preserve"> <data name="Error_Generic" xml:space="preserve">
<value>An issue has occured. Please check the log files.</value> <value>An issue has occured. Please check the log files.</value>
</data> </data>

View File

@@ -174,5 +174,25 @@ namespace BodyshopPartner.ViewModels
} }
} }
private ICommand _logoutCommand;
public ICommand LogoutCommand
{
get
{
if (_logoutCommand == null)
{
_logoutCommand = new RelayCommand(
p => true,
p =>
{
Logout();
});
}
return _logoutCommand;
}
}
} }
} }

View File

@@ -189,7 +189,16 @@ namespace BodyshopPartner.ViewModels
IndeterminateLoading = false; IndeterminateLoading = false;
} }
public async Task LoadBodyshopData()
public void Logout()
{
Properties.Settings.Default.AuthToken = "";
Properties.Settings.Default.RefreshToken = "";
Properties.Settings.Default.Save();
App.Current.Shutdown();
}
public async Task LoadBodyshopData()
{ {
var r = new GraphQLRequest var r = new GraphQLRequest
{ {

View File

@@ -110,7 +110,7 @@
<StackPanel DockPanel.Dock="Right"> <StackPanel DockPanel.Dock="Right">
<ComboBox ItemsSource="{Binding ShopData}" <ComboBox ItemsSource="{Binding ShopData}"
Margin="8" Margin="4"
SelectedItem="{Binding ActiveShop}" SelectedItem="{Binding ActiveShop}"
Style="{StaticResource MaterialDesignFloatingHintComboBox}" Style="{StaticResource MaterialDesignFloatingHintComboBox}"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_ActiveShop}" materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_ActiveShop}"
@@ -121,6 +121,9 @@
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ComboBox.ItemsPanel> </ComboBox.ItemsPanel>
</ComboBox> </ComboBox>
<Button Command="{Binding LogoutCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Actions_Logout}" />
<Separator /> <Separator />
<CheckBox IsChecked="{Binding Source={x:Static p:Settings.Default}, Path=AutoStartMonitor}" <CheckBox IsChecked="{Binding Source={x:Static p:Settings.Default}, Path=AutoStartMonitor}"
Margin="8" Margin="8"