-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExportView.xaml
184 lines (170 loc) · 10.2 KB
/
ExportView.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<UserControl x:Class="MO2ExportImport.Views.ExportView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:main="clr-namespace:MO2ExportImport"
mc:Ignorable="d">
<UserControl.Resources>
<main:StringNullOrEmptyToVisibilityConverter x:Key="StringNullOrEmptyToVisibilityConverter" />
<main:TopOffsetConverter x:Key="TopOffsetConverter"/>
<main:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<!-- Define a custom style for ListBoxItem -->
<Style TargetType="ListBoxItem">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Name="Border" Padding="2" SnapsToDevicePixels="true">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<!-- Trigger for when the item is selected -->
<Trigger Property="IsSelected" Value="true">
<Setter TargetName="Border" Property="Background" Value="LightBlue"/>
<!--<Setter TargetName="Border" Property="Foreground" Value="White"/>-->
</Trigger>
<!-- Trigger for when the item is selected but the ListBox is out of focus -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="IsFocused" Value="false"/>
</MultiTrigger.Conditions>
<Setter TargetName="Border" Property="Background" Value="LightBlue"/>
<!--<Setter TargetName="Border" Property="Foreground" Value="White"/>-->
</MultiTrigger>
<!-- Trigger for mouse over -->
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Background" Value="LightGreen"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<!-- Define row definitions -->
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <!-- For MO2 Selection -->
<RowDefinition Height="Auto"/> <!-- For Profile Selection -->
<RowDefinition Height="Auto"/> <!-- For Checkbox Options -->
<RowDefinition Height="Auto"/> <!-- For filter -->
<RowDefinition Height="*"/> <!-- For the ListBox to take remaining space -->
<RowDefinition Height="Auto"/> <!-- For the Export button -->
<RowDefinition Height="Auto"/> <!-- For the Export destination-->
</Grid.RowDefinitions>
<!-- Top section with button and ComboBox -->
<Button Grid.Row="0" Content="Select MO2 Directory" Command="{Binding SelectSourceCommand}" Margin="10"/>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<TextBlock Text="Profile:" Margin="10" VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding Profiles}" SelectedItem="{Binding SelectedProfile}" Margin="10"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="10">
<CheckBox Content="Ignore Disabled" IsChecked="{Binding IgnoreDisabled}" />
<CheckBox Content="Ignore Separators" IsChecked="{Binding IgnoreSeparators}" Margin="10 0 0 0"/>
<CheckBox Content="Calculate Available Space Automatically" IsChecked="{Binding AutoCalculateSpace}" Margin="10 0 0 0"/>
</StackPanel>
<!-- ListBox with constrained height in the remaining space -->
<Grid Grid.Row="3">
<TextBox x:Name="FilterTextBox"
Width="200"
Margin="5"
VerticalContentAlignment="Center"
Text="{Binding FilterText, UpdateSourceTrigger=PropertyChanged}"
TextChanged="FilterTextBox_TextChanged"/>
<TextBlock Text="Filter mods..."
IsHitTestVisible="False"
Foreground="Gray"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="10,0,0,0"
Visibility="{Binding Text, ElementName=FilterTextBox, Converter={StaticResource StringNullOrEmptyToVisibilityConverter}}" />
</Grid>
<Button Grid.Row="3" Grid.RowSpan="2" Content="{Binding ExportButtonLabel}" Command="{Binding ExportSelectedCommand}" Margin="0 0 10 0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
<ListBox Grid.Row="4" ItemsSource="{Binding FilteredModList}" Margin="10"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionMode="Extended"
Name="ModsListBox"
VirtualizingStackPanel.IsVirtualizing="False"
SelectionChanged="ModsListBox_SelectionChanged">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="IsSelected" Value="{Binding SelectedInUI, Mode=TwoWay}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Name="Border" Padding="2" SnapsToDevicePixels="true">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<!-- Trigger for when the item is selected -->
<Trigger Property="IsSelected" Value="true">
<Setter TargetName="Border" Property="Background" Value="LightBlue"/>
<!--<Setter TargetName="Border" Property="Foreground" Value="White"/>-->
</Trigger>
<!-- Trigger for when the item is selected but the ListBox is out of focus -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="IsFocused" Value="false"/>
</MultiTrigger.Conditions>
<Setter TargetName="Border" Property="Background" Value="LightBlue"/>
<!--<Setter TargetName="Border" Property="Foreground" Value="White"/>-->
</MultiTrigger>
<!-- Trigger for mouse over -->
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Background" Value="LightGray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding EnabledInExportedModList}" IsEnabled="False" Margin="0,0,10,0"/>
<TextBlock Text="{Binding DisplayName}" VerticalAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- "Please Wait" TextBlock -->
<TextBlock x:Name="PleaseWaitText"
Grid.Row="4"
Text="Please Wait"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Red"
FontSize="20"
Visibility="{Binding IsPleaseWaitVisible, Converter={StaticResource BoolToVisibilityConverter}, Mode=TwoWay}"
IsHitTestVisible="False" />
<!-- Canvas to draw the blue lines -->
<Canvas Grid.Row="4" IsHitTestVisible="False" Name="HighlightCanvas" Width="{Binding ActualWidth, ElementName=ModsListBox}"
Height="{Binding ActualHeight, ElementName=ModsListBox}" Opacity="1">
<ItemsControl ItemsSource="{Binding ElementName=ModsListBox, Path=SelectedItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Rectangle Width="4" Fill="Blue" Height="2" Canvas.Left="0"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Canvas>
<!-- Export Selected Button -->
<!-- Bottom panel for Export Destination Folder selection -->
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="6" Orientation="Horizontal" VerticalAlignment="Center" Margin="5 0 0 5">
<TextBlock Text="Export Destination:" VerticalAlignment="Center"/>
<TextBox Text="{Binding ExportDestinationFolder, Mode=TwoWay}" Width="400" Margin="10,0" VerticalContentAlignment="Center"/>
<Button Content="Browse" Command="{Binding BrowseFolderCommand}"/>
</StackPanel>
</Grid>
</UserControl>