Skip to content

Commit

Permalink
.NET Framework -> .NET Core
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyome22 committed Dec 20, 2020
1 parent 2bb326a commit 8942de0
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 120 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ bin/
obj/
[Ll]og/
[Ll]ogs/

.DS_Store
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ A cute running cat animation on your windows taskbar.
[![Github license](https://img.shields.io/github/license/Kyome22/RunCat_for_windows)](https://github.com/Kyome22/RunCat_for_windows/)

# Tags
`C#` `.NET Framework` `Visual Studio` `RunCat`

`C#` `.NET Core 3.1` `Visual Studio` `RunCat`

# Demo

Expand All @@ -19,14 +20,24 @@ A cute running cat animation on your windows taskbar.
You only have to run the RunCat.exe.

# Installation

Access to the "Releases" page and download the RunCat.exe.

# Publish

```console
> cd RunCat/
> dotnet publish -c Release
```

# Contributors

- [Kyome22](https://github.com/Kyome22)
- [geforce-hisa0904](https://github.com/geforce-hisa0904)
- [murakamiii](https://github.com/murakamiii)
- [juner](https://github.com/juner)
- [t13801206](https://github.com/t13801206)
- [MxShun](https://github.com/MxShun)

<!-- Please do not delete the below comment. -->
<!-- CREATED_BY_LEADYOU_README_GENERATOR -->
12 changes: 6 additions & 6 deletions RunCat.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30320.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RunCat", "RunCat\RunCat.csproj", "{148B00E2-DAFD-4AA6-BDBA-3A365047DD9B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RunCat", "RunCat\RunCat.csproj", "{10064461-1376-41CF-B6DA-A67B71BB2AC9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{148B00E2-DAFD-4AA6-BDBA-3A365047DD9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{148B00E2-DAFD-4AA6-BDBA-3A365047DD9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{148B00E2-DAFD-4AA6-BDBA-3A365047DD9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{148B00E2-DAFD-4AA6-BDBA-3A365047DD9B}.Release|Any CPU.Build.0 = Release|Any CPU
{10064461-1376-41CF-B6DA-A67B71BB2AC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10064461-1376-41CF-B6DA-A67B71BB2AC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10064461-1376-41CF-B6DA-A67B71BB2AC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10064461-1376-41CF-B6DA-A67B71BB2AC9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F26512EE-25D3-4A16-96A9-B2F56F5890AC}
SolutionGuid = {7D6F6313-0157-43AE-8251-D67756F32A48}
EndGlobalSection
EndGlobal
6 changes: 0 additions & 6 deletions RunCat/App.config

This file was deleted.

54 changes: 24 additions & 30 deletions RunCat/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Takuto Nakamura
// Copyright 2020 Takuto Nakamura
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@
using System.Diagnostics;
using System.Windows.Forms;
using System.Resources;
using System.ComponentModel;

namespace RunCat
{
Expand All @@ -37,8 +38,8 @@ static void Main()
public class RunCatApplicationContext : ApplicationContext
{
private PerformanceCounter cpuUsage;
private MenuItem themeMenu;
private MenuItem startupMenu;
private ToolStripMenuItem themeMenu;
private ToolStripMenuItem startupMenu;
private NotifyIcon notifyIcon;
private int current = 0;
private string systemTheme = "";
Expand All @@ -55,41 +56,34 @@ public RunCatApplicationContext()
cpuUsage = new PerformanceCounter("Processor", "% Processor Time", "_Total");
_ = cpuUsage.NextValue(); // discards first return value

themeMenu = new MenuItem("Theme", new MenuItem[]
themeMenu = new ToolStripMenuItem("Theme", null, new ToolStripMenuItem[]
{
new MenuItem("Default", SetThemeIcons)
new ToolStripMenuItem("Default", null, SetThemeIcons)
{
RadioCheck = true,
Checked = true
},
new MenuItem("Light", SetLightIcons)
{
RadioCheck = true
},
new MenuItem("Dark", SetDarkIcons)
{
RadioCheck = true
}
new ToolStripMenuItem("Light", null, SetLightIcons),
new ToolStripMenuItem("Dark", null, SetDarkIcons)
});

startupMenu = new MenuItem("Startup", SetStartup)
{
RadioCheck = true
};
startupMenu = new ToolStripMenuItem("Startup", null, SetStartup);
if (IsStartupEnabled())
{
startupMenu.Checked = true;
}

ContextMenuStrip contextMenuStrip = new ContextMenuStrip(new Container());
contextMenuStrip.Items.AddRange(new ToolStripItem[]
{
themeMenu,
startupMenu,
new ToolStripMenuItem("Exit", null, Exit)
});

notifyIcon = new NotifyIcon()
{
Icon = Resources.light_cat0,
ContextMenu = new ContextMenu(new MenuItem[]
{
themeMenu,
startupMenu,
new MenuItem("Exit", Exit)
}),
ContextMenuStrip = contextMenuStrip,
Text = "0.0%",
Visible = true
};
Expand All @@ -100,7 +94,7 @@ public RunCatApplicationContext()
StartObserveCPU();
current = 1;
}

private bool IsStartupEnabled()
{
string keyName = @"Software\Microsoft\Windows\CurrentVersion\Run";
Expand Down Expand Up @@ -141,9 +135,9 @@ private void SetIcons()
.ToArray();
}

private void UpdateCheckedState(MenuItem sender)
private void UpdateCheckedState(ToolStripMenuItem sender)
{
foreach (MenuItem item in themeMenu.MenuItems)
foreach (ToolStripMenuItem item in themeMenu.DropDownItems)
{
item.Checked = false;
}
Expand All @@ -152,7 +146,7 @@ private void UpdateCheckedState(MenuItem sender)

private void SetThemeIcons(object sender, EventArgs e)
{
UpdateCheckedState((MenuItem)sender);
UpdateCheckedState((ToolStripMenuItem)sender);
manualTheme = "";
systemTheme = GetAppsUseTheme();
SetIcons();
Expand All @@ -169,14 +163,14 @@ private void UpdateThemeIcons()

private void SetLightIcons(object sender, EventArgs e)
{
UpdateCheckedState((MenuItem)sender);
UpdateCheckedState((ToolStripMenuItem)sender);
manualTheme = "light";
SetIcons();
}

private void SetDarkIcons(object sender, EventArgs e)
{
UpdateCheckedState((MenuItem)sender);
UpdateCheckedState((ToolStripMenuItem)sender);
manualTheme = "dark";
SetIcons();
}
Expand Down
30 changes: 0 additions & 30 deletions RunCat/Properties/Settings.Designer.cs

This file was deleted.

7 changes: 0 additions & 7 deletions RunCat/Properties/Settings.settings

This file was deleted.

80 changes: 41 additions & 39 deletions RunCat/RunCat.csproj
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<ProjectGuid>{148B00E2-DAFD-4AA6-BDBA-3A365047DD9B}</ProjectGuid>
<OutputType>WinExe</OutputType>
<UseWindowsForms>True</UseWindowsForms>
<TargetFramework>net472</TargetFramework>
<UseWindowsForm>true</UseWindowsForm>
<ApplicationIcon>appIcon.ico</ApplicationIcon>
<Version>1.0.0.0</Version>
<Product>RunCat</Product>
<Copyright>Copyright © 2020</Copyright>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Update="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="appIcon.ico" />
<Content Include="resources\*.ico" />
</ItemGroup>

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>appIcon.ico</ApplicationIcon>
<NoWin32Manifest>true</NoWin32Manifest>
<StartupObject>RunCat.Program</StartupObject>
<Version>1.6.0</Version>
<Authors>Takuto Nakamura</Authors>
<Description>A cute runnning cat animation on your windows taskbar.</Description>
<Copyright>© 2020 Takuto Nakamura</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/Kyome22/RunCat_for_windows</PackageProjectUrl>
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

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

</Project>
6 changes: 6 additions & 0 deletions RunCat/RunCat.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Users\kyome\source\repos\RunCat_for_windows\RunCat\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>

0 comments on commit 8942de0

Please sign in to comment.