mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Snackbar - Tweaked parameters
Plugins - Show exception message in snackbar
This commit is contained in:
parent
a47eedf1c2
commit
7bb246ea0b
@ -34,7 +34,7 @@ namespace Artemis.UI.Shared.Ninject
|
|||||||
.Configure(c => c.InSingletonScope());
|
.Configure(c => c.InSingletonScope());
|
||||||
});
|
});
|
||||||
|
|
||||||
Kernel.Bind<ISnackbarMessageQueue>().ToConstant(new SnackbarMessageQueue()).InSingletonScope();
|
Kernel.Bind<ISnackbarMessageQueue>().ToConstant(new SnackbarMessageQueue(TimeSpan.FromSeconds(5))).InSingletonScope();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@
|
|||||||
<ContentControl s:View.Model="{Binding ActiveItem}" Style="{StaticResource InitializingFade}" />
|
<ContentControl s:View.Model="{Binding ActiveItem}" Style="{StaticResource InitializingFade}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</materialDesign:DrawerHost>
|
</materialDesign:DrawerHost>
|
||||||
<materialDesign:Snackbar x:Name="MainSnackbar" MessageQueue="{Binding MainMessageQueue}" />
|
<materialDesign:Snackbar x:Name="MainSnackbar" MessageQueue="{Binding MainMessageQueue}" materialDesign:SnackbarMessage.InlineActionButtonMaxHeight="80" materialDesign:SnackbarMessage.ContentMaxHeight="200" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</materialDesign:DialogHost>
|
</materialDesign:DialogHost>
|
||||||
</mde:MaterialWindow>
|
</mde:MaterialWindow>
|
||||||
@ -36,7 +36,7 @@
|
|||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="80" />
|
<ColumnDefinition Width="80" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -45,9 +45,14 @@
|
|||||||
|
|
||||||
<materialDesign:PackIcon Kind="{Binding Icon}" Width="48" Height="48" Grid.Row="0" Grid.RowSpan="2" HorizontalAlignment="Center" />
|
<materialDesign:PackIcon Kind="{Binding Icon}" Width="48" Height="48" Grid.Row="0" Grid.RowSpan="2" HorizontalAlignment="Center" />
|
||||||
|
|
||||||
<TextBlock Grid.Column="1" Grid.Row="0" Style="{StaticResource MaterialDesignTextBlock}" Text="{Binding PluginInfo.Name}" />
|
<TextBlock Grid.Column="1" Grid.Row="0" Style="{StaticResource MaterialDesignTextBlock}" Text="{Binding PluginInfo.Name}" />
|
||||||
<materialDesign:Card Grid.Column="2" Grid.Row="0" Background="#FF4343" Height="22" Padding="4" Margin="0 -18 0 0"
|
<materialDesign:Card Grid.Column="2" Grid.Row="0"
|
||||||
Visibility="{Binding PluginInfo.LastEnableSuccessful, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}">
|
Background="#FF4343"
|
||||||
|
Foreground="White"
|
||||||
|
Height="22"
|
||||||
|
Padding="4"
|
||||||
|
Margin="0 -18 0 0"
|
||||||
|
Visibility="{Binding DisplayLoadFailed, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
|
||||||
LOAD FAILED
|
LOAD FAILED
|
||||||
</materialDesign:Card>
|
</materialDesign:Card>
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,8 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
|||||||
|
|
||||||
public bool Enabling { get; set; }
|
public bool Enabling { get; set; }
|
||||||
|
|
||||||
|
public bool DisplayLoadFailed => !Enabling && !PluginInfo.LastEnableSuccessful;
|
||||||
|
|
||||||
public async Task OpenSettings()
|
public async Task OpenSettings()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -106,7 +108,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
|||||||
{
|
{
|
||||||
if (PluginInfo.Enabled == enable)
|
if (PluginInfo.Enabled == enable)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => IsEnabled);
|
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +120,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
|||||||
);
|
);
|
||||||
if (!confirm)
|
if (!confirm)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => IsEnabled);
|
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,25 +128,28 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
|||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
Enabling = true;
|
Enabling = true;
|
||||||
|
NotifyOfPropertyChange(nameof(DisplayLoadFailed));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_pluginService.EnablePlugin(Plugin);
|
_pluginService.EnablePlugin(Plugin);
|
||||||
_snackbarMessageQueue.Enqueue($"Enabled plugin {PluginInfo.Name}");
|
_snackbarMessageQueue.Enqueue($"Enabled plugin {PluginInfo.Name}");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_snackbarMessageQueue.Enqueue($"Failed to enable plugin {PluginInfo.Name}", "VIEW LOGS", async () => await ShowLogsFolder());
|
_snackbarMessageQueue.Enqueue($"Failed to enable plugin {PluginInfo.Name}\r\n{e.Message}", "VIEW LOGS", async () => await ShowLogsFolder());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Enabling = false;
|
Enabling = false;
|
||||||
NotifyOfPropertyChange(() => IsEnabled);
|
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||||
|
NotifyOfPropertyChange(nameof(DisplayLoadFailed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_pluginService.DisablePlugin(Plugin);
|
_pluginService.DisablePlugin(Plugin);
|
||||||
|
|
||||||
NotifyOfPropertyChange(() => IsEnabled);
|
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user