-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
DragonFlyy
committed
Jun 27, 2023
1 parent
7cbc37b
commit 3c50f20
Showing
10 changed files
with
322 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33122.133 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Insult Generator", "Insult Generator\Insult Generator.csproj", "{E5FCD52C-2A55-4AA9-90C8-D7C5F119C58B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E5FCD52C-2A55-4AA9-90C8-D7C5F119C58B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E5FCD52C-2A55-4AA9-90C8-D7C5F119C58B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E5FCD52C-2A55-4AA9-90C8-D7C5F119C58B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E5FCD52C-2A55-4AA9-90C8-D7C5F119C58B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {408C899A-8B5D-4A59-A3AA-1F7FB7E1D717} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Application x:Class="Insult_Generator.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:Insult_Generator" | ||
StartupUri="Views/MainView.xaml"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="pack://application:,,,/AdonisUI;component/ColorSchemes/Dark.xaml"/> | ||
<ResourceDictionary Source="pack://application:,,,/AdonisUI.ClassicTheme;component/Resources.xaml"/> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using RestoreWindowPlace; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
|
||
namespace Insult_Generator; | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
public WindowPlace WindowPlace { get; set; } | ||
|
||
public static string Storage = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Insult_Generator"); | ||
|
||
public App() | ||
{ | ||
if (!Directory.Exists(Storage)) | ||
{ | ||
Directory.CreateDirectory(Storage); | ||
} | ||
|
||
this.WindowPlace = new WindowPlace(Path.Combine(Storage, "placement.config")); | ||
|
||
} | ||
|
||
protected override void OnExit(ExitEventArgs e) | ||
{ | ||
base.OnExit(e); | ||
this.WindowPlace.Save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net7.0-windows</TargetFramework> | ||
<Nullable>disable</Nullable> | ||
|
||
<UseWPF>true</UseWPF> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AdonisUI.ClassicTheme" Version="1.17.1" /> | ||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" /> | ||
<PackageReference Include="RestoreWindowPlace" Version="2.1.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="insults.json"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using System.Collections.ObjectModel; | ||
using System.Dynamic; | ||
using System.Net; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Insult_Generator.Models | ||
{ | ||
public partial class Insults : ObservableObject | ||
{ | ||
[ObservableProperty] ObservableCollection<string> _tabOne; | ||
[ObservableProperty] ObservableCollection<string> _tabTwo; | ||
[ObservableProperty] ObservableCollection<string> _tabThree; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using CommunityToolkit.Mvvm.Input; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.Metrics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Threading; | ||
using Insult_Generator.Models; | ||
using System.Text.Json.Serialization; | ||
using System.Text.Json; | ||
using System.IO; | ||
|
||
namespace Insult_Generator.ViewModels; | ||
public partial class MainViewModel : ObservableObject | ||
{ | ||
[ObservableProperty] private string _firstInsult; | ||
[ObservableProperty] private string _secondInsult; | ||
[ObservableProperty] private string _thirdInsult; | ||
[ObservableProperty] private string _buttonText; | ||
[ObservableProperty] private bool _isWaiting; | ||
|
||
private readonly DispatcherTimer timer; | ||
private Random rnd; | ||
private int countdown = 500; | ||
public MainViewModel() | ||
{ | ||
ButtonText = "Insult Someone!"; | ||
IsWaiting = true; | ||
|
||
var insults = JsonSerializer.Deserialize<Insults>(File.ReadAllText("insults.json")); | ||
rnd = new(); | ||
|
||
timer = new(); | ||
timer.Tick += (object s, EventArgs args) => | ||
{ | ||
IsWaiting = false; | ||
ButtonText = "Insulting ..."; | ||
Application.Current.Dispatcher.Invoke(() => | ||
{ | ||
FirstInsult = insults.TabOne[rnd.Next(insults.TabOne.Count - 1)]; | ||
SecondInsult = insults.TabTwo[rnd.Next(insults.TabTwo.Count - 1)]; | ||
ThirdInsult = insults.TabThree[rnd.Next(insults.TabThree.Count - 1)]; | ||
}); | ||
countdown = countdown - 50; | ||
if(countdown < 0) | ||
{ | ||
timer.Stop(); | ||
IsWaiting = true; | ||
ButtonText = "Insult Someone!"; | ||
countdown = 500; | ||
} | ||
}; | ||
timer.Interval = TimeSpan.FromMilliseconds(50); | ||
} | ||
|
||
[RelayCommand] | ||
private void InsultSomeone() | ||
{ | ||
timer.Start(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<ac:AdonisWindow x:Class="Insult_Generator.Views.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:Insult_Generator.Views" | ||
xmlns:ac="clr-namespace:AdonisUI.Controls;assembly=AdonisUI" | ||
xmlns:acex="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI" | ||
xmlns:viewmodel="clr-namespace:Insult_Generator.ViewModels" | ||
mc:Ignorable="d" ResizeMode="CanMinimize" | ||
Title="Insult Generator" Height="150" Width="600"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition/> | ||
<ColumnDefinition/> | ||
<ColumnDefinition/> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="50"/> | ||
<RowDefinition/> | ||
</Grid.RowDefinitions> | ||
<TextBox Text="{Binding FirstInsult}" Height="40" IsReadOnly="True" FontSize="20" Margin="10,0,10,0" TextAlignment="Center"/> | ||
<TextBox Grid.Column="1" Text="{Binding SecondInsult}" Height="40" IsReadOnly="True" FontSize="20" Margin="10,0,10,0" TextAlignment="Center"/> | ||
<TextBox Grid.Column="2" Text="{Binding ThirdInsult}" Height="40" IsReadOnly="True" FontSize="20" Margin="10,0,10,0" TextAlignment="Center"/> | ||
|
||
<Button Content="{Binding ButtonText}" | ||
IsEnabled="{Binding IsWaiting}" | ||
Grid.Column="2" | ||
Grid.Row="1" | ||
Height="40" | ||
FontSize="20" | ||
VerticalAlignment="Bottom" | ||
Margin="10,0,10,10" | ||
Command="{Binding InsultSomeoneCommand}"/> | ||
</Grid> | ||
</ac:AdonisWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using AdonisUI.Controls; | ||
using Insult_Generator.ViewModels; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace Insult_Generator.Views; | ||
/// <summary> | ||
/// Interaction logic for MainView.xaml | ||
/// </summary> | ||
public partial class MainView : AdonisWindow | ||
{ | ||
private readonly MainViewModel viewModel; | ||
public MainView() | ||
{ | ||
|
||
InitializeComponent(); | ||
|
||
((App)Application.Current).WindowPlace.Register(this); | ||
|
||
viewModel = new(); | ||
DataContext = viewModel; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"TabOne": [ | ||
"Lazy", | ||
"Stupid", | ||
"Insecure", | ||
"Idiotic", | ||
"Slimy", | ||
"Smelly", | ||
"Pompous", | ||
"Facist", | ||
"Dicknose", | ||
"Pie-eating", | ||
"Racist", | ||
"Elitist", | ||
"White Trash", | ||
"Drug-Loving", | ||
"Tone Deaf", | ||
"Ugly", | ||
"Creepy" | ||
], | ||
"TabTwo": [ | ||
"Douche", | ||
"Ass", | ||
"Turd", | ||
"Rectum", | ||
"Butt", | ||
"Cock", | ||
"Shit", | ||
"Crotch", | ||
"Bitch", | ||
"Prick", | ||
"Taint", | ||
"Fuck", | ||
"Dick", | ||
"Boner", | ||
"Shart", | ||
"Nut", | ||
"Sphincter" | ||
], | ||
"TabThree": [ | ||
"Pilot", | ||
"Canoe", | ||
"Captain", | ||
"Pirate", | ||
"Hammer", | ||
"Knob", | ||
"Box", | ||
"Jockey", | ||
"Nazi", | ||
"Waffle", | ||
"Goblin", | ||
"Blossum", | ||
"Biscuit", | ||
"Clown", | ||
"Socket", | ||
"Monster", | ||
"Hound", | ||
"Dragon", | ||
"Balloon" | ||
] | ||
} |