Skip to content

Commit

Permalink
Change date and battery functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollo199999999 committed Jun 21, 2022
1 parent 6b72c29 commit 245bc43
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 11 deletions.
Binary file not shown.
Binary file not shown.
Binary file modified .vs/DynaWin/v17/.suo
Binary file not shown.
29 changes: 27 additions & 2 deletions DynaWin/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,22 @@ public void ChangeTheme(string theme, string mode)
//function to find closest dateTime
public DateTime FindClosestDate(IEnumerable<DateTime> source, DateTime target)
{
DateTime closestTime = source.OrderBy(t => Math.Abs((t - target).Ticks))
List<DateTime> DateTimesBeforeCurrent = new List<DateTime>();

//iterate through dates earlier than a target date and add them to another list
foreach (DateTime date in source)
{
if (DateTime.Compare(date, target) <= 0)
{
DateTimesBeforeCurrent.Add(date);
}
}

//get closest date earlier than target date
DateTime closestTime = DateTimesBeforeCurrent.OrderBy(t => Math.Abs((t - target).Ticks))
.First();

//return formatted date
return DateTime.ParseExact(closestTime.ToString("h:mm tt"), "h:mm tt",
System.Globalization.CultureInfo.InvariantCulture);

Expand All @@ -215,7 +228,19 @@ public DateTime FindClosestDate(IEnumerable<DateTime> source, DateTime target)
//function to get closest number
public int FindClosestNumber(IEnumerable<int> numberList, int targetNumber)
{
int nearest = numberList.OrderBy(x => Math.Abs((long)x - targetNumber)).First();
List<int> NumbersLowerThanTarget = new List<int>();

//iterate through numbers lower than target number and add it to a new list
foreach(int number in numberList)
{
if (number <= targetNumber)
{
NumbersLowerThanTarget.Add(number);
}
}

//get closest number below target number
int nearest = NumbersLowerThanTarget.OrderBy(x => Math.Abs((long)x - targetNumber)).First();

return nearest;
}
Expand Down
Binary file modified DynaWin/bin/Debug/DynaWin.exe
Binary file not shown.
Binary file modified DynaWin/bin/Debug/DynaWin.pdb
Binary file not shown.
Binary file modified DynaWin/bin/Release/DynaWin.exe
Binary file not shown.
Binary file modified DynaWin/bin/Release/DynaWin.pdb
Binary file not shown.
Binary file modified DynaWin/obj/Debug/AddDynamicThemeTask.baml
Binary file not shown.
Binary file modified DynaWin/obj/Debug/AddDynamicWallpaperTask.baml
Binary file not shown.
Binary file modified DynaWin/obj/Debug/App.baml
Binary file not shown.
Binary file modified DynaWin/obj/Debug/DynaWin.exe
Binary file not shown.
Binary file modified DynaWin/obj/Debug/DynaWin.g.resources
Binary file not shown.
Binary file modified DynaWin/obj/Debug/DynaWin.pdb
Binary file not shown.
Binary file modified DynaWin/obj/Debug/MainWindow.baml
Binary file not shown.
Binary file modified DynaWin/obj/Debug/PreferencesWindow.baml
Binary file not shown.
Binary file modified DynaWin/obj/Debug/SettingsWindow.baml
Binary file not shown.
Binary file modified DynaWin/obj/Debug/TimePicker.baml
Binary file not shown.
Binary file modified DynaWin/obj/Release/DynaWin.csproj.AssemblyReference.cache
Binary file not shown.
Binary file modified DynaWin/obj/Release/DynaWin.exe
Binary file not shown.
Binary file modified DynaWin/obj/Release/DynaWin.pdb
Binary file not shown.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@ DynaWin - Dynamic Desktop for Windows 10 and Windows 11
DynaWin is a utility that allows the Windows desktop to change dynamically.

## Before you install...
DynaWin has a feature that allows the user to configure it to run on Windows startup. DynaWin does this by creating a batch script that starts DynaWin and placing said batch script in the user's startup folder. However, some antiviruses may flag this batch script as unsafe. If this is the case, please add DynaWin and the batch script (which is usually located at "C:\Users\\<username\>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\StartDynaWin.bat") to your antivirus's exclusions list.

Furthermore, some antiviruses and/or firewalls may block DynaWin from accessing the internet, causing the auto-update system to not work. In this case, please add DynaWin to your firewall's or antivrus's exclusion list.
To run on startup, DynaWin creates a batch script in the user's startup folder. However, some antiviruses may flag this as unsafe. If this is the case, please add DynaWin and the batch script, located at **```%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\StartDynaWin.bat```** to your antivirus's exclusions list.
Some antiviruses and/or firewalls may block DynaWin from accessing the internet, causing the auto-update system to not work. In this case, please add DynaWin to your firewall's or antivrus's exclusion list.

## Features

### Dynamic Theme:
Switch your Windows theme or app theme based on time

#### Automatic switching of theme

You can configure DynaWin to automatically switch the theme at specified timings.
For example, you can automatically switch Windows to Dark theme, so that it is easier on the eyes when working at night.
You can configure DynaWin to automatically switch the theme at specified timings. For example, you can automatically switch Windows to Dark theme, so that it is easier on the eyes at night.

#### Choose which mode to switch
You can configure DynaWin to only switch the app or system theme. This allows DynaWin to better cater to your needs.
You can configure DynaWin to switch only the app or system theme, or both. This allows DynaWin to better cater to your needs.

![Dynamic Theme](https://i.imgur.com/fiCZUw4.png)

### Dynamic Wallpaper
Switch your desktop wallpaper at certain triggers

#### Automatic switching of desktop wallpaper
You can configure DynaWin to automatically switch your wallpaper at specific triggers.
For example, you can configure DynaWin to switch your wallpaper at night, to make it easier while working at night. You can even configure DynaWin to change your wallpaper when your battery is running low, to give you a quick reminder before your battery runs out of power.
You can configure DynaWin to automatically switch your wallpaper at specific triggers. For example, you can configure DynaWin to switch your wallpaper at night, to make it easier on the eyes at night.

#### Choose when your wallpaper should be changed
In addition to changing your wallpaper based on the time, you can also change your wallpaper when your battery percentage is at a certain level. This is useful as it can remind you when your battery is running low, or remind you to unplug your laptop charger when it is fully charged
You can choose to change your wallpaper either based on the time, or based on your battery percentage. This can help to remind you when your battery is running low, or remind you to unplug your laptop charger when it is fully charged.

![Dynamic Wallpaper](https://i.imgur.com/iBwCU13.png)

Expand Down
File renamed without changes.

0 comments on commit 245bc43

Please sign in to comment.