Skip to content
This repository was archived by the owner on Oct 23, 2022. It is now read-only.

Commit 9afe8ba

Browse files
committed
R6-ready
1 parent 1200708 commit 9afe8ba

File tree

14 files changed

+187
-78
lines changed

14 files changed

+187
-78
lines changed

ActiveDesktop/ActiveDesktop.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
5858
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
5959
</Reference>
60+
<Reference Include="FluentWPF, Version=0.8.0.6, Culture=neutral, processorArchitecture=MSIL">
61+
<HintPath>..\packages\FluentWPF.0.8.0\lib\net45\FluentWPF.dll</HintPath>
62+
</Reference>
6063
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
6164
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
6265
</Reference>
@@ -197,6 +200,12 @@
197200
<EmbedInteropTypes>False</EmbedInteropTypes>
198201
</COMReference>
199202
</ItemGroup>
203+
<ItemGroup>
204+
<Resource Include="tray.ico" />
205+
</ItemGroup>
206+
<ItemGroup>
207+
<Resource Include="traydark.ico" />
208+
</ItemGroup>
200209
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
201210
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
202211
<PropertyGroup>

ActiveDesktop/App.xaml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
11
<Application x:Class="ActiveDesktop.App"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:ui="http://schemas.modernwpf.com/2019"
45
xmlns:local="clr-namespace:ActiveDesktop"
5-
StartupUri="MainWindow.xaml"
6-
xmlns:ui="http://schemas.modernwpf.com/2019">
6+
StartupUri="MainWindow.xaml">
77
<Application.Resources>
88
<ResourceDictionary>
99
<ResourceDictionary.MergedDictionaries>
10-
<ui:ThemeResources />
10+
<!-- FluentWPF Controls -->
11+
<ResourceDictionary Source="/FluentWPF;component/Styles/Controls.xaml" />
12+
13+
<ui:ThemeResources>
14+
<ui:ThemeResources.ThemeDictionaries>
15+
<ResourceDictionary x:Key="Light">
16+
<ResourceDictionary.MergedDictionaries>
17+
<!-- FluentWPF theme resources -->
18+
<ResourceDictionary Source="/FluentWPF;component/Styles/Colors.Light.xaml" />
19+
<ResourceDictionary Source="/FluentWPF;component/Styles/Brushes.xaml" />
20+
<!-- ModernWPF theme resources -->
21+
<ResourceDictionary Source="/ModernWpf;component/ThemeResources/Light.xaml" />
22+
</ResourceDictionary.MergedDictionaries>
23+
</ResourceDictionary>
24+
<ResourceDictionary x:Key="Dark">
25+
<ResourceDictionary.MergedDictionaries>
26+
<ResourceDictionary Source="/FluentWPF;component/Styles/Colors.Dark.xaml" />
27+
<ResourceDictionary Source="/FluentWPF;component/Styles/Brushes.xaml" />
28+
<ResourceDictionary Source="/ModernWpf;component/ThemeResources/Dark.xaml" />
29+
</ResourceDictionary.MergedDictionaries>
30+
<SolidColorBrush x:Key="NavigationViewSelectionIndicatorForeground" Color="{StaticResource SystemBaseHighColor}" />
31+
</ResourceDictionary>
32+
</ui:ThemeResources.ThemeDictionaries>
33+
</ui:ThemeResources>
34+
35+
<!-- ModernWPF controls resources -->
1136
<ui:XamlControlsResources />
12-
<!-- Other merged dictionaries here -->
1337
</ResourceDictionary.MergedDictionaries>
14-
<!-- Other app resources here -->
38+
1539
</ResourceDictionary>
1640
</Application.Resources>
17-
</Application>
41+
</Application>

