Skip to content

Commit

Permalink
Add program settings view
Browse files Browse the repository at this point in the history
  • Loading branch information
dogzz9445 committed Jun 6, 2024
1 parent 5e6fb75 commit a89146f
Show file tree
Hide file tree
Showing 192 changed files with 43,332 additions and 732 deletions.
29 changes: 26 additions & 3 deletions Corathing.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "Corathing.Package", "src\Ap
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corathing.Organizer.UnitTests", "src\Apps\Corathing.Organizer.UnitTests\Corathing.Organizer.UnitTests.csproj", "{20E9EB36-05A9-4C3D-8F19-6EB85DD4C733}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Corathing.Contracts", "src\Shared\Corathing.Contracts\Corathing.Contracts.csproj", "{C952CC3C-2AEE-44B3-931C-59877770A846}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corathing.Contracts", "src\Shared\Corathing.Contracts\Corathing.Contracts.csproj", "{C952CC3C-2AEE-44B3-931C-59877770A846}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Corathing.Dashboards.WPF", "src\Shared\Corathing.Dashboards.WPF\Corathing.Dashboards.WPF.csproj", "{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corathing.Dashboards.WPF", "src\Shared\Corathing.Dashboards.WPF\Corathing.Dashboards.WPF.csproj", "{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Corathing.Dashboards", "src\Shared\Corathing.Dashboards\Corathing.Dashboards.csproj", "{B07D1162-D70E-4CCB-8F13-2E21611B9214}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corathing.Dashboards", "src\Shared\Corathing.Dashboards\Corathing.Dashboards.csproj", "{B07D1162-D70E-4CCB-8F13-2E21611B9214}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corathing.Widgets.Basics", "src\Widgets\Corathing.Widgets.Basics\Corathing.Widgets.Basics.csproj", "{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -167,6 +169,26 @@ Global
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|x64.Build.0 = Release|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|x86.ActiveCfg = Release|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|x86.Build.0 = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|ARM.ActiveCfg = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|ARM.Build.0 = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|ARM64.Build.0 = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|x64.ActiveCfg = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|x64.Build.0 = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|x86.ActiveCfg = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Debug|x86.Build.0 = Debug|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|Any CPU.Build.0 = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|ARM.ActiveCfg = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|ARM.Build.0 = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|ARM64.ActiveCfg = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|ARM64.Build.0 = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|x64.ActiveCfg = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|x64.Build.0 = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|x86.ActiveCfg = Release|Any CPU
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -178,6 +200,7 @@ Global
{C952CC3C-2AEE-44B3-931C-59877770A846} = {89CC8AAB-466A-47B6-98B9-93EB379F55A7}
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD} = {89CC8AAB-466A-47B6-98B9-93EB379F55A7}
{B07D1162-D70E-4CCB-8F13-2E21611B9214} = {89CC8AAB-466A-47B6-98B9-93EB379F55A7}
{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA} = {B32F5E62-3357-4FE1-BEB3-7CDED236BA66}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC027A8C-0C58-494B-BE76-F403F0336A74}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Corathing is Customizable Widget Organizer
[English](README.md)
[한국어](README_KR.md)

![alt text](assets/logo.png)
![alt text](docs/images/logo.png)

카피 프로젝트
- Freeter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<RestoreFallbackFolders>clear</RestoreFallbackFolders>
</PropertyGroup>

<ItemGroup>
Expand Down
18 changes: 17 additions & 1 deletion src/Apps/Corathing.Organizer/App.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
<Application x:Class="Corathing.Organizer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:local="clr-namespace:Corathing.Organizer">
<Application.Resources>

<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Grey.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Secondary/MaterialDesignColor.Indigo.xaml" />
<ResourceDictionary Source="pack://application:,,,/Corathing.Dashboards.WPF;component/Themes/Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/Corathing.Dashboards.WPF;component/Styles/CustomStyles.xaml" />
<ResourceDictionary Source="pack://application:,,,/Corathing.Dashboards.WPF;component/Widgets/WidgetDataTemplates.xaml" />
<ui:ThemesDictionary Theme="Light" />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
81 changes: 59 additions & 22 deletions src/Apps/Corathing.Organizer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@
using Corathing.Dashboards.Services;
using Corathing.Organizer.Services;
using Corathing.Organizer.Utils;

using MahApps.Metro.Controls;
using Corathing.Organizer.ViewModels;
using Corathing.Organizer.Views;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

using Wpf.Ui.Appearance;

using Application = System.Windows.Application;
using MessageBox = System.Windows.MessageBox;

namespace Corathing.Organizer;

/// <summary>
Expand All @@ -42,11 +37,11 @@ protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

Application.Current.DispatcherUnhandledException += (sender, args) =>
{
MessageBox.Show(args.Exception.Message, "Unhandled exception occured");
//Logger.LogError(args.Exception, "Unhandled exception occured");
};
//Application.Current.DispatcherUnhandledException += (sender, args) =>
//{
// MessageBox.Show(args.Exception.Message, "Unhandled exception occured");
// //Logger.LogError(args.Exception, "Unhandled exception occured");
//};

// 같은 이름의 다른 프로세스가 실행중인지 확인하고, 실행중이면 종료
if (CheckIfProcessExists())
Expand All @@ -60,14 +55,54 @@ protected override void OnStartup(StartupEventArgs e)
Shutdown();
}

Services = ConfigureServices(e.Args);

