Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Editor, Core, & ModManager] Improved Loaded Plugins List UI and improved PluginManager #192

Merged
merged 4 commits into from
Nov 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions FrostyControls/FrostyControls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Icons.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="FrostyAutoSizedGridView.cs" />
Expand Down
2,848 changes: 2,105 additions & 743 deletions FrostyControls/Themes/Generic.xaml

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions FrostyControls/Themes/Icons.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008">

<PathGeometry x:Key="CheckmarkIcon"
Figures="M 22.566406 4.730469 L 20.773438 3.511719 C 20.277344 3.175781 19.597656 3.304688 19.265625 3.796875 L 10.476562 16.757812 L 6.4375 12.71875 C 6.015625 12.296875 5.328125 12.296875 4.90625 12.71875 L 3.371094 14.253906 C 2.949219 14.675781 2.949219 15.363281 3.371094 15.789062 L 9.582031 22 C 9.929688 22.347656 10.476562 22.613281 10.96875 22.613281 C 11.460938 22.613281 11.957031 22.304688 12.277344 21.839844 L 22.855469 6.234375 C 23.191406 5.742188 23.0625 5.066406 22.566406 4.730469 Z M 22.566406 4.730469 "
FillRule="Nonzero" />
<PathGeometry x:Key="ExclamationIcon"
Figures="M70.83802,17.2l2.46354,91.73333h25.30729l2.55312,-91.73333zM86.04479,126.13333c-9.41986,0 -15.29635,5.46853 -15.29635,14.37812c0,8.82934 5.88222,14.28854 15.29635,14.28854c9.41413,0 15.21797,-5.45921 15.21797,-14.28854c0,-8.90959 -5.7981,-14.37812 -15.21797,-14.37812z"
FillRule="Nonzero" />
<PathGeometry x:Key="RemoveIcon"
Figures="M40.13333,22.93333c-1.46702,0 -2.93565,0.55882 -4.05365,1.67969l-11.46667,11.46667c-2.24173,2.24173 -2.24173,5.87129 0,8.10729l41.81302,41.81302l-41.81302,41.81302c-2.24173,2.24173 -2.24173,5.87129 0,8.10729l11.46667,11.46667c2.24173,2.24173 5.87129,2.24173 8.10729,0l41.81302,-41.81302l41.81302,41.81302c2.236,2.24173 5.87129,2.24173 8.10729,0l11.46667,-11.46667c2.24173,-2.24173 2.24173,-5.87129 0,-8.10729l-41.81302,-41.81302l41.81302,-41.81302c2.24173,-2.236 2.24173,-5.87129 0,-8.10729l-11.46667,-11.46667c-2.24173,-2.24173 -5.87129,-2.24173 -8.10729,0l-41.81302,41.81302l-41.81302,-41.81302c-1.12087,-1.12087 -2.58663,-1.67969 -4.05365,-1.67969z"
FillRule="Nonzero" />
</ResourceDictionary>
2 changes: 1 addition & 1 deletion FrostyEditor/BuildDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Wed 10/12/2022 15:03:43.07
Mon 10/24/2022 18:29:27.22
76 changes: 73 additions & 3 deletions FrostyEditor/Windows/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
xmlns:local="clr-namespace:FrostyEditor"
xmlns:ctrl2="clr-namespace:Frosty.Controls;assembly=FrostyControls"
xmlns:core="clr-namespace:Frosty.Core.Controls;assembly=FrostyCore"
xmlns:coreroot="clr-namespace:Frosty.Core;assembly=FrostyCore"
xmlns:conv="clr-namespace:Frosty.Core.Converters;assembly=FrostyCore"
xmlns:cmd="clr-namespace:FrostyEditor.Commands"
xmlns:ext="clr-namespace:FrostyEditor.Extensions"
mc:Ignorable="d"
MinWidth="500"
MinHeight="250"
Icon="/FrostyEditor;component/AppIcon.ico"
Height="720"
Width="1280"
Height="802"
Width="1448"
FrostyLoaded="FrostyWindow_Loaded"
WindowState="Maximized"
Title="Frosty Editor"
Expand All @@ -33,6 +34,15 @@
<MenuItem Header="Find in explorer"
Click="contextMenuBookmarkItemFind_Click" />
</ContextMenu>
<ContextMenu x:Key="pluginStatusImageContextMenu">
<MenuItem Click="CopyFullExceptionMenuItem_Click"
Header="Copy Full Exception">
<MenuItem.Icon>
<Image Source="/FrostyCore;component/Images/Copy.png"
RenderOptions.BitmapScalingMode="Fant" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</ctrl2:FrostyWindow.Resources>

<Grid Background="{StaticResource ListBackground}">
Expand Down Expand Up @@ -661,7 +671,11 @@
</StackPanel>
</ScrollViewer>
</Grid>

<GridSplitter Grid.Row="1"
Background="Transparent"
Height="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Top" />
<Grid Grid.Row="1"
Margin="2"
Background="{StaticResource ListBackground}">
Expand Down Expand Up @@ -702,10 +716,66 @@
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Status">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal"
Height="24"
HorizontalAlignment="Center">
<Path Name="statusIcon"
Fill="{StaticResource FontColor}"
Margin="3"
Stretch="Uniform" />
</StackPanel>
<DataTemplate.Triggers>
<!-- Failure. -->
<DataTrigger Binding="{Binding Path=Status}"
Value="{x:Static coreroot:PluginLoadStatus.Failed}">
<Setter Property="ContextMenu"
TargetName="statusIcon"
Value="{StaticResource pluginStatusImageContextMenu}" />
<Setter Property="Data"
TargetName="statusIcon"
Value="{Binding Path=Data, Source={StaticResource RemoveButtonIcon}}" />
<Setter Property="ToolTip"
TargetName="statusIcon"
Value="This plugin has failed to load. You may use the context menu of this image to copy the full exception." />
</DataTrigger>

<!-- Successfully loaded. -->
<DataTrigger Binding="{Binding Path=Status}"
Value="{x:Static coreroot:PluginLoadStatus.Loaded}">
<Setter Property="Data"
TargetName="statusIcon"
Value="{StaticResource CheckmarkIcon}" />
<Setter Property="ToolTip"
TargetName="statusIcon"
Value="This plugin has successfully loaded." />
</DataTrigger>

<!-- Successfully loaded, but invalid for the current profile. -->
<DataTrigger Binding="{Binding Path=Status}"
Value="{x:Static coreroot:PluginLoadStatus.LoadedInvalid}">
<Setter Property="Data"
TargetName="statusIcon"
Value="{StaticResource ExclamationIcon}" />
<Setter Property="ToolTip"
TargetName="statusIcon"
Value="This plugin has successfully loaded, but its features are unavailable for the selected profile." />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView.Columns>
</ctrl2:FrostyAutoSizedGridView>
</ListView.View>
</ListView>

<TextBlock HorizontalAlignment="Right"
Margin="0,2.5,28,0"
Text="{Binding Path=Items.Count, ElementName=LoadedPluginsList, StringFormat='{}{0:N0} plugin(s)'}"
VerticalAlignment="Top" />
</Grid>
</Grid>

Expand Down
14 changes: 13 additions & 1 deletion FrostyEditor/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public MainWindow()
LoadTabExtensions();
LoadDataExplorerMenuItemExtensions();

LoadedPluginsList.ItemsSource = App.PluginManager.LoadedPlugins;
LoadedPluginsList.ItemsSource = App.PluginManager.Plugins;

if (toolsMenuItem.Items.Count != 0)
toolsMenuItem.Items.Add(new Separator());
Expand Down Expand Up @@ -1522,5 +1522,17 @@ public void RefreshRecentProjects()
recentProjectsMenuItem.Items.Add(m_clearRecentsMenuItem);
recentProjectsMenuItem.IsEnabled = true;
}

private void CopyFullExceptionMenuItem_Click(object sender, RoutedEventArgs e)
{
Plugin selectedPlugin = (Plugin)LoadedPluginsList.SelectedItem;

// retrieve the selected plugin's load exception, execute ToString on it, and add the result to the clipboard
Clipboard.SetText(string.Format("[{0}]\n{1}", new string[]
{
DateTime.Now.ToString(),
selectedPlugin.LoadException.ToString()
}));
}
}
}
2 changes: 1 addition & 1 deletion FrostyModManager/BuildDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Wed 10/12/2022 15:03:43.07
Mon 10/24/2022 18:29:27.22
Loading