Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
Switch to Grabacr07/VirtualDesktop#57 commit c0f93aea77129850dc3f4442…
Browse files Browse the repository at this point in the history
…bc37900ece3d7131

--HG--
branch : Win11
  • Loading branch information
squidly committed Sep 4, 2021
1 parent f7a3323 commit 85636cd
Show file tree
Hide file tree
Showing 68 changed files with 3,092 additions and 2,063 deletions.
5 changes: 0 additions & 5 deletions VirtualDesktop-master/CREDIT.txt

This file was deleted.

19 changes: 0 additions & 19 deletions VirtualDesktop-master/appveyor.yml

This file was deleted.

39 changes: 39 additions & 0 deletions VirtualDesktop-master/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net

pool:
vmImage: 'windows-latest'

variables:
solution: 'source/VirtualDesktop.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'

steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: 'build'
projects: '$(solution)'
arguments: '-c $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: pack
packagesToPack: '$(solution)'
packDirectory: '$(Build.ArtifactStagingDirectory)'
nobuild: true
versioningScheme: 'off'
arguments: '-c $(buildConfiguration)'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/release'))

- task: PublishBuildArtifacts@1
displayName: 'publish artifact: drop'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
3 changes: 3 additions & 0 deletions VirtualDesktop-master/packaging/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*
!/.gitignore
!/*.bat
2 changes: 2 additions & 0 deletions VirtualDesktop-master/packaging/pack.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dotnet build ..\source\VirtualDesktop.sln -c Release
dotnet pack ..\source\VirtualDesktop.sln -c Release --no-build -o %CD%

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
<Setter Property="BorderThickness"
Value="0.99" />
</Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Padding"
Value="18,4" />
<Setter Property="HorizontalContentAlignment"
Value="Left" />
<Setter Property="Margin"
Value="8" />
<Setter Property="BorderThickness"
Value="0.99" />
</Style>
</Panel.Resources>
<StackPanel Margin="8">
<RadioButton x:Name="ThisWindowMenu"
Expand Down Expand Up @@ -56,6 +66,21 @@
Click="PinApp" />
<Button Content="Remove"
Click="Remove" />
<Button Content="Get name"
Click="GetName" />
<TextBox x:Name="NameTextBlock"
Margin="8,8,8,0"
Text="Desktop name" />
<Button Grid.Column="1"
Content="Set name"
Click="SetName"
Margin="8,0,8,8" />
<Button Content="Get wallpaper path"
Click="GetWallpaperPath" />
<Button Content="Move to previous"
Click="MovePrevious" />
<Button Content="Move to next"
Click="MoveNext" />
</StackPanel>
</ScrollViewer>
</Window>
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ private static async void InitializeComObjects()
{
try
{
await VirtualDesktopProvider.Default.Initialize();
await VirtualDesktopProvider.Default.Initialize(TaskScheduler.FromCurrentSynchronizationContext());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Failed to initialize.");
}

VirtualDesktop.CurrentChanged += (sender, args) => System.Diagnostics.Debug.WriteLine($"Desktop changed: {args.NewDesktop.Id}");
VirtualDesktop.Moved += (sender, args) => System.Diagnostics.Debug.WriteLine($"Desktop moved: {args.OldIndex} -> {args.NewIndex} ({args.Source.Id})");
VirtualDesktop.Renamed += (sender, args) => System.Diagnostics.Debug.WriteLine($"Desktop renamed: {args.OldName} -> {args.NewName} ({args.Source.Id})");
}

private void CreateNew(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -124,7 +126,7 @@ private async void PinApp(object sender, RoutedEventArgs e)
{
await Task.Delay(_delay);
var appId = ApplicationHelper.GetAppId(GetForegroundWindow());
(VirtualDesktop.IsPinnedApplication(appId) ? VirtualDesktop.UnpinApplication : (Action<string>)VirtualDesktop.PinApplication)(appId);
if (appId != null) (VirtualDesktop.IsPinnedApplication(appId) ? VirtualDesktop.UnpinApplication : (Action<string>)VirtualDesktop.PinApplication)(appId);
}
}

Expand All @@ -141,6 +143,79 @@ private async void Remove(object sender, RoutedEventArgs e)
}
}

private async void GetName(object sender, RoutedEventArgs e)
{
if (this.ThisWindowMenu.IsChecked ?? false)
{
var name = this.GetCurrentDesktop().Name;
MessageBox.Show(name, "Current desktop name");
}
else
{
await Task.Delay(_delay);
var name = this.GetCurrentDesktop().Name;
MessageBox.Show(name, "Current desktop name");
}
}

private async void SetName(object sender, RoutedEventArgs e)
{
if (this.ThisWindowMenu.IsChecked ?? false)
{
try
{
this.GetCurrentDesktop().Name = this.NameTextBlock.Text;
}
catch (PlatformNotSupportedException ex)
{
MessageBox.Show(ex.Message, "Error");
}
}
else
{
await Task.Delay(_delay);
try
{
this.GetCurrentDesktop().Name = this.NameTextBlock.Text;
}
catch (PlatformNotSupportedException ex)
{
MessageBox.Show(ex.Message, "Error");
}
}
}

private async void GetWallpaperPath(object sender, RoutedEventArgs e)
{
if (this.ThisWindowMenu.IsChecked ?? false)
{
var name = this.GetCurrentDesktop().WallpaperPath;
MessageBox.Show(name, "Current wallpaper path");
}
else
{
await Task.Delay(_delay);
var name = this.GetCurrentDesktop().WallpaperPath;
MessageBox.Show(name, "Current wallpaper path");
}
}

private void MovePrevious(object sender, RoutedEventArgs e)
{
var desktop = this.GetCurrentDesktop();
if (desktop == null) return;

desktop.Move(desktop.Index - 1);
}

private void MoveNext(object sender, RoutedEventArgs e)
{
var desktop = this.GetCurrentDesktop();
if (desktop == null) return;

desktop.Move(desktop.Index + 1);
}


[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
using System.Windows;

[assembly: AssemblyTitle("VirtualDesktop.Showcase")]
[assembly: AssemblyCompany("grabacr.net")]
[assembly: AssemblyProduct("VirtualDesktop")]
[assembly: AssemblyDescription("C# wrapper for IVirtualDesktopManager on Windows 10.")]
[assembly: AssemblyCopyright("Copyright © 2015 Manato KAMEYA")]

[assembly: ComVisible(false)]
[assembly: Guid("5B4544B8-3EF0-4E9F-8D60-DD605AD99725")]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]

[assembly: AssemblyVersion("1.0.0.0")]

This file was deleted.

Loading

0 comments on commit 85636cd

Please sign in to comment.