// Set the theme
var theme = System.Configuration.ConfigurationManager.AppSettings["Theme"];
//ThemeHelper.Register("Light", @"pack://application:,,,/DDT.Core.WidgetSystems;component/Themes/Light.xaml");
//ThemeHelper.Register("Dark", @"pack://application:,,,/DDT.Core.WidgetSystems;component/Themes/Dark.xaml");
//ThemeHelper.ChangeTheme(Resources, "Dark");
ApplicationThemeManager.Apply(ApplicationTheme.Dark);
var themeService = Services.GetService<IThemeService>();
if (themeService != null)
{
themeService.Register(
"Corathing.Dashboards.WPF",
@"pack://application:,,,/Corathing.Dashboards.WPF;component/Themes/Light.xaml",
@"pack://application:,,,/Corathing.Dashboards.WPF;component/Themes/Dark.xaml"
);
themeService.Register(
"MaterialDesignThemes.Wpf",
@"pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml",
@"pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml"
);
//themeService.Register(
// "Corathing.Dashboards.WPF",
// @"pack://application:,,,/Corathing.Dashboards.WPF;component/Themes/Light.xaml",
// @"pack://application:,,,/Corathing.Dashboards.WPF;component/Themes/Dark.xaml",
// );
if (!string.IsNullOrEmpty(theme))
{
themeService.Apply(
theme switch
{
"Light" => ApplicationTheme.Light,
"Dark" => ApplicationTheme.Dark,
_ => ApplicationTheme.Unknown
});
}
else
{
themeService.ApplySystemTheme();
}
}
themeService.Apply(ApplicationTheme.Light);


// --------------------------------------------------------------------------
// Available Widgets
// --------------------------------------------------------------------------
IPackageService widgetService = Services.GetService<IPackageService>();
widgetService.LoadWidgetsFromDLL("Corathing.Dashboards.WPF.dll");
//widgetService.LoadWidgetsFromDLL("DDT.Core.WidgetSystems.DefaultWidgets.dll");
//widgetService.RegisterWidgets(new List<WidgetGenerator> { new WidgetGenerator() });

Services = ConfigureServices(e.Args);

// Create a new MainWindow and set its DataContext to a new MainWindowViewModel which binds the view to the viewmodel
new MainWindow().Show();
Expand All @@ -77,11 +112,11 @@ private static IConfigurationRoot BuildConfiguration(string[] args)
{
// Create and build a configuration builder
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.SetBasePath(Directory.GetCurrentDirectory());
//.AddAppSettingsJsonFileByEnvironmentVariables()
//.AddEnvironmentVariables()
//.AddEntityConfiguration()
.AddCommandLine(args);
//.AddCommandLine(args);

return builder.Build();
}
Expand All @@ -96,14 +131,16 @@ private static IServiceProvider ConfigureServices(string[] args)

// Register services
serviceCollection.AddSingleton<IApplicationService, ApplicationService>();
//serviceCollection.AddSingleton<ISecretService, ModelVersionSecretService>();
serviceCollection.AddSingleton<ISecretService, ModelVersionSecretService>();
serviceCollection.AddSingleton<IAuthService, AuthService>();
//serviceCollection.AddSingleton<IAppStateService, WidgetService>();
serviceCollection.AddSingleton<IAppStateService, AppStateService>();
serviceCollection.AddSingleton<IPackageService, PackageService>();
serviceCollection.AddSingleton<IThemeService, ThemeService>();
//serviceCollection.AddSingleton<IWidgetSystemService, WidgetSystemService>();

// Register viewmodels

serviceCollection.AddScoped<OrganizerSettingsViewModel>();
serviceCollection.AddScoped<WidgetSettingsViewModel>();

//Logger.Configure(configuration);
//serviceCollection.AddSingleton<SettingsController>();
Expand Down
25 changes: 2 additions & 23 deletions src/Apps/Corathing.Organizer/Controls/BaseWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,8 @@
mc:Ignorable="d"
Title="BaseWindow"
ShowTitleBar="False"
Height="450"
Width="800">
<mah:MetroWindow.Resources>
<Style TargetType="{x:Type mah:MetroWindow}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type mah:MetroWindow}">
<DockPanel LastChildFill="True">
<local:TitlebarControl DockPanel.Dock="Top"
VisibleSettingsButton="False"
VisibleMinimizeButton="False"
VisibleMaximizeButton="False"
Background="{StaticResource BrushBaseTrasparentDark}"
Title="우우" />
<ContentPresenter Grid.Row="1" />
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>

</Style>

</mah:MetroWindow.Resources>
Height="1000"
Width="1600">
<Grid>

</Grid>
Expand Down
46 changes: 46 additions & 0 deletions src/Apps/Corathing.Organizer/Converters/ThemeToIndexConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

using Corathing.Contracts.Services;

namespace Corathing.Organizer.Converters;

[ValueConversion(typeof(ApplicationTheme), typeof(int))]
public sealed class ThemeToIndexConverter : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is ApplicationTheme.Dark)
{
return 1;
}

if (value is ApplicationTheme.HighContrast)
{
return 2;
}

return 0;
}

public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is 1)
{
return ApplicationTheme.Dark;
}

if (value is 2)
{
return ApplicationTheme.HighContrast;
}

return ApplicationTheme.Light;
}
}
7 changes: 5 additions & 2 deletions src/Apps/Corathing.Organizer/Corathing.Organizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<RestoreFallbackFolders>clear</RestoreFallbackFolders>
</PropertyGroup>

<ItemGroup>
<Folder Include="Properties\" />
<Compile Remove="Properties\**" />
<EmbeddedResource Remove="Properties\**" />
<None Remove="Properties\**" />
<Page Remove="Properties\**" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit a89146f

Please sign in to comment.