Skip to content

Commit

Permalink
Enhancement: First main gui prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceiridge committed Apr 3, 2021
1 parent 97945ce commit 00d2347
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 34 deletions.
5 changes: 5 additions & 0 deletions ChromeDevExtWarningPatcher.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChromeDllInjectorBuildZipper", "ChromeDllInjectorBuildZipper\ChromeDllInjectorBuildZipper.csproj", "{8178E5BD-BE0E-4840-8F26-4152682068C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChromeDevExtWarningPatcher", "ChromeDevExtWarningPatcher\ChromeDevExtWarningPatcher.csproj", "{9F535953-6B7C-49B5-B0E4-B5C845ECEF47}"
ProjectSection(ProjectDependencies) = postProject
{BA6B041F-E0E9-45EC-86D8-BC5D1D864AE5} = {BA6B041F-E0E9-45EC-86D8-BC5D1D864AE5}
{BAA11244-ECA8-44B9-B976-B9BCDF37BF99} = {BAA11244-ECA8-44B9-B976-B9BCDF37BF99}
{29D94F79-97B1-4801-8A65-4A8BECBF2D46} = {29D94F79-97B1-4801-8A65-4A8BECBF2D46}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
20 changes: 13 additions & 7 deletions ChromeDevExtWarningPatcher/App.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<Application x:Class="ChromeDevExtWarningPatcher.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ChromeDevExtWarningPatcher"
StartupUri="MainView.xaml">
<Application.Resources>

</Application.Resources>
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ChromeDevExtWarningPatcher"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
StartupUri="MainView.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="Blue" SecondaryColor="LightBlue" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
39 changes: 22 additions & 17 deletions ChromeDevExtWarningPatcher/ChromeDevExtWarningPatcher.csproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<Version>5.0.0.0</Version>
<Authors>Ceiridge</Authors>
<Company />
<Product>Chromium Developer Extension Warning Patcher</Product>
<Description>Patches Chromium and disables the developer extension warning among others</Description>
<Copyright>GNU General Public License 3, Ceiridge</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/Ceiridge/Chrome-Developer-Mode-Extension-Warning-Patcher</PackageProjectUrl>
<RepositoryUrl>https://github.com/Ceiridge/Chrome-Developer-Mode-Extension-Warning-Patcher</RepositoryUrl>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<Version>5.0.0.0</Version>
<Authors>Ceiridge</Authors>
<Company />
<Product>Chromium Developer Extension Warning Patcher</Product>
<Description>Patches Chromium and disables the developer extension warning among others</Description>
<Copyright>GNU General Public License 3, Ceiridge</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/Ceiridge/Chrome-Developer-Mode-Extension-Warning-Patcher</PackageProjectUrl>
<RepositoryUrl>https://github.com/Ceiridge/Chrome-Developer-Mode-Extension-Warning-Patcher</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="4.0.0" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="cmd.exe /c ..\..\..\signall.bat" />
<Exec Command="cmd.exe /c ..\signall.bat" />
</Target>

</Project>
6 changes: 6 additions & 0 deletions ChromeDevExtWarningPatcher/ComponentModels/MainModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace ChromeDevExtWarningPatcher.ComponentModels {
public class MainModel {
public SelectionListModel BrowserListModel => new SelectionListModel();
public SelectionListModel PatchListModel => new SelectionListModel();
}
}
32 changes: 32 additions & 0 deletions ChromeDevExtWarningPatcher/ComponentModels/SelectionListElement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
using System.Windows.Controls;

namespace ChromeDevExtWarningPatcher.ComponentModels {
public class SelectionListElement : INotifyPropertyChanged {
[Required]
public string Name { get; set; }
public string? Description { get; set; }
public Image? IconImage { get; set; }

private bool isSelected;
public bool IsSelected {
get => this.isSelected;
set {
this.isSelected = value;
this.OnPropertyChanged();
}
}

public event PropertyChangedEventHandler? PropertyChanged;

public SelectionListElement(string name) {
this.Name = name;
}

protected internal void OnPropertyChanged([CallerMemberName] string propertyName = "") {
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
19 changes: 19 additions & 0 deletions ChromeDevExtWarningPatcher/ComponentModels/SelectionListModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;

namespace ChromeDevExtWarningPatcher.ComponentModels {
public class SelectionListModel {
[Required]
public ObservableCollection<SelectionListElement> ElementList { get; set; } = new ObservableCollection<SelectionListElement>();

public SelectionListModel() {
Task.Run(async () => {
await Task.Delay(100);
this.ElementList.Add(new SelectionListElement("Edge") {
Description = "Very edgy"
});
});
}
}
}
32 changes: 32 additions & 0 deletions ChromeDevExtWarningPatcher/ComponentViews/SelectionListView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<UserControl x:Class="ChromeDevExtWarningPatcher.ComponentViews.SelectionListView"
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"
xmlns:local="clr-namespace:ChromeDevExtWarningPatcher.ComponentViews"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="650" Background="{DynamicResource MaterialDesignCardBackground}">
<Grid>
<ListView ItemsSource="{Binding ElementList}">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" MaxWidth="150" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<CheckBox IsChecked="{Binding IsSelected}" />
<Image Grid.Column="1" Source="{Binding IconImage}" Margin="5, 0, 5, 0" />
<StackPanel Grid.Column="2" Orientation="Vertical">
<TextBlock FontSize="16" Text="{Binding Name}" />
<TextBlock Text="{Binding Description}" />
</StackPanel>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Windows.Controls;

namespace ChromeDevExtWarningPatcher.ComponentViews {
public partial class SelectionListView : UserControl {
public SelectionListView() {
this.InitializeComponent();
}
}
}
53 changes: 44 additions & 9 deletions ChromeDevExtWarningPatcher/MainView.xaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
<Window x:Class="ChromeDevExtWarningPatcher.MainView"
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:local="clr-namespace:ChromeDevExtWarningPatcher"
mc:Ignorable="d"
Title="MainView" Height="450" Width="800">
<Grid>
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:cv="clr-namespace:ChromeDevExtWarningPatcher.ComponentViews"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="Ceiridge's Chromium Patcher (Extension Warning Patcher)" Height="450" Width="800" WindowStartupLocation="CenterScreen" Background="{DynamicResource MaterialDesignPaper}" FontFamily="{DynamicResource MaterialDesignFont}" TextElement.Foreground="{DynamicResource MaterialDesignBody}" TextElement.FontWeight="Medium" TextElement.FontSize="14">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Expander Header="Select Browsers" IsExpanded="True">
<cv:SelectionListView DataContext="{Binding BrowserListModel}" />
</Expander>

<Expander Grid.Row="1" Header="Select Patches">
<cv:SelectionListView DataContext="{Binding PatchListModel}" />
</Expander>

<Expander Grid.Row="2" Header="Install Patches">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="75*" />
</Grid.RowDefinitions>

</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0, 3, 0, 3">
<Button Content="(Re-)Install" />
<Button Content="Uninstall" Style="{DynamicResource MaterialDesignRaisedLightButton}" Margin="5, 0, 0, 0" />
</StackPanel>

<RichTextBox Grid.Row="1" x:Name="ConsoleBox" Margin="0, 0, 0, 5" IsUndoEnabled="False" IsReadOnly="True" IsReadOnlyCaretVisible="True">
<FlowDocument LineHeight="1">
<Paragraph>
<Run Text="Console" />
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</Expander>
</Grid>
</Window>
6 changes: 5 additions & 1 deletion ChromeDevExtWarningPatcher/MainView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
using System.Windows;
using ChromeDevExtWarningPatcher.ComponentModels;

namespace ChromeDevExtWarningPatcher {
public partial class MainView : Window {
private readonly MainModel mainModel = new MainModel();

public MainView() {
InitializeComponent();
this.InitializeComponent();
this.DataContext = this.mainModel;
}
}
}

0 comments on commit 00d2347

Please sign in to comment.