mirror of
https://github.com/4sval/FModel.git
synced 2026-08-06 03:03:04 -05:00
Remove individual items from the queue
This commit is contained in:
parent
cd21f942e9
commit
4729b425ac
|
|
@ -1 +1 @@
|
|||
Subproject commit d1c7083f32c1a6bf9aa4b2b25e9fd3a6cd53073f
|
||||
Subproject commit 2436a339bae75b2ac5866d2127a6ef408b90acb2
|
||||
|
|
@ -250,6 +250,22 @@ public class ExportSessionViewModel : ViewModel
|
|||
ClearExportHistory();
|
||||
}
|
||||
|
||||
public void RemoveFromQueue(ObjectGroupViewModel item)
|
||||
{
|
||||
if (IsRunning || _session?.Remove(item.Path) != true)
|
||||
return;
|
||||
|
||||
var group = ClassGroups.FirstOrDefault(x => x.Objects.Contains(item));
|
||||
if (group == null)
|
||||
return;
|
||||
|
||||
group.Objects.Remove(item);
|
||||
if (group.Objects.Count == 0)
|
||||
{
|
||||
ClassGroups.Remove(group);
|
||||
}
|
||||
}
|
||||
|
||||
private void StartUiTimer()
|
||||
{
|
||||
_uiTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) };
|
||||
|
|
|
|||
|
|
@ -199,19 +199,54 @@
|
|||
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"
|
||||
ToolTip="{Binding Path}" />
|
||||
|
||||
<Button Grid.Column="3" ToolTip="Open in Explorer" Click="OnOpenInExplorerClick"
|
||||
<StackPanel Grid.Column="3" Orientation="Horizontal">
|
||||
<Button ToolTip="Remove from queue" Click="OnRemoveFromQueueClick"
|
||||
Width="16" Height="16" Padding="0" Margin="0"
|
||||
Visibility="{Binding DataContext.CanExport, RelativeSource={RelativeSource AncestorType=adonisControls:AdonisWindow}, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center" Focusable="False">
|
||||
<Button.Style>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="Transparent">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="#EF5350" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
<Path Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=Button}}"
|
||||
Data="{StaticResource RemoveIcon}" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
|
||||
<Button ToolTip="Open in Explorer" Click="OnOpenInExplorerClick"
|
||||
Tag="{Binding FirstFilePath}"
|
||||
Visibility="{Binding HasFilePath, Converter={StaticResource BoolToVisibilityConverter}}"
|
||||
Style="{DynamicResource {x:Static adonisUi:Styles.ToolbarButton}}"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Padding="0" Margin="0">
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
<Path StrokeThickness="2" Stroke="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6" />
|
||||
<Path StrokeThickness="2" Stroke="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="M11 13l9 -9" />
|
||||
<Path StrokeThickness="2" Stroke="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="M15 4h5v5" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
<Path StrokeThickness="2" Stroke="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6" />
|
||||
<Path StrokeThickness="2" Stroke="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="M11 13l9 -9" />
|
||||
<Path StrokeThickness="2" Stroke="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="M15 4h5v5" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ public partial class ExportSessionWindow
|
|||
viewModel.ClearQueue();
|
||||
}
|
||||
|
||||
private void OnRemoveFromQueueClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button { DataContext: ObjectGroupViewModel item } && DataContext is ExportSessionViewModel viewModel)
|
||||
{
|
||||
viewModel.RemoveFromQueue(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMakeDefaultOptions(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button { DataContext: ExportSessionViewModel viewModel })
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user