ActiveDesktop/MainWindow.xaml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,58 @@
1-
<Window x:Class="ActiveDesktop.MainWindow"
1+
<Window
2+
x:Name="ADPWindow"
3+
x:Class="ActiveDesktop.MainWindow"
24
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
35
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
46
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
57
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
68
xmlns:tb="http://www.hardcodet.net/taskbar"
7-
mc:Ignorable="d" Height="497" Width="372" KeyDown="OnKeyDownHandler" KeyUp="OnKeyUpHandler" ResizeMode="NoResize" Title="Active Desktop Plus"
89
xmlns:ui="http://schemas.modernwpf.com/2019"
9-
ui:WindowHelper.UseModernWindowStyle="True">
10+
xmlns:fw="clr-namespace:SourceChord.FluentWPF;assembly=FluentWPF"
11+
mc:Ignorable="d"
12+
Height="497" Width="372"
13+
KeyDown="OnKeyDownHandler"
14+
KeyUp="OnKeyUpHandler"
15+
ResizeMode="NoResize"
16+
Title="Active Desktop Plus"
17+
ui:WindowHelper.UseModernWindowStyle="True"
18+
fw:AcrylicWindow.Enabled="true"
19+
fw:AcrylicWindow.ExtendViewIntoTitleBar="True"
20+
fw:PointerTracker.Enabled="True"
21+
>
1022

11-
<!-- I don't actually understand XAML at all give my my WinForms back.
12-
Seriously, the tab UI thing I had before actually worked why did I switch to this mess?
13-
Also if you're reading this yes I am going to redo the UI but if I can't get a pile of buttons working what even is the point in going on -->
1423

1524

1625

1726
<Grid>
18-
<tb:TaskbarIcon x:Name="tbi" IconSource="/desktop.ico" ToolTipText="Active Desktop Plus">
27+
<tb:TaskbarIcon x:Name="tbi" Visibility ="Hidden" IconSource="/tray.ico" ToolTipText="Active Desktop Plus">
1928
<tb:TaskbarIcon.ContextMenu>
2029
<ContextMenu>
2130
<MenuItem x:Name ="ShowMenuItem" Header="Hide ADP" Click="ShowMenuItem_Click"/>
2231
<MenuItem Header="Close ADP" Click="CloseMenuItem_Click"/>
2332
</ContextMenu>
2433
</tb:TaskbarIcon.ContextMenu>
2534
</tb:TaskbarIcon>
35+
<!--This is because storing and embedding icons is near-impossible aaaaa-->
36+
<tb:TaskbarIcon x:Name="DarkIcon" Visibility="Hidden" IconSource="/traydark.ico"/>
37+
<tb:TaskbarIcon x:Name="LightIcon" Visibility="Hidden" IconSource="/tray.ico"/>
38+
2639
<ui:NavigationView
2740
x:Name="NavView"
2841
IsBackButtonVisible="Visible"
2942
IsBackEnabled="False"
3043
IsPaneOpen="True"
3144
Loaded="NavView_Loaded"
3245
SelectionChanged="NavView_SelectionChanged"
33-
ItemInvoked="NavView_ItemInvoked" PaneDisplayMode="LeftCompact">
46+
ItemInvoked="NavView_ItemInvoked" PaneDisplayMode="LeftCompact"
47+
48+
>
49+
<!--<fw:AcrylicPanel Target="{Binding ElementName=ContentGrid}" TintOpacity="0.3" TintColor="{DynamicResource SystemChromeMediumColor}" NoiseOpacity="0.025">
50+
<Rectangle Fill="{DynamicResource NavigationViewExpandedPaneBackground}" Opacity="0.2"/>
51+
</fw:AcrylicPanel>-->
52+
3453

3554
<ui:NavigationView.MenuItems>
55+
3656
<ui:NavigationViewItem Icon="AllApps" Tag="Page_Current">
3757
<TextBlock Tag="Nav_Current">Current Apps</TextBlock>
3858
</ui:NavigationViewItem>
@@ -41,7 +61,11 @@
4161
</ui:NavigationViewItem>
4262
</ui:NavigationView.MenuItems>
4363

44-
<Frame x:Name="ContentFrame" NavigationUIVisibility="Hidden"></Frame>
64+
<Frame x:Name="ContentFrame" NavigationUIVisibility="Hidden">
65+
66+
</Frame>
67+
4568
</ui:NavigationView>
69+
4670
</Grid>
4771
</Window>

ActiveDesktop/MainWindow.xaml.cs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,23 @@ public partial class MainWindow : Window
3232
public DisplayInfoCollection Displays = new DisplayInfoCollection(); // List of displays and their properties
3333
int SelectedDisplay = -1; // Selected Display that needs to probably be global or smth
3434
public bool IsHidden = false; // Keeps track of whether or not the window is hidden
35+
public System.Drawing.Icon TrayDark;
3536

36-
// Generates pages first
37-
Settings SettingsPage = new Settings();
38-
CurrentApps CurrentAppsPage = new CurrentApps();
39-
SavedApps SavedAppsPage = new SavedApps();
37+
// Generates pages
38+
public Settings SettingsPage;
39+
public CurrentApps CurrentAppsPage;
40+
public SavedApps SavedAppsPage;
4041

4142
// On-start tasks
4243
public MainWindow()
4344
{
45+
// Important thingies
4446
InitializeComponent();
47+
CurrentAppsPage = new CurrentApps();
48+
SavedAppsPage = new SavedApps();
49+
SettingsPage = new Settings();
50+
tbi.Visibility = Visibility.Visible;
51+
4552
// Find and assign desktop handle because microsoft dumb and this can't just be the same thing each boot
4653
IntPtr RootHandle = FindWindowExA(IntPtr.Zero, IntPtr.Zero, "Progman", "Program Manager");
4754
DesktopHandle = FindWindowExA(RootHandle, IntPtr.Zero, "SHELLDLL_DefView", "");
@@ -373,8 +380,8 @@ public void SaveButton_Click(object sender, RoutedEventArgs e)
373380
GetWindowRect(hwnd, out PosTarget);
374381
GetWindowText(hwnd, WindowTitle, 1000);
375382
SavedAppsPage.CmdBox.Text = SyllyIsAwesome;
376-
SavedAppsPage.XBox.Text = PosTarget.Top.ToString();
377-
SavedAppsPage.YBox.Text = PosTarget.Left.ToString();
383+
SavedAppsPage.XBox.Text = PosTarget.Left.ToString();
384+
SavedAppsPage.YBox.Text = PosTarget.Top.ToString();
378385
SavedAppsPage.WidthBox.Text = GetWindowSize(hwnd).Width.ToString();
379386
SavedAppsPage.HeightBox.Text = GetWindowSize(hwnd).Height.ToString();
380387
SavedAppsPage.NameBox.Text = WindowTitle.ToString();
@@ -446,7 +453,7 @@ public void MonitorSelectButton_Click(object sender, RoutedEventArgs e)
446453
{
447454
SelectedDisplay = 0;
448455
}
449-
SavedAppsPage.MonitorSelectButton.Content = "Monitor: " + (SelectedDisplay + 1).ToString();
456+
SavedAppsPage.MonitorSelectButton.Content = "Monitor:\n " + (SelectedDisplay + 1).ToString();
450457
try
451458
{
452459
SavedAppsPage.XBox.Text = Displays[SelectedDisplay].MonitorArea.Left.ToString();
@@ -480,7 +487,11 @@ public void CmdBox_LostFocus(object sender, RoutedEventArgs e)
480487
SavedAppsPage.YBox.IsEnabled = false;
481488
SavedAppsPage.WidthBox.IsEnabled = false;
482489
SavedAppsPage.HeightBox.IsEnabled = false;
483-
MonitorSelectButton_Click(null, null);
490+
SavedAppsPage.XBox.Text = Displays[0].MonitorArea.Left.ToString();
491+
SavedAppsPage.YBox.Text = Displays[0].MonitorArea.Top.ToString();
492+
SavedAppsPage.WidthBox.Text = Displays[0].ScreenWidth;
493+
SavedAppsPage.HeightBox.Text = Displays[0].ScreenHeight;
494+
SavedAppsPage.MonitorSelectButton.Content = "Monitor:\n 1";
484495
}
485496
else
486497
{
@@ -517,6 +528,7 @@ public void ShowMenuItem_Click(object sender, EventArgs e)
517528
// Proper close button thingy
518529
public void CloseMenuItem_Click(object sender, EventArgs e)
519530
{
531+
tbi.Visibility = Visibility.Hidden;
520532
Application.Current.Shutdown();
521533
}
522534

@@ -530,6 +542,7 @@ public void FixButton_Click(object sender, RoutedEventArgs e)
530542
}
531543
}
532544

545+
// Navigation View Loading Handler Thing™
533546
private void NavView_Loaded(object sender, RoutedEventArgs e)
534547
{
535548
NavView.IsBackButtonVisible = NavigationViewBackButtonVisible.Collapsed;
@@ -546,10 +559,12 @@ private void NavView_Loaded(object sender, RoutedEventArgs e)
546559
NavView.SelectedItem = NavView.MenuItems[0];
547560
}
548561

562+
// Navigation View Selection Handler Thing™
549563
private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
550564
{
551565
}
552566

567+
// Navigation View Invoke Handler Thing™
553568
private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
554569
{
555570
{
@@ -679,8 +694,6 @@ public class App
679694
public bool Pin { get; set; }
680695
}
681696

682-
683-
684697
[StructLayout(LayoutKind.Sequential)]
685698
public struct RECT
686699
{
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
<Page x:Class="ActiveDesktop.Views.CurrentApps"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
34
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:local="clr-namespace:ActiveDesktop.Views"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
76
mc:Ignorable="d"
8-
Title="CurrentApps" Width="325" Height="462">
7+
Title="CurrentApps" Width="325" Height="488">
98

109
<Grid>
11-
<TextBox x:Name="HwndInputTextBox" Height="26" TextWrapping="Wrap" VerticalAlignment="Top" ToolTip="The handle of the currently selected window" Margin="117,44,0,0" HorizontalAlignment="Left" Width="203"/>
12-
<Button x:Name="ApplyHwndButton" Content="Send to Desktop" Click="ApplyHwndButton_Click" HorizontalAlignment="Left" Width="315" Height="55" VerticalAlignment="Top" IsDefault="True" ToolTip="Send the selected window to the desktop" Margin="5,81,0,0"/>
13-
<ListBox x:Name="HandleListBox" Height="195" VerticalAlignment="Top" HorizontalAlignment="Left" Width="315" ToolTip="List of apps currently open on the desktop" Margin="5,141,0,0">
10+
<TextBox x:Name="HwndInputTextBox" Height="26" TextWrapping="Wrap" VerticalAlignment="Top" ToolTip="The handle of the currently selected window" Margin="117,68,0,0" HorizontalAlignment="Left" Width="203"/>
11+
<Button x:Name="ApplyHwndButton" Content="Send to Desktop" Click="ApplyHwndButton_Click" HorizontalAlignment="Left" Width="315" Height="55" VerticalAlignment="Top" IsDefault="True" ToolTip="Send the selected window to the desktop" Margin="5,105,0,0"/>
12+
<ListBox x:Name="HandleListBox" Height="195" VerticalAlignment="Top" HorizontalAlignment="Left" Width="315" ToolTip="List of apps currently open on the desktop" Margin="5,165,0,0">
1413
<UniformGrid Columns="2"/>
1514
</ListBox>
16-
<Button x:Name="BorderlessButton" Content="Toggle Borders" HorizontalContentAlignment="Center" VerticalAlignment="Top" Click="BorderlessButton_Click" HorizontalAlignment="Left" Width="154" ToolTip="Hide and show the selected window's borders" Margin="5,421,0,0" Height="35"/>
17-
<Button x:Name="LockButton" Content="Toggle Lock" HorizontalContentAlignment="Center" Height="35" VerticalAlignment="Top" Click="LockButton_Click" HorizontalAlignment="Left" Width="154" ToolTip="Lock the selected window, preventing you from interacting or moving it" Margin="5,381,0,0"/>
18-
<Button x:Name="FixButton" Content="Fix Alignment" HorizontalContentAlignment="Center" VerticalAlignment="Top" HorizontalAlignment="Left" Click="FixButton_Click" ToolTip="If your window appears partially or completely off-screen, this button might fix it" Margin="166,421,0,0" Width="154" Height="35"/>
19-
<Button x:Name="CloseButton" Content="Close" HorizontalContentAlignment="Center" Height="35" VerticalAlignment="Top" Click="CloseButton_Click" HorizontalAlignment="Left" Width="154" ToolTip="Close the selected window" Margin="166,381,0,0"/>
20-
<Button x:Name="SaveButton" Content="Copy selected app to Saved Apps" HorizontalContentAlignment="Center" Height="35" VerticalAlignment="Top" Click="SaveButton_Click" HorizontalAlignment="Left" Width="315" ToolTip="Copies the properties of the selected app to the Saved Apps section below, so you can quickly add it to your list of saved apps" Margin="5,341,0,0"/>
21-
<Label x:Name="WindowLabel" Content="Selected window: " HorizontalAlignment="Left" VerticalAlignment="Top" Width="109" Height="26" Margin="5,10,0,0"/>
22-
<TextBox x:Name="TitleTextBox" Height="26" VerticalAlignment="Top" Focusable="False" MaxLines="1" ToolTip="The name of the currently selected window" Margin="117,7,0,0" HorizontalAlignment="Left" Width="203"/>
23-
<Label x:Name="HandleLabel" Content="Selected handle: " HorizontalAlignment="Left" VerticalAlignment="Top" Width="104" Height="26" Margin="10,47,0,0"/>
15+
<Button x:Name="BorderlessButton" Content="Toggle Borders" HorizontalContentAlignment="Center" VerticalAlignment="Top" Click="BorderlessButton_Click" HorizontalAlignment="Left" Width="154" ToolTip="Hide and show the selected window's borders" Margin="5,448,0,0" Height="35"/>
16+
<Button x:Name="LockButton" Content="Toggle Lock" HorizontalContentAlignment="Center" Height="35" VerticalAlignment="Top" Click="LockButton_Click" HorizontalAlignment="Left" Width="154" ToolTip="Lock the selected window, preventing you from interacting or moving it" Margin="5,408,0,0"/>
17+
<Button x:Name="FixButton" Content="Fix Alignment" HorizontalContentAlignment="Center" VerticalAlignment="Top" HorizontalAlignment="Left" Click="FixButton_Click" ToolTip="If your window appears partially or completely off-screen, this button might fix it" Margin="166,448,0,0" Width="154" Height="35"/>
18+
<Button x:Name="CloseButton" Content="Close" HorizontalContentAlignment="Center" Height="35" VerticalAlignment="Top" Click="CloseButton_Click" HorizontalAlignment="Left" Width="154" ToolTip="Close the selected window" Margin="166,408,0,0"/>
19+
<Button x:Name="SaveButton" Content="Copy selected app to Saved Apps" HorizontalContentAlignment="Center" Height="35" VerticalAlignment="Top" Click="SaveButton_Click" HorizontalAlignment="Left" Width="315" ToolTip="Copies the properties of the selected app to the Saved Apps section below, so you can quickly add it to your list of saved apps" Margin="5,368,0,0"/>
20+
<Label x:Name="WindowLabel" Content="Selected window: " HorizontalAlignment="Left" VerticalAlignment="Top" Width="109" Height="26" Margin="5,34,0,0"/>
21+
<TextBox x:Name="TitleTextBox" Height="26" VerticalAlignment="Top" Focusable="False" MaxLines="1" ToolTip="The name of the currently selected window" Margin="117,31,0,0" HorizontalAlignment="Left" Width="203"/>
22+
<Label x:Name="HandleLabel" Content="Selected handle: " HorizontalAlignment="Left" VerticalAlignment="Top" Width="104" Height="26" Margin="10,71,0,0"/>
2423
</Grid>
2524
</Page>

0 commit comments

Comments
 (0)