Skip to content

Commit

Permalink
Move codes from dogzz9445/DDT
Browse files Browse the repository at this point in the history
  • Loading branch information
dogzz9445 committed Jun 4, 2024
1 parent 024fbce commit 5e6fb75
Show file tree
Hide file tree
Showing 79 changed files with 7,355 additions and 6 deletions.
71 changes: 70 additions & 1 deletion Corathing.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Widgets", "Widgets", "{B32F
EndProject
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "Corathing.Package", "src\Apps\Corathing.Package\Corathing.Package.wapproj", "{38B75A92-3E9F-4198-9C9A-BF30A31BE45B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Corathing.Organizer.UnitTests", "src\Apps\Corathing.Organizer.UnitTests\Corathing.Organizer.UnitTests.csproj", "{20E9EB36-05A9-4C3D-8F19-6EB85DD4C733}"
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}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -101,6 +107,66 @@ Global
{20E9EB36-05A9-4C3D-8F19-6EB85DD4C733}.Release|x64.Build.0 = Release|Any CPU
{20E9EB36-05A9-4C3D-8F19-6EB85DD4C733}.Release|x86.ActiveCfg = Release|Any CPU
{20E9EB36-05A9-4C3D-8F19-6EB85DD4C733}.Release|x86.Build.0 = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|ARM.ActiveCfg = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|ARM.Build.0 = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|ARM64.Build.0 = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|x64.ActiveCfg = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|x64.Build.0 = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|x86.ActiveCfg = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Debug|x86.Build.0 = Debug|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|Any CPU.Build.0 = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|ARM.ActiveCfg = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|ARM.Build.0 = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|ARM64.ActiveCfg = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|ARM64.Build.0 = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|x64.ActiveCfg = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|x64.Build.0 = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|x86.ActiveCfg = Release|Any CPU
{C952CC3C-2AEE-44B3-931C-59877770A846}.Release|x86.Build.0 = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|ARM.ActiveCfg = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|ARM.Build.0 = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|ARM64.Build.0 = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|x64.ActiveCfg = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|x64.Build.0 = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|x86.ActiveCfg = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Debug|x86.Build.0 = Debug|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|Any CPU.Build.0 = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|ARM.ActiveCfg = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|ARM.Build.0 = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|ARM64.ActiveCfg = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|ARM64.Build.0 = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|x64.ActiveCfg = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|x64.Build.0 = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|x86.ActiveCfg = Release|Any CPU
{2B5148C8-F3C9-4B81-B156-1B6CF1FF4CAD}.Release|x86.Build.0 = Release|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|ARM.Build.0 = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|ARM64.Build.0 = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|x64.ActiveCfg = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|x64.Build.0 = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|x86.ActiveCfg = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Debug|x86.Build.0 = Debug|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|Any CPU.Build.0 = Release|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|ARM.ActiveCfg = Release|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|ARM.Build.0 = Release|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|ARM64.ActiveCfg = Release|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|ARM64.Build.0 = Release|Any CPU
{B07D1162-D70E-4CCB-8F13-2E21611B9214}.Release|x64.ActiveCfg = Release|Any CPU
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -109,6 +175,9 @@ Global
{793A7A5D-A4F3-4853-ADDA-4BB38117DB24} = {5BF1289A-1427-4306-B2E1-51E0770B6B75}
{38B75A92-3E9F-4198-9C9A-BF30A31BE45B} = {5BF1289A-1427-4306-B2E1-51E0770B6B75}
{20E9EB36-05A9-4C3D-8F19-6EB85DD4C733} = {5BF1289A-1427-4306-B2E1-51E0770B6B75}
{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}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC027A8C-0C58-494B-BE76-F403F0336A74}
Expand Down
48 changes: 48 additions & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Road Map

## 1.0.0

### 기능
- [ ] Dashboard host 및 widget host 구현 및 버그 수정, 테스트
- [ ] Localization 서비스 구현
- [ ] 테마 서비스 구현
- [ ] Nuget 패키지에서 위젯을 읽고 로드하는 서비스 구현
- [ ] DLL 로드
- [ ] 개인적인 사용이 아닌 배포 용으로 사용할 때 필요한 작업들을 정리
- [ ] 시크릿 서비스를 이용한 어플리케이션 설정 암호화
- [ ] 문서에 빌드 방법 및 배포 방법을 정리

### 위젯
- [ ] Python 위젯
- [ ] C# 위젯
- [ ] Windows 위젯
- [ ] WebView 위젯
- [ ] vscode 위젯


### CI/CI
- [ ] Create CI/CD workflows for WPF Applications built on .NET 8.x
- [ ] Code Quality

### 배포/웹사이트
- [ ] Create a website for the project
- [ ] Create a GitHub Pages site for the project
- [ ] Create a NuGet package for the project
- [ ] Create a Community Standup for the project

## 2.0.0

### 기능
- [ ] Navigation 서비스 구현

### 위젯
- [ ] PLC 위젯

### CI/CI
- [ ]

### 배포/웹사이트
- [ ]


## 3.0.0
3 changes: 1 addition & 2 deletions src/Apps/Corathing.Organizer/App.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<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:local="clr-namespace:Corathing.Organizer"
StartupUri="MainWindow.xaml">
xmlns:local="clr-namespace:Corathing.Organizer">
<Application.Resources>

</Application.Resources>
Expand Down
127 changes: 124 additions & 3 deletions src/Apps/Corathing.Organizer/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,135 @@
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.IO.Packaging;
using System.Windows;

namespace Corathing.Organizer
using Corathing.Contracts.Services;
using Corathing.Dashboards.Services;
using Corathing.Organizer.Services;
using Corathing.Organizer.Utils;

using MahApps.Metro.Controls;

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>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{

/// <summary>
/// Gets the current <see cref="App"/> instance of the application
/// </summary>
public new static App Current => (App)Application.Current;

/// <summary>
/// Interaction logic for App.xaml
/// Gets the <see cref="IServiceProvider"/> instance of the application
/// </summary>
public partial class App : Application
public IServiceProvider? Services { get; private set; }

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");
};

// 같은 이름의 다른 프로세스가 실행중인지 확인하고, 실행중이면 종료
if (CheckIfProcessExists())
{
MessageBox.Show(
"Another instance of the application is already running.",
"Error",
MessageBoxButton.OK,
MessageBoxImage.Error);

Shutdown();
}

// 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);

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();
}

private static IConfigurationRoot BuildConfiguration(string[] args)
{
// Create and build a configuration builder
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
//.AddAppSettingsJsonFileByEnvironmentVariables()
//.AddEnvironmentVariables()
//.AddEntityConfiguration()
.AddCommandLine(args);

return builder.Build();
}

private static IServiceProvider ConfigureServices(string[] args)
{
var serviceCollection = new ServiceCollection();

// Build the configuration
var configuration = BuildConfiguration(args);
serviceCollection.AddSingleton<IConfiguration>(configuration);

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

// Register viewmodels


//Logger.Configure(configuration);
//serviceCollection.AddSingleton<SettingsController>();
//Localizer.Configure(configuration);

return serviceCollection.BuildServiceProvider();
}

/// <summary>
/// Checks if there is already an instance of Openhardwaremonitor running and brings up its window
/// in case its minimized or as icon in taskbar
/// </summary>
private static bool CheckIfProcessExists()
{
bool processExists = false;
Process thisInstance = Process.GetCurrentProcess();
if (Process.GetProcessesByName(thisInstance.ProcessName).Length > 1)
{
processExists = true;
using (var clientPipe = InterprocessCommunicationFactory.GetClientPipe())
{
clientPipe.Connect();
clientPipe.Write(new byte[] { (byte)SecondInstanceService.SecondInstanceRequest.MaximizeWindow }, 0, 1);
}
}

return processExists;
}
}
33 changes: 33 additions & 0 deletions src/Apps/Corathing.Organizer/Behaviors/DateTimeNowBehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// From: https://github.com/MahApps/MahApps.Metro/blob/develop/src/MahApps.Metro.Samples/MahApps.Metro.Demo/Behaviors/DateTimeNowBehavior.cs

using System;
using System.Collections.Generic;
using System.Windows.Threading;
using MahApps.Metro.Controls;

using Microsoft.Xaml.Behaviors;

namespace Corathing.Organizer.Behaviors;

public class DateTimeNowBehavior : Behavior<DateTimePicker>

Check failure on line 15 in src/Apps/Corathing.Organizer/Behaviors/DateTimeNowBehavior.cs

View workflow job for this annotation

GitHub Actions / build (x64)

'DateTimePicker' is an ambiguous reference between 'MahApps.Metro.Controls.DateTimePicker' and 'System.Windows.Forms.DateTimePicker'

Check failure on line 15 in src/Apps/Corathing.Organizer/Behaviors/DateTimeNowBehavior.cs

View workflow job for this annotation

GitHub Actions / build (x64)

'DateTimePicker' is an ambiguous reference between 'MahApps.Metro.Controls.DateTimePicker' and 'System.Windows.Forms.DateTimePicker'
{
private DispatcherTimer? _dispatcherTimer;

protected override void OnAttached()
{
base.OnAttached();
this._dispatcherTimer = new DispatcherTimer(TimeSpan.FromSeconds(1),
DispatcherPriority.DataBind,
(sender, args) => this.AssociatedObject.SelectedDateTime = DateTime.Now,
Dispatcher.CurrentDispatcher);
}

protected override void OnDetaching()
{
base.OnDetaching();
this._dispatcherTimer?.Stop();
}
}
Loading

0 comments on commit 5e6fb75

Please sign in to comment.