├── .github
└── FUNDING.yml
├── .gitignore
├── Debug install.lnk
├── Debug uninstall.lnk
├── Debug.bat
├── DeskBand Media Controls.sln
├── Directory.Build.props
├── Install guide.txt
├── LICENSE
├── MediaControls.DeskBand
├── CSDeskBand.cs
├── Deskband.cs
├── Logo.ico
├── MediaControls.DeskBand.csproj
├── MediaControls.DeskBand_knm24ohz_wpftmp.csproj
├── MediaSelector.xaml
├── MediaSelector.xaml.cs
├── MediaSession.cs
├── PlaceHolder Album Cover Spotify.png
├── PlaceHolder Album Cover long.png
├── PlaceHolder Album Cover.png
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.fr.Designer.cs
│ ├── Resources.fr.resx
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ ├── Settings.settings
│ └── app.manifest
├── UserControl1.Designer.cs
├── UserControl1.cs
├── ViewModels
│ └── MediaSelectorViewModels.cs
└── packages.config
├── MediaControls.Installer
├── App.config
├── App.xaml
├── App.xaml.cs
├── DeskBand Register.cs
├── ExplorerManager.cs
├── FodyWeavers.xsd
├── Installer.cs
├── Logo.ico
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── MediaControls.DeskBand.dll
├── MediaControls.Installer.csproj
├── MediaControls.Installer_TemporaryKey.pfx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.fr.Designer.cs
│ ├── Resources.fr.resx
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── MediaControls.DeskBand.dll
│ └── Octokit.dll
└── app.manifest
├── MediaControls.Test
├── App.config
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── MediaControls.Test.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── TestWindow.xaml
└── TestWindow.xaml.cs
├── MediaControls.UWP
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── LockScreenLogo.scale-200.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ └── Wide310x150Logo.scale-200.png
├── MainPage.xaml
├── MainPage.xaml.cs
├── MediaControls.UWP.csproj
├── PachageFinder.xaml
├── PachageFinder.xaml.cs
├── Package.appxmanifest
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── SegoeIcons.cs
├── SessionMonitoring.xaml
└── SessionMonitoring.xaml.cs
├── MediaControls.WPF
├── App.config
├── App.xaml
├── App.xaml.cs
├── FocusMe.cs
├── Logo.ico
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── MediaControls.WPF.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── WindowManagement.cs
├── MediaControls
├── DefinitionExtension.cs
├── GitHubHelper.cs
├── IconUtilities.cs
├── LightDarkModeGetter.cs
├── Logo.ico
├── MediaControls.csproj
├── Modeles
│ ├── Player.cs
│ ├── PlayerModel.cs
│ └── PlayerShortcut.cs
├── PlayerUtilities.cs
├── Properties
│ └── AssemblyInfo.cs
├── SegoeIcons.cs
├── SessionManager.cs
├── TargetInput.cs
├── Taskbar.cs
└── View
│ ├── MediaSelectorWindow.xaml
│ ├── MediaSelectorWindow.xaml.cs
│ ├── PlayersShorcutUserControl.xaml
│ ├── PlayersShorcutUserControl.xaml.cs
│ ├── UserControl1.xaml
│ └── UserControl1.xaml.cs
├── README.md
├── Sans titre.png
└── Store
├── Intro.gif
├── Logo 256.ico
├── Logo 48.ico
├── Logo.ico
├── Logo.pfi
├── Logo.png
├── Media control.png
├── Media controls Resize.png
├── OneClick Install Resize.png
├── OneClick Install.png
├── Player selector resize.png
├── Player selector.png
├── Simple 2.png
└── Simple.png
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | #github: Tom60chat
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: tom60
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | #custom: https://www.paypal.com/donate?hosted_button_id=EA39WRQB9H28G
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 | [Ll]ogs/
33 |
34 | # Visual Studio 2015/2017 cache/options directory
35 | .vs/
36 | # Uncomment if you have tasks that create the project's static files in wwwroot
37 | #wwwroot/
38 |
39 | # Visual Studio 2017 auto generated files
40 | Generated\ Files/
41 |
42 | # MSTest test Results
43 | [Tt]est[Rr]esult*/
44 | [Bb]uild[Ll]og.*
45 |
46 | # NUnit
47 | *.VisualState.xml
48 | TestResult.xml
49 | nunit-*.xml
50 |
51 | # Build Results of an ATL Project
52 | [Dd]ebugPS/
53 | [Rr]eleasePS/
54 | dlldata.c
55 |
56 | # Benchmark Results
57 | BenchmarkDotNet.Artifacts/
58 |
59 | # .NET Core
60 | project.lock.json
61 | project.fragment.lock.json
62 | artifacts/
63 |
64 | # StyleCop
65 | StyleCopReport.xml
66 |
67 | # Files built by Visual Studio
68 | *_i.c
69 | *_p.c
70 | *_h.h
71 | *.ilk
72 | *.meta
73 | *.obj
74 | *.iobj
75 | *.pch
76 | *.pdb
77 | *.ipdb
78 | *.pgc
79 | *.pgd
80 | *.rsp
81 | *.sbr
82 | *.tlb
83 | *.tli
84 | *.tlh
85 | *.tmp
86 | *.tmp_proj
87 | *_wpftmp.csproj
88 | *.log
89 | *.vspscc
90 | *.vssscc
91 | .builds
92 | *.pidb
93 | *.svclog
94 | *.scc
95 |
96 | # Chutzpah Test files
97 | _Chutzpah*
98 |
99 | # Visual C++ cache files
100 | ipch/
101 | *.aps
102 | *.ncb
103 | *.opendb
104 | *.opensdf
105 | *.sdf
106 | *.cachefile
107 | *.VC.db
108 | *.VC.VC.opendb
109 |
110 | # Visual Studio profiler
111 | *.psess
112 | *.vsp
113 | *.vspx
114 | *.sap
115 |
116 | # Visual Studio Trace Files
117 | *.e2e
118 |
119 | # TFS 2012 Local Workspace
120 | $tf/
121 |
122 | # Guidance Automation Toolkit
123 | *.gpState
124 |
125 | # ReSharper is a .NET coding add-in
126 | _ReSharper*/
127 | *.[Rr]e[Ss]harper
128 | *.DotSettings.user
129 |
130 | # TeamCity is a build add-in
131 | _TeamCity*
132 |
133 | # DotCover is a Code Coverage Tool
134 | *.dotCover
135 |
136 | # AxoCover is a Code Coverage Tool
137 | .axoCover/*
138 | !.axoCover/settings.json
139 |
140 | # Visual Studio code coverage results
141 | *.coverage
142 | *.coveragexml
143 |
144 | # NCrunch
145 | _NCrunch_*
146 | .*crunch*.local.xml
147 | nCrunchTemp_*
148 |
149 | # MightyMoose
150 | *.mm.*
151 | AutoTest.Net/
152 |
153 | # Web workbench (sass)
154 | .sass-cache/
155 |
156 | # Installshield output folder
157 | [Ee]xpress/
158 |
159 | # DocProject is a documentation generator add-in
160 | DocProject/buildhelp/
161 | DocProject/Help/*.HxT
162 | DocProject/Help/*.HxC
163 | DocProject/Help/*.hhc
164 | DocProject/Help/*.hhk
165 | DocProject/Help/*.hhp
166 | DocProject/Help/Html2
167 | DocProject/Help/html
168 |
169 | # Click-Once directory
170 | publish/
171 |
172 | # Publish Web Output
173 | *.[Pp]ublish.xml
174 | *.azurePubxml
175 | # Note: Comment the next line if you want to checkin your web deploy settings,
176 | # but database connection strings (with potential passwords) will be unencrypted
177 | *.pubxml
178 | *.publishproj
179 |
180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
181 | # checkin your Azure Web App publish settings, but sensitive information contained
182 | # in these scripts will be unencrypted
183 | PublishScripts/
184 |
185 | # NuGet Packages
186 | *.nupkg
187 | # NuGet Symbol Packages
188 | *.snupkg
189 | # The packages folder can be ignored because of Package Restore
190 | **/[Pp]ackages/*
191 | # except build/, which is used as an MSBuild target.
192 | !**/[Pp]ackages/build/
193 | # Uncomment if necessary however generally it will be regenerated when needed
194 | #!**/[Pp]ackages/repositories.config
195 | # NuGet v3's project.json files produces more ignorable files
196 | *.nuget.props
197 | *.nuget.targets
198 |
199 | # Microsoft Azure Build Output
200 | csx/
201 | *.build.csdef
202 |
203 | # Microsoft Azure Emulator
204 | ecf/
205 | rcf/
206 |
207 | # Windows Store app package directories and files
208 | AppPackages/
209 | BundleArtifacts/
210 | Package.StoreAssociation.xml
211 | _pkginfo.txt
212 | *.appx
213 | *.appxbundle
214 | *.appxupload
215 |
216 | # Visual Studio cache files
217 | # files ending in .cache can be ignored
218 | *.[Cc]ache
219 | # but keep track of directories ending in .cache
220 | !?*.[Cc]ache/
221 |
222 | # Others
223 | ClientBin/
224 | ~$*
225 | *~
226 | *.dbmdl
227 | *.dbproj.schemaview
228 | *.jfm
229 | *.pfx
230 | *.publishsettings
231 | orleans.codegen.cs
232 |
233 | # Including strong name files can present a security risk
234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
235 | #*.snk
236 |
237 | # Since there are multiple workflows, uncomment next line to ignore bower_components
238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
239 | #bower_components/
240 |
241 | # RIA/Silverlight projects
242 | Generated_Code/
243 |
244 | # Backup & report files from converting an old project file
245 | # to a newer Visual Studio version. Backup files are not needed,
246 | # because we have git ;-)
247 | _UpgradeReport_Files/
248 | Backup*/
249 | UpgradeLog*.XML
250 | UpgradeLog*.htm
251 | ServiceFabricBackup/
252 | *.rptproj.bak
253 |
254 | # SQL Server files
255 | *.mdf
256 | *.ldf
257 | *.ndf
258 |
259 | # Business Intelligence projects
260 | *.rdl.data
261 | *.bim.layout
262 | *.bim_*.settings
263 | *.rptproj.rsuser
264 | *- [Bb]ackup.rdl
265 | *- [Bb]ackup ([0-9]).rdl
266 | *- [Bb]ackup ([0-9][0-9]).rdl
267 |
268 | # Microsoft Fakes
269 | FakesAssemblies/
270 |
271 | # GhostDoc plugin setting file
272 | *.GhostDoc.xml
273 |
274 | # Node.js Tools for Visual Studio
275 | .ntvs_analysis.dat
276 | node_modules/
277 |
278 | # Visual Studio 6 build log
279 | *.plg
280 |
281 | # Visual Studio 6 workspace options file
282 | *.opt
283 |
284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
285 | *.vbw
286 |
287 | # Visual Studio LightSwitch build output
288 | **/*.HTMLClient/GeneratedArtifacts
289 | **/*.DesktopClient/GeneratedArtifacts
290 | **/*.DesktopClient/ModelManifest.xml
291 | **/*.Server/GeneratedArtifacts
292 | **/*.Server/ModelManifest.xml
293 | _Pvt_Extensions
294 |
295 | # Paket dependency manager
296 | .paket/paket.exe
297 | paket-files/
298 |
299 | # FAKE - F# Make
300 | .fake/
301 |
302 | # CodeRush personal settings
303 | .cr/personal
304 |
305 | # Python Tools for Visual Studio (PTVS)
306 | __pycache__/
307 | *.pyc
308 |
309 | # Cake - Uncomment if you are using it
310 | # tools/**
311 | # !tools/packages.config
312 |
313 | # Tabs Studio
314 | *.tss
315 |
316 | # Telerik's JustMock configuration file
317 | *.jmconfig
318 |
319 | # BizTalk build output
320 | *.btp.cs
321 | *.btm.cs
322 | *.odx.cs
323 | *.xsd.cs
324 |
325 | # OpenCover UI analysis results
326 | OpenCover/
327 |
328 | # Azure Stream Analytics local run output
329 | ASALocalRun/
330 |
331 | # MSBuild Binary and Structured Log
332 | *.binlog
333 |
334 | # NVidia Nsight GPU debugger configuration file
335 | *.nvuser
336 |
337 | # MFractors (Xamarin productivity tool) working folder
338 | .mfractor/
339 |
340 | # Local History for Visual Studio
341 | .localhistory/
342 |
343 | # BeatPulse healthcheck temp database
344 | healthchecksdb
345 |
346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
347 | MigrationBackup/
348 |
349 | # Ionide (cross platform F# VS Code tools) working folder
350 | .ionide/
351 |
--------------------------------------------------------------------------------
/Debug install.lnk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Debug install.lnk
--------------------------------------------------------------------------------
/Debug uninstall.lnk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Debug uninstall.lnk
--------------------------------------------------------------------------------
/Debug.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe" /nologo %~1 "C:\Users\Tom60\OneDrive\Documents_\Projects\C#\DeskBand Media Controls\MediaControls.DeskBand\bin\Debug\MediaControls.DeskBand.dll"
3 | pause
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | latest
5 | enable
6 |
7 |
--------------------------------------------------------------------------------
/Install guide.txt:
--------------------------------------------------------------------------------
1 | cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
2 | regasm /codebase "C:\Users\Tom60\OneDrive\Documents\Projects\C#\DeskBand Media Controls\MediaControls.DeskBand\bin\Debug\MediaControls.DeskBand.dll"
3 |
4 | regasm /nologo /u "C:\Users\Tom60\OneDrive\Documents\Projects\C#\DeskBand Media Controls\MediaControls.DeskBand\bin\Debug\MediaControls.DeskBand.dll"
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2021, Tom OLIVIER
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Deskband.cs:
--------------------------------------------------------------------------------
1 | using CSDeskBand;
2 | using System;
3 | using System.Runtime.InteropServices;
4 | using System.Windows;
5 |
6 | namespace MediaControls.DeskBand
7 | {
8 | [ComVisible(true)]
9 | [Guid("77D175B4-0A80-4581-A28E-D17150AAE027")]
10 | [CSDeskBandRegistration(Name = "Media Controls", ShowDeskBand = true)]
11 | public class Deskband : CSDeskBandWpf
12 | {
13 | public Deskband()
14 | {
15 | Options.Title = Properties.Resources.Name;
16 |
17 | Options.HorizontalSize = new Size(180, 40);
18 | Options.MinHorizontalSize = new Size(150, 0);
19 |
20 | Options.MinVerticalSize = new Size(0, 150);
21 | Options.VerticalSize = new Size(40, 180);
22 |
23 | Options.HeightCanChange = true;
24 | Options.IsFixed = false;
25 | Options.PropertyChanged += Options_PropertyChanged;
26 |
27 | TaskbarInfo.TaskbarEdgeChanged += TaskbarInfo_TaskbarEdgeChanged;
28 | TaskbarInfo.TaskbarOrientationChanged += TaskbarInfo_TaskbarOrientationChanged;
29 | TaskbarInfo.TaskbarSizeChanged += TaskbarInfo_TaskbarSizeChanged;
30 | }
31 |
32 | private void TaskbarInfo_TaskbarSizeChanged(object sender, TaskbarSizeChangedEventArgs e)
33 | {
34 | }
35 |
36 | private void TaskbarInfo_TaskbarOrientationChanged(object sender, TaskbarOrientationChangedEventArgs e)
37 | {
38 | }
39 |
40 | private void TaskbarInfo_TaskbarEdgeChanged(object sender, TaskbarEdgeChangedEventArgs e)
41 | {
42 | if (UserControl1.Singleton != null)
43 | {
44 | UserControl1.Singleton.CurrentEdge = (System.Windows.Forms.TaskbarPosition)e.Edge;
45 | }
46 | }
47 |
48 | private void Options_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
49 | {
50 |
51 | }
52 |
53 | protected override UIElement UIElement => new UserControl1(); // Return the main wpf control
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.DeskBand/Logo.ico
--------------------------------------------------------------------------------
/MediaControls.DeskBand/MediaControls.DeskBand.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F83F0981-9881-4442-9708-B94962854C22}
8 | library
9 | MediaControls.DeskBand
10 | MediaControls.DeskBand
11 | v4.8
12 | 10.0.17763
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 | true
17 |
18 |
19 |
20 |
21 |
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | TRACE;DEBUG;DESKBAND_WPF
27 | prompt
28 | 4
29 |
30 |
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE;DESKBAND_WPF
35 | prompt
36 | 4
37 |
38 |
39 |
40 |
41 | Logo.ico
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | 4.0
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | Code
68 |
69 |
70 | True
71 | True
72 | Resources.resx
73 |
74 |
75 | True
76 | Settings.settings
77 | True
78 |
79 |
80 | PublicResXFileCodeGenerator
81 | Resources.Designer.cs
82 |
83 |
84 |
85 | SettingsSingleFileGenerator
86 | Settings.Designer.cs
87 |
88 |
89 |
90 |
91 | 10.0.19041.1
92 |
93 |
94 | 0.50.0
95 |
96 |
97 |
98 |
99 | {50A7E9B0-70EF-11D1-B75A-00A0C90564FE}
100 | 1
101 | 0
102 | 0
103 | tlbimp
104 | False
105 | True
106 |
107 |
108 |
109 |
110 | {d31c5efd-96e2-4e28-a169-0e42a55ffce5}
111 | MediaControls
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | %(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/MediaSelector.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/MediaSelector.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using Xamarin.Forms;
8 | using Xamarin.Forms.Xaml;
9 |
10 | namespace MediaControls.DeskBand
11 | {
12 | [XamlCompilation(XamlCompilationOptions.Compile)]
13 | public partial class MediaSelector : ContentPage
14 | {
15 | public MediaSelector()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/MediaControls.DeskBand/MediaSession.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MediaControls.DeskBand
8 | {
9 | class MediaSession
10 | {
11 | public MediaSession()
12 | {
13 |
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/PlaceHolder Album Cover Spotify.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.DeskBand/PlaceHolder Album Cover Spotify.png
--------------------------------------------------------------------------------
/MediaControls.DeskBand/PlaceHolder Album Cover long.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.DeskBand/PlaceHolder Album Cover long.png
--------------------------------------------------------------------------------
/MediaControls.DeskBand/PlaceHolder Album Cover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.DeskBand/PlaceHolder Album Cover.png
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // Les informations générales relatives à un assembly dépendent de
8 | // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
9 | // associées à un assembly.
10 | [assembly: AssemblyTitle("DeskBand Media Controls")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("TaskBar Media Controls")]
15 | [assembly: AssemblyCopyright("Tom OLIVIER 2022")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
20 | // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
21 | // COM, affectez la valeur true à l'attribut ComVisible sur ce type.
22 | [assembly: ComVisible(false)]
23 |
24 | //Pour commencer à générer des applications localisables, définissez
25 | //CultureUtiliséePourCoder dans votre fichier .csproj
26 | //dans . Par exemple, si vous utilisez le français
27 | //dans vos fichiers sources, définissez à fr-FR. Puis, supprimez les marques de commentaire de
28 | //l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans
29 | //la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly:ThemeInfo(
35 | ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème
36 | //(utilisé si une ressource est introuvable dans la page,
37 | // ou dictionnaires de ressources de l'application)
38 | ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique
39 | //(utilisé si une ressource est introuvable dans la page,
40 | // dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème)
41 | )]
42 |
43 |
44 | // Les informations de version pour un assembly se composent des quatre valeurs suivantes :
45 | //
46 | // Version principale
47 | // Version secondaire
48 | // Numéro de build
49 | // Révision
50 | //
51 | // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
52 | // en utilisant '*', comme indiqué ci-dessous :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.3.0.0")]
55 | [assembly: AssemblyFileVersion("1.3.0.0")]
56 | [assembly: NeutralResourcesLanguage("")]
57 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Ce code a été généré par un outil.
4 | // Version du runtime :4.0.30319.42000
5 | //
6 | // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
7 | // le code est régénéré.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MediaControls.DeskBand.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
17 | ///
18 | // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
19 | // à l'aide d'un outil, tel que ResGen ou Visual Studio.
20 | // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
21 | // avec l'option /str ou régénérez votre projet VS.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | public class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | public static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaControls.DeskBand.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Remplace la propriété CurrentUICulture du thread actuel pour toutes
51 | /// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | public static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Recherche une chaîne localisée semblable à Media Controls.
65 | ///
66 | public static string Name {
67 | get {
68 | return ResourceManager.GetString("Name", resourceCulture);
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Properties/Resources.fr.Designer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.DeskBand/Properties/Resources.fr.Designer.cs
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Properties/Resources.fr.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Contrôles multimédias
122 |
123 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Media Controls
122 |
123 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Ce code a été généré par un outil.
4 | // Version du runtime :4.0.30319.42000
5 | //
6 | // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
7 | // le code est régénéré.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MediaControls.DeskBand.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/Properties/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
54 |
55 |
61 |
62 |
63 |
64 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/UserControl1.Designer.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace MediaControls.DeskBand2
3 | {
4 | partial class UserControl1
5 | {
6 | ///
7 | /// Variable nécessaire au concepteur.
8 | ///
9 | private System.ComponentModel.IContainer components = null;
10 |
11 | ///
12 | /// Nettoyage des ressources utilisées.
13 | ///
14 | /// true si les ressources managées doivent être supprimées ; sinon, false.
15 | protected override void Dispose(bool disposing)
16 | {
17 | if (disposing && (components != null))
18 | {
19 | components.Dispose();
20 | }
21 | base.Dispose(disposing);
22 | }
23 |
24 | #region Code généré par le Concepteur de composants
25 |
26 | ///
27 | /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
28 | /// le contenu de cette méthode avec l'éditeur de code.
29 | ///
30 | private void InitializeComponent()
31 | {
32 | components = new System.ComponentModel.Container();
33 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
34 | }
35 |
36 | #endregion
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/UserControl1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace MediaControls.DeskBand2
12 | {
13 | public partial class UserControl1 : UserControl
14 | {
15 | public UserControl1()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/ViewModels/MediaSelectorViewModels.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Runtime.CompilerServices;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Media;
9 | using Windows.UI.ViewManagement;
10 |
11 | namespace MediaControls.DeskBand.ViewModels
12 | {
13 | class MediaSelectorViewModels : INotifyPropertyChanged
14 | {
15 | public event PropertyChangedEventHandler PropertyChanged;
16 |
17 | // This method is called by the Set accessor of each property.
18 | // The CallerMemberName attribute that is applied to the optional propertyName
19 | // parameter causes the property name of the caller to be substituted as an argument.
20 | private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
21 | {
22 | if (PropertyChanged != null)
23 | {
24 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
25 | }
26 | }
27 |
28 |
29 | public MediaSelectorViewModels()
30 | {
31 | UISettings settings = new UISettings();
32 | var foreground = settings.GetColorValue(UIColorType.Foreground);
33 | var background = settings.GetColorValue(UIColorType.Background);
34 | Color myforeColor = Color.FromArgb(foreground.A, foreground.R, foreground.G, foreground.B);
35 | ForeBrush = new SolidColorBrush(myforeColor);
36 |
37 | Color mybackColor = Color.FromArgb(background.A, background.R, background.G, background.B);
38 | BackBrush = new SolidColorBrush(mybackColor);
39 | }
40 |
41 | private SolidColorBrush foreBrush = new SolidColorBrush(Colors.Black);
42 | public SolidColorBrush ForeBrush
43 | {
44 | get
45 | {
46 | return foreBrush;
47 | }
48 | set
49 | {
50 | foreBrush = value;
51 | NotifyPropertyChanged();
52 | }
53 | }
54 |
55 |
56 | private SolidColorBrush backBrush = new SolidColorBrush(Colors.White);
57 | public SolidColorBrush BackBrush
58 | {
59 | get
60 | {
61 | return backBrush;
62 | }
63 | set
64 | {
65 | backBrush = value;
66 | NotifyPropertyChanged();
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/MediaControls.DeskBand/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MediaControls.Installer/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MediaControls.Installer/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MediaControls.Installer/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Globalization;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Reflection;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 |
12 | namespace MediaControls.Installer
13 | {
14 | ///
15 | /// Logique d'interaction pour App.xaml
16 | ///
17 | public partial class App : Application
18 | {
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MediaControls.Installer/DeskBand Register.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Reflection;
6 | using System.Runtime.InteropServices;
7 | using System.Windows;
8 |
9 | namespace MediaControls.Installer
10 | {
11 | public class DeskbandRegister : MarshalByRefObject
12 | {
13 | public bool Register(string dllPath)
14 | {
15 | var asm = Assembly.LoadFile(dllPath);
16 | return Register(asm);
17 | }
18 |
19 | public bool Unregister(string dllPath)
20 | {
21 | var asm = Assembly.LoadFile(dllPath);
22 | return Unregister(asm);
23 | }
24 |
25 | public static bool Register(Assembly asm)
26 | {
27 | var regAsm = new RegistrationServices();
28 |
29 | try
30 | {
31 | return regAsm.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase);
32 | }
33 | catch (Exception e)
34 | {
35 | MessageBox.Show(e.Message, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
36 | Console.WriteLine(e.ToString());
37 | return false;
38 | }
39 | }
40 |
41 | public static bool Unregister(Assembly asm)
42 | {
43 | var regAsm = new RegistrationServices();
44 |
45 | try
46 | {
47 | return regAsm.UnregisterAssembly(asm);
48 | }
49 | catch (Exception e)
50 | {
51 | MessageBox.Show(e.Message, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
52 | Console.WriteLine(e.ToString());
53 | return false;
54 | }
55 | }
56 |
57 | /*public static string GetRegisteredDllPath(Guid guid)
58 | {
59 | var key = Registry.ClassesRoot.OpenSubKey(@"CLSID\{" + guid.ToString().ToUpper() + "}");
60 |
61 | return string.Empty;
62 | }*/
63 |
64 | ///
65 | /// Check if the DLL is regitered.
66 | ///
67 | /// DLL file name.
68 | /// If the DLL is regitered.
69 | public static bool IsRegistered(string dllName) => Registry.ClassesRoot.OpenSubKey(Path.GetFileNameWithoutExtension(dllName)) != null;
70 |
71 | ///
72 | /// Check if the DLL is regsitered.
73 | /// If the key is not found uncheck "Prefered 32bits" in build option.
74 | ///
75 | /// GUID of the dll.
76 | /// If the DLL is regitered.
77 | public static bool IsRegistered(Guid guid) => Registry.ClassesRoot.OpenSubKey(@"CLSID\{" + guid.ToString().ToUpper() + "}") != null;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/MediaControls.Installer/ExplorerManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace MediaControls.Installer
10 | {
11 | class ExplorerManager
12 | {
13 | [DllImport("user32.dll", SetLastError = true)]
14 | public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
15 |
16 | [DllImport("user32.dll")]
17 | static extern bool PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
18 |
19 | ///
20 | /// Kill the explorer
21 | ///
22 | public static bool Kill()
23 | {
24 | IntPtr hWndTray = FindWindow("Shell_TrayWnd", null);
25 | return PostMessage(hWndTray, 0x5B4, 0, 0);
26 | }
27 |
28 | ///
29 | /// Start the explorer
30 | ///
31 | public static void Start()
32 | {
33 | Process.Start("explorer.exe");
34 | }
35 |
36 | ///
37 | /// Restart the explorer
38 | ///
39 | public static void RestartExplorer()
40 | {
41 | Kill();
42 | Start();
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/MediaControls.Installer/Installer.cs:
--------------------------------------------------------------------------------
1 | using MediaControls.Installer.Properties;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Reflection;
8 | using System.Windows;
9 |
10 | namespace MediaControls.Installer
11 | {
12 | public class Installer
13 | {
14 | public readonly static string InstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "DeskBand Media Controls");
15 |
16 | public static DirectoryInfo InstallDirectory => new DirectoryInfo(InstallPath);
17 |
18 | public static Dictionary DLLs = new Dictionary()
19 | {
20 | {"MediaControls.DeskBand.dll", Resources.MediaControls_DLL},
21 | {"Octokit.dll", Resources.Octokit_DLL},
22 | };
23 |
24 | // https://stackoverflow.com/questions/54151880/using-c-sharp-to-check-if-a-file-is-in-use
25 | public static bool IsFileBusy
26 | {
27 | get
28 | {
29 | try
30 | {
31 | foreach (var DLL in DLLs)
32 | {
33 | using Stream stream = new FileStream(Path.Combine(InstallPath, DLL.Key), FileMode.Open, FileAccess.ReadWrite, FileShare.None);
34 | stream.Close();
35 | stream.Dispose();
36 | }
37 | return false;
38 | }
39 | catch (IOException)
40 | {
41 | // File is in use
42 | return true;
43 | }
44 | catch (Exception)
45 | {
46 | return false;
47 | }
48 | }
49 | }
50 |
51 | public static bool CanUpdate()
52 | {
53 | try
54 | {
55 | var DLL = DLLs.Keys.First();
56 | FileVersionInfo CurrentDll = FileVersionInfo.GetVersionInfo(Path.Combine(InstallPath, DLL));
57 |
58 | //Setup the versions
59 | if (Version.TryParse(CurrentDll.FileVersion, out Version CurrentDLLversion))
60 | {
61 | Version thisVersion = Assembly.GetExecutingAssembly().GetName().Version;
62 | int versionComparison = CurrentDLLversion.CompareTo(thisVersion);
63 |
64 | return versionComparison < 0;
65 | }
66 | }
67 | catch { }
68 |
69 | return false;
70 | }
71 |
72 | public static bool Install()
73 | {
74 | var installDirectory = InstallDirectory;
75 |
76 | try
77 | {
78 | // Create directory if he doesn't exist
79 | if (!installDirectory.Exists)
80 | installDirectory.Create();
81 |
82 | foreach(var DLL in DLLs)
83 | File.WriteAllBytes(Path.Combine(InstallPath, DLL.Key), DLL.Value);
84 |
85 | return true;
86 | }
87 | catch (Exception e)
88 | {
89 | MessageBox.Show(e.Message, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
90 | Console.WriteLine(e.ToString());
91 | return false;
92 | }
93 | }
94 |
95 | public static bool Uninstall()
96 | {
97 | var installDirectory = InstallDirectory;
98 |
99 | try
100 | {
101 | // Delete the file and delete the folder if empty (We don't want to delete user file)
102 | if (installDirectory.Exists)
103 | {
104 |
105 | foreach (var DLL in DLLs)
106 | {
107 | var dllFile = new FileInfo(Path.Combine(InstallPath, DLL.Key));
108 | if (dllFile.Exists)
109 | dllFile.Delete();
110 | }
111 |
112 | // https://stackoverflow.com/questions/755574/how-to-quickly-check-if-folder-is-empty-net
113 | if (!Directory.EnumerateFileSystemEntries(installDirectory.FullName).Any())
114 | installDirectory.Delete();
115 | }
116 |
117 | return true;
118 | }
119 | catch (Exception e)
120 | {
121 | MessageBox.Show(e.Message, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
122 | Console.WriteLine(e.ToString());
123 | return false;
124 | }
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/MediaControls.Installer/Logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.Installer/Logo.ico
--------------------------------------------------------------------------------
/MediaControls.Installer/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/MediaControls.Installer/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Reflection;
6 | using System.Security.Policy;
7 | using System.Text;
8 | using System.Threading;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Controls;
12 | using System.Windows.Data;
13 | using System.Windows.Documents;
14 | using System.Windows.Input;
15 | using System.Windows.Media;
16 | using System.Windows.Media.Imaging;
17 | using System.Windows.Navigation;
18 |
19 | namespace MediaControls.Installer
20 | {
21 | ///
22 | /// Logique d'interaction pour MainWindow.xaml
23 | ///
24 | public partial class MainWindow : Window
25 | {
26 | public readonly Guid DllGuid = new Guid("77D175B4-0A80-4581-A28E-D17150AAE027");
27 |
28 | public MainWindow()
29 | {
30 | // Check version
31 | if ((Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build < 17763) ||
32 | Environment.OSVersion.Version.Major < 10)
33 | {
34 | MessageBox.Show("This app only works on Windows 10 version 1809 (build 17763) or newer", "App not compatible", MessageBoxButton.OK, MessageBoxImage.Warning);
35 | }
36 |
37 | InitializeComponent();
38 | UpdateUi();
39 |
40 | btn_install.Visibility = Visibility.Visible;
41 | txt_Progress.Visibility = Visibility.Collapsed;
42 | }
43 |
44 | private void UpdateUi()
45 | {
46 | if (DeskbandRegister.IsRegistered(DllGuid))
47 | {
48 | btn_install.Content = Properties.Resources.Uninstall;
49 | btnUpdate.Visibility = Installer.CanUpdate() ? Visibility.Visible : Visibility.Collapsed;
50 | }
51 | else
52 | {
53 | btn_install.Content = Properties.Resources.Install;
54 | btnUpdate.Visibility = Visibility.Collapsed;
55 | }
56 | }
57 |
58 | private async void btn_install_Click(object sender, RoutedEventArgs e)
59 | {
60 | UpdateUi();
61 |
62 | taskbar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Indeterminate;
63 | btn_install.Visibility = Visibility.Collapsed;
64 | txt_Progress.Visibility = Visibility.Visible;
65 | txt_Progress.Text = "...";
66 |
67 | await Task.Run(() => {
68 | if (DeskbandRegister.IsRegistered(DllGuid))
69 | {
70 | if (Uninstall())
71 | MessageBox.Show(Properties.Resources.UninstallationSuccess, Properties.Resources.Uninstall);
72 | }
73 | else
74 | {
75 | if (Install())
76 | MessageBox.Show(Properties.Resources.InstallationSuccess, Properties.Resources.Install);
77 | }
78 | });
79 |
80 | taskbar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;
81 | btn_install.Visibility = Visibility.Visible;
82 | txt_Progress.Visibility = Visibility.Collapsed;
83 |
84 | UpdateUi();
85 | }
86 |
87 | private async void btnUpdate_Click(object sender, RoutedEventArgs e)
88 | {
89 | taskbar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Indeterminate;
90 | stkPnlButtons.Visibility = Visibility.Collapsed;
91 | txt_Progress.Visibility = Visibility.Visible;
92 |
93 | await Task.Run(() =>
94 | {
95 | if (Uninstall(false))
96 | {
97 | if (Install())
98 | MessageBox.Show(Properties.Resources.InstallationSuccess, Properties.Resources.Install);
99 |
100 |
101 | if (!Installer.IsFileBusy)
102 | ExplorerManager.Start();
103 | }
104 | });
105 |
106 | taskbar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;
107 | stkPnlButtons.Visibility = Visibility.Visible;
108 | txt_Progress.Visibility = Visibility.Collapsed;
109 |
110 | UpdateUi();
111 | }
112 |
113 | private bool Install()
114 | {
115 | bool success = false;
116 | Dispatcher.Invoke(() => txt_Progress.Text = Properties.Resources.Installing___);
117 |
118 | if (Installer.Install())
119 | {
120 | var domain = AppDomain.CreateDomain(nameof(DeskbandRegister), AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation /* new AppDomainSetup { ApplicationBase = Path.GetDirectoryName(typeof(DeskbandRegister).Assembly.Location) }*/);
121 | try
122 | {
123 | var DLL = Installer.DLLs.Keys.First();
124 | var DllFileName = Path.Combine(Installer.InstallPath, DLL);
125 |
126 | var loader = (DeskbandRegister)domain.CreateInstanceAndUnwrap(typeof(DeskbandRegister).Assembly.FullName, typeof(DeskbandRegister).FullName);
127 |
128 | if (loader.Register(DllFileName))
129 | success = true;
130 | }
131 | finally
132 | {
133 | AppDomain.Unload(domain);
134 | }
135 | }
136 |
137 | return success;
138 | }
139 |
140 | private bool Uninstall(bool RestartExplorer = true)
141 | {
142 | var fileBusy = Installer.IsFileBusy;
143 | bool Unregistered = false;
144 | var DLL = Installer.DLLs.Keys.First();
145 | var DllFileName = Path.Combine(Installer.InstallPath, DLL);
146 |
147 | Dispatcher.Invoke(() => txt_Progress.Text = Properties.Resources.Uninstalling___);
148 |
149 | if (fileBusy)
150 | {
151 | var reply = MessageBox.Show(Properties.Resources.CloseExplorerQuestion + Environment.NewLine + Properties.Resources.ContinueQuestion, Properties.Resources.UninstallationPrerequisites,
152 | MessageBoxButton.YesNo, MessageBoxImage.Question);
153 |
154 | if (reply != MessageBoxResult.Yes)
155 | return false;
156 | }
157 |
158 | if (File.Exists(DllFileName)) // If the dll has been install
159 | {
160 | // Unregister the intalled DLL
161 | var domain = AppDomain.CreateDomain(nameof(DeskbandRegister), AppDomain.CurrentDomain.Evidence, new AppDomainSetup { ApplicationBase = Path.GetDirectoryName(typeof(DeskbandRegister).Assembly.Location) });
162 | try
163 | {
164 | var loader = (DeskbandRegister)domain.CreateInstanceAndUnwrap(typeof(DeskbandRegister).Assembly.FullName, typeof(DeskbandRegister).FullName);
165 | Unregistered = loader.Unregister(DllFileName);
166 | }
167 | finally
168 | {
169 | AppDomain.Unload(domain);
170 | }
171 | }
172 | else
173 | {
174 | // Unregister the embeded DLL
175 | var asm = Assembly.Load(Properties.Resources.MediaControls_DLL);
176 | Unregistered = DeskbandRegister.Unregister(asm);
177 | }
178 |
179 |
180 | if (Unregistered)
181 | {
182 | // We need to kill the explorer and wait to lets the explorer close to free the dll
183 | if (fileBusy)
184 | ExplorerManager.Kill();
185 | else
186 | RestartExplorer = false;
187 |
188 | Thread.Sleep(5000);
189 | var uninstalled = Installer.Uninstall();
190 | if (RestartExplorer)
191 | ExplorerManager.Start();
192 |
193 | if (uninstalled)
194 | return true;
195 | }
196 |
197 | return false;
198 | }
199 | }
200 | }
201 |
--------------------------------------------------------------------------------
/MediaControls.Installer/MediaControls.DeskBand.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.Installer/MediaControls.DeskBand.dll
--------------------------------------------------------------------------------
/MediaControls.Installer/MediaControls.Installer_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.Installer/MediaControls.Installer_TemporaryKey.pfx
--------------------------------------------------------------------------------
/MediaControls.Installer/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Globalization;
4 | using System.Reflection;
5 | using System.Windows;
6 |
7 | namespace MediaControls.Installer
8 | {
9 | public class Program
10 | {
11 | [STAThread]
12 | public static void Main()
13 | {
14 | AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;
15 | App.Main();
16 | }
17 |
18 | ///
19 | /// Hooks to assembly resolver and tries to load assembly (.dll)
20 | /// from executable resources it CLR can't find it locally.
21 | ///
22 | /// Used for embedding assemblies onto executables.
23 | ///
24 | /// See: http://www.digitallycreated.net/Blog/61/combining-multiple-assemblies-into-a-single-exe-for-a-wpf-application
25 | ///
26 | private static Assembly OnResolveAssembly(object sender, ResolveEventArgs args)
27 | {
28 | //MessageBox.Show("Resolving " + args.Name);
29 |
30 | var executingAssembly = Assembly.GetExecutingAssembly();
31 | var assemblyName = new AssemblyName(args.Name);
32 |
33 | var path = assemblyName.Name + ".dll";
34 | if (!assemblyName.CultureInfo.Equals(CultureInfo.InvariantCulture))
35 | {
36 | path = $"{assemblyName.CultureInfo.TwoLetterISOLanguageName}\\{path}";
37 | }
38 |
39 | using (var stream = executingAssembly.GetManifestResourceStream(path))
40 | {
41 | if (stream == null)
42 | {
43 | //MessageBox.Show("Null stream");
44 | return null;
45 | }
46 |
47 | var assemblyRawBytes = new byte[stream.Length];
48 | stream.Read(assemblyRawBytes, 0, assemblyRawBytes.Length);
49 | return Assembly.Load(assemblyRawBytes);
50 | }
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/MediaControls.Installer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // Les informations générales relatives à un assembly dépendent de
8 | // l'ensemble d'attributs suivant. Pour modifier les informations
9 | // associées à un assembly.
10 | [assembly: AssemblyTitle("DeskBand Media Controls Installer")]
11 | [assembly: AssemblyDescription("Install the DeskBand Media Controls")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("KatyCorp")]
14 | [assembly: AssemblyProduct("DeskBand Media Controls Installer")]
15 | [assembly: AssemblyCopyright("Copyright © Tom Olivier 2021")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
20 | // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
21 | // COM, affectez la valeur True à l'attribut ComVisible sur ce type.
22 | [assembly: ComVisible(false)]
23 |
24 | //Pour commencer à générer des applications localisables, définissez
25 | //CultureUtiliséePourCoder dans votre fichier .csproj
26 | //dans . Par exemple, si vous utilisez le français
27 | //dans vos fichiers sources, définissez à fr-FR. Puis, supprimez les marques de commentaire de
28 | //l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans
29 | //la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème
36 | //(utilisé si une ressource est introuvable dans la page,
37 | // ou dictionnaires de ressources de l'application)
38 | ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique
39 | //(utilisé si une ressource est introuvable dans la page,
40 | // dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème)
41 | )]
42 |
43 |
44 | // Les informations de version pour un assembly se composent des quatre valeurs suivantes :
45 | //
46 | // Version principale
47 | // Version secondaire
48 | // Numéro de build
49 | // Révision
50 | //
51 | // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
52 | // en utilisant '*', comme indiqué ci-dessous :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.3.0.0")]
55 | [assembly: AssemblyFileVersion("1.3.0.0")]
56 | [assembly: NeutralResourcesLanguage("en")]
57 |
--------------------------------------------------------------------------------
/MediaControls.Installer/Properties/Resources.fr.Designer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.Installer/Properties/Resources.fr.Designer.cs
--------------------------------------------------------------------------------
/MediaControls.Installer/Properties/Resources.fr.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Cela fermera toutes les fenêtres de votre explorateur de fichiers.
122 |
123 |
124 | Continuer ?
125 |
126 |
127 | Erreur
128 |
129 |
130 | Installer
131 |
132 |
133 | L'installation a réussi !
134 | Vous pouvez afficher ou masquer la barre d'outil en faisant :
135 | - Clique droit sur la barre des tâches.
136 | - Survoler le sous-menu Barres d'outils.
137 | - Cliquer sur Media Controls.
138 |
139 |
140 | Installation...
141 |
142 |
143 | Contrôles multimédias DeskBand
144 |
145 |
146 | Installateur Contrôles multimédias DeskBand
147 |
148 |
149 | Désinstaller
150 |
151 |
152 | Prérequis de désinstallation
153 |
154 |
155 | La désinstallation a réussi !
156 |
157 |
158 | Désinstallation...
159 |
160 |
161 | Mettre à jour
162 |
163 |
--------------------------------------------------------------------------------
/MediaControls.Installer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Ce code a été généré par un outil.
4 | // Version du runtime :4.0.30319.42000
5 | //
6 | // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
7 | // le code est régénéré.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MediaControls.Installer.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MediaControls.Installer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MediaControls.Installer/Resources/MediaControls.DeskBand.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.Installer/Resources/MediaControls.DeskBand.dll
--------------------------------------------------------------------------------
/MediaControls.Installer/Resources/Octokit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.Installer/Resources/Octokit.dll
--------------------------------------------------------------------------------
/MediaControls.Installer/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
50 |
58 |
59 |
73 |
--------------------------------------------------------------------------------
/MediaControls.Test/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MediaControls.Test/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MediaControls.Test/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using MediaControls.DeskBand;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Configuration;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 |
10 | namespace MediaControls.Test
11 | {
12 | ///
13 | /// Logique d'interaction pour App.xaml
14 | ///
15 | public partial class App : Application
16 | {
17 | /*public App()
18 | {
19 | var deskband = new Deskband();
20 | if (deskband._UIElement is UserControl1 mainControl)
21 | {
22 | Current.MainWindow = new MainWindow(mainControl);
23 | Current.MainWindow.Show();
24 | }
25 | }*/
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/MediaControls.Test/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/MediaControls.Test/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using MediaControls.DeskBand;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace MediaControls.Test
18 | {
19 | ///
20 | /// Logique d'interaction pour MainWindow.xaml
21 | ///
22 | public partial class MainWindow : Window
23 | {
24 | public MainWindow(/*UserControl1 mainControl*/)
25 | {
26 | InitializeComponent();
27 | //AddChild(mainControl);
28 |
29 | var testWindow = new TestWindow(UserControl);
30 | testWindow.Show();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/MediaControls.Test/MediaControls.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {70C1FEA0-B329-45D1-AB47-546AF7472538}
8 | WinExe
9 | MediaControls.Test
10 | MediaControls.Test
11 | v4.8
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 | true
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 | false
28 | false
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | 4.0
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | MSBuild:Compile
58 | Designer
59 |
60 |
61 | TestWindow.xaml
62 |
63 |
64 | MSBuild:Compile
65 | Designer
66 |
67 |
68 | App.xaml
69 | Code
70 |
71 |
72 | MainWindow.xaml
73 | Code
74 |
75 |
76 | Designer
77 | MSBuild:Compile
78 |
79 |
80 |
81 |
82 | Code
83 |
84 |
85 | True
86 | True
87 | Resources.resx
88 |
89 |
90 | True
91 | Settings.settings
92 | True
93 |
94 |
95 | ResXFileCodeGenerator
96 | Resources.Designer.cs
97 |
98 |
99 | SettingsSingleFileGenerator
100 | Settings.Designer.cs
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 | {f83f0981-9881-4442-9708-b94962854c22}
109 | MediaControls.DeskBand
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/MediaControls.Test/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // Les informations générales relatives à un assembly dépendent de
8 | // l'ensemble d'attributs suivant. Pour modifier les informations
9 | // associées à un assembly.
10 | [assembly: AssemblyTitle("MediaControls.Test")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("KatyCorp")]
14 | [assembly: AssemblyProduct("MediaControls.Test")]
15 | [assembly: AssemblyCopyright("Copyright © Tom Olivier 2021")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
20 | // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
21 | // COM, affectez la valeur True à l'attribut ComVisible sur ce type.
22 | [assembly: ComVisible(false)]
23 |
24 | //Pour commencer à générer des applications localisables, définissez
25 | //CultureUtiliséePourCoder dans votre fichier .csproj
26 | //dans . Par exemple, si vous utilisez le français
27 | //dans vos fichiers sources, définissez à fr-FR. Puis, supprimez les marques de commentaire de
28 | //l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans
29 | //la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème
36 | //(utilisé si une ressource est introuvable dans la page,
37 | // ou dictionnaires de ressources de l'application)
38 | ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique
39 | //(utilisé si une ressource est introuvable dans la page,
40 | // dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème)
41 | )]
42 |
43 |
44 | // Les informations de version pour un assembly se composent des quatre valeurs suivantes :
45 | //
46 | // Version principale
47 | // Version secondaire
48 | // Numéro de build
49 | // Révision
50 | //
51 | // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
52 | // en utilisant '*', comme indiqué ci-dessous :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/MediaControls.Test/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Ce code a été généré par un outil.
4 | // Version du runtime :4.0.30319.42000
5 | //
6 | // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
7 | // le code est régénéré.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 |
12 | namespace MediaControls.Test.Properties
13 | {
14 | ///
15 | /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
16 | ///
17 | // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
18 | // à l'aide d'un outil, tel que ResGen ou Visual Studio.
19 | // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
20 | // avec l'option /str ou régénérez votre projet VS.
21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
24 | internal class Resources
25 | {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources()
33 | {
34 | }
35 |
36 | ///
37 | /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
38 | ///
39 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
40 | internal static global::System.Resources.ResourceManager ResourceManager
41 | {
42 | get
43 | {
44 | if ((resourceMan == null))
45 | {
46 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaControls.Test.Properties.Resources", typeof(Resources).Assembly);
47 | resourceMan = temp;
48 | }
49 | return resourceMan;
50 | }
51 | }
52 |
53 | ///
54 | /// Remplace la propriété CurrentUICulture du thread actuel pour toutes
55 | /// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
56 | ///
57 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
58 | internal static global::System.Globalization.CultureInfo Culture
59 | {
60 | get
61 | {
62 | return resourceCulture;
63 | }
64 | set
65 | {
66 | resourceCulture = value;
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/MediaControls.Test/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/MediaControls.Test/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 |
12 | namespace MediaControls.Test.Properties
13 | {
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
17 | {
18 |
19 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
20 |
21 | public static Settings Default
22 | {
23 | get
24 | {
25 | return defaultInstance;
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MediaControls.Test/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MediaControls.Test/TestWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/MediaControls.Test/TestWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using MediaControls.DeskBand;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace MediaControls.Test
17 | {
18 | ///
19 | /// Logique d'interaction pour TestWindow.xaml
20 | ///
21 | public partial class TestWindow : Window
22 | {
23 | private UserControl1 userControl;
24 |
25 | public TestWindow(UserControl1 userControl)
26 | {
27 | this.userControl = userControl;
28 | InitializeComponent();
29 | }
30 |
31 | private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
32 | {
33 | if (sender is ComboBox comboBox && comboBox.SelectedItem is ComboBoxItem item)
34 | {
35 | if (item.Content.ToString() == "Top")
36 | {
37 | userControl.CurrentEdge = CSDeskBand.Edge.Top;
38 | }
39 | else if (item.Content.ToString() == "Bottom")
40 | {
41 | userControl.CurrentEdge = CSDeskBand.Edge.Bottom;
42 | }
43 | else if (item.Content.ToString() == "Left")
44 | {
45 | userControl.CurrentEdge = CSDeskBand.Edge.Left;
46 | }
47 | else if (item.Content.ToString() == "Right")
48 | {
49 | userControl.CurrentEdge = CSDeskBand.Edge.Right;
50 | }
51 | }
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/MediaControls.UWP/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MediaControls.UWP/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | namespace MediaControls.UWP
19 | {
20 | ///
21 | /// Fournit un comportement spécifique à l'application afin de compléter la classe Application par défaut.
22 | ///
23 | sealed partial class App : Application
24 | {
25 | ///
26 | /// Initialise l'objet d'application de singleton. Il s'agit de la première ligne du code créé
27 | /// à être exécutée. Elle correspond donc à l'équivalent logique de main() ou WinMain().
28 | ///
29 | public App()
30 | {
31 | this.InitializeComponent();
32 | this.Suspending += OnSuspending;
33 | }
34 |
35 | ///
36 | /// Invoqué lorsque l'application est lancée normalement par l'utilisateur final. D'autres points d'entrée
37 | /// seront utilisés par exemple au moment du lancement de l'application pour l'ouverture d'un fichier spécifique.
38 | ///
39 | /// Détails concernant la requête et le processus de lancement.
40 | protected override void OnLaunched(LaunchActivatedEventArgs e)
41 | {
42 | Frame rootFrame = Window.Current.Content as Frame;
43 |
44 | // Ne répétez pas l'initialisation de l'application lorsque la fenêtre comporte déjà du contenu,
45 | // assurez-vous juste que la fenêtre est active
46 | if (rootFrame == null)
47 | {
48 | // Créez un Frame utilisable comme contexte de navigation et naviguez jusqu'à la première page
49 | rootFrame = new Frame();
50 |
51 | rootFrame.NavigationFailed += OnNavigationFailed;
52 |
53 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
54 | {
55 | //TODO: chargez l'état de l'application précédemment suspendue
56 | }
57 |
58 | // Placez le frame dans la fenêtre active
59 | Window.Current.Content = rootFrame;
60 | }
61 |
62 | if (e.PrelaunchActivated == false)
63 | {
64 | if (rootFrame.Content == null)
65 | {
66 | // Quand la pile de navigation n'est pas restaurée, accédez à la première page,
67 | // puis configurez la nouvelle page en transmettant les informations requises en tant que
68 | // paramètre
69 | rootFrame.Navigate(typeof(SessionMonitoring), e.Arguments);
70 | }
71 | // Vérifiez que la fenêtre actuelle est active
72 | Window.Current.Activate();
73 | }
74 | }
75 |
76 | ///
77 | /// Appelé lorsque la navigation vers une page donnée échoue
78 | ///
79 | /// Frame à l'origine de l'échec de navigation.
80 | /// Détails relatifs à l'échec de navigation
81 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
82 | {
83 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
84 | }
85 |
86 | ///
87 | /// Appelé lorsque l'exécution de l'application est suspendue. L'état de l'application est enregistré
88 | /// sans savoir si l'application pourra se fermer ou reprendre sans endommager
89 | /// le contenu de la mémoire.
90 | ///
91 | /// Source de la requête de suspension.
92 | /// Détails de la requête de suspension.
93 | private void OnSuspending(object sender, SuspendingEventArgs e)
94 | {
95 | var deferral = e.SuspendingOperation.GetDeferral();
96 | //TODO: enregistrez l'état de l'application et arrêtez toute activité en arrière-plan
97 | deferral.Complete();
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/MediaControls.UWP/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.UWP/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/MediaControls.UWP/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.UWP/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/MediaControls.UWP/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.UWP/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/MediaControls.UWP/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.UWP/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/MediaControls.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/MediaControls.UWP/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.UWP/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/MediaControls.UWP/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.UWP/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/MediaControls.UWP/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
17 |
18 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/MediaControls.UWP/PachageFinder.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/MediaControls.UWP/PachageFinder.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.Management.Deployment;
9 | using Windows.UI.Xaml;
10 | using Windows.UI.Xaml.Controls;
11 | using Windows.UI.Xaml.Controls.Primitives;
12 | using Windows.UI.Xaml.Data;
13 | using Windows.UI.Xaml.Input;
14 | using Windows.UI.Xaml.Media;
15 | using Windows.UI.Xaml.Navigation;
16 |
17 | // Pour plus d'informations sur le modèle d'élément Page vierge, consultez la page https://go.microsoft.com/fwlink/?LinkId=234238
18 |
19 | namespace MediaControls.UWP
20 | {
21 | ///
22 | /// Une page vide peut être utilisée seule ou constituer une page de destination au sein d'un frame.
23 | ///
24 | public sealed partial class PachageFinder : Page
25 | {
26 | public PachageFinder()
27 | {
28 | this.InitializeComponent();
29 | }
30 |
31 | private void btn_Go_Click(object sender, RoutedEventArgs e)
32 | {
33 | PackageManager packageManager = new PackageManager();
34 | var packages = packageManager.FindPackagesForUser(string.Empty, fld_PackageFamilyName.Text);
35 | var packagesList = packages.ToList();
36 |
37 | txt_result.Text = packages.ToString();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/MediaControls.UWP/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
15 |
16 |
17 |
18 |
19 | MediaControls.UWP
20 | Tom60
21 | Assets\StoreLogo.png
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
36 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/MediaControls.UWP/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Les informations générales relatives à un assembly dépendent de
6 | // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
7 | // associées à un assembly.
8 | [assembly: AssemblyTitle("MediaControls.UWP")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MediaControls.UWP")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Les informations de version pour un assembly se composent des quatre valeurs suivantes :
18 | //
19 | // Version principale
20 | // Version secondaire
21 | // Numéro de build
22 | // Révision
23 | //
24 | // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
25 | // en utilisant '*', comme indiqué ci-dessous :
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/MediaControls.UWP/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/MediaControls.UWP/SegoeIcons.cs:
--------------------------------------------------------------------------------
1 | namespace MediaControls.UWP
2 | {
3 | public static class SegoeIcons
4 | {
5 | public static string Play => char.ConvertFromUtf32(0xE768);
6 | public static string Pause => char.ConvertFromUtf32(0xE769);
7 | public static string PlayPause => Play + Pause;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MediaControls.UWP/SessionMonitoring.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/MediaControls.UWP/SessionMonitoring.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.Media.Control;
9 | using Windows.UI.Xaml;
10 | using Windows.UI.Xaml.Controls;
11 | using Windows.UI.Xaml.Controls.Primitives;
12 | using Windows.UI.Xaml.Data;
13 | using Windows.UI.Xaml.Input;
14 | using Windows.UI.Xaml.Media;
15 | using Windows.UI.Xaml.Navigation;
16 |
17 | // Pour plus d'informations sur le modèle d'élément Page vierge, consultez la page https://go.microsoft.com/fwlink/?LinkId=234238
18 |
19 | namespace MediaControls.UWP
20 | {
21 | ///
22 | /// Une page vide peut être utilisée seule ou constituer une page de destination au sein d'un frame.
23 | ///
24 | public sealed partial class SessionMonitoring : Page
25 | {
26 | GlobalSystemMediaTransportControlsSessionManager manager;
27 |
28 | public SessionMonitoring()
29 | {
30 | InitializeComponent();
31 |
32 | Init();
33 | }
34 |
35 | async void Init()
36 | {
37 | manager = await GlobalSystemMediaTransportControlsSessionManager.RequestAsync();
38 | manager.CurrentSessionChanged += Manager_CurrentSessionChanged;
39 | manager.SessionsChanged += Manager_SessionsChanged;
40 | }
41 |
42 | private async void Manager_SessionsChanged(GlobalSystemMediaTransportControlsSessionManager sender, SessionsChangedEventArgs args)
43 | {
44 | var sessions = sender.GetSessions();
45 | var currentSession = sender.GetCurrentSession();
46 |
47 | await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
48 | {
49 | Console.Text += $"New sessions: {sessions.Count}" + Environment.NewLine;
50 |
51 | foreach (var session in sessions)
52 | {
53 | Console.Text += $"Session: {session.SourceAppUserModelId}" + Environment.NewLine;
54 | }
55 |
56 | Console.Text += sessions.ToList().Exists(x => x.SourceAppUserModelId == currentSession.SourceAppUserModelId) + Environment.NewLine;
57 |
58 | Console.Text += Environment.NewLine;
59 | });
60 | }
61 |
62 | private async void Manager_CurrentSessionChanged(GlobalSystemMediaTransportControlsSessionManager sender, CurrentSessionChangedEventArgs args)
63 | {
64 | var currentSession = sender.GetCurrentSession();
65 |
66 | await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
67 | {
68 | Console.Text += $"New session: {currentSession.SourceAppUserModelId}" + Environment.NewLine;
69 |
70 | var prop = await currentSession.TryGetMediaPropertiesAsync();
71 |
72 | Console.Text += $"AlbumArtist: {prop.AlbumArtist}, AlbumTitle: {prop.AlbumTitle}, AlbumTrackCount: {prop.AlbumTrackCount}, Artist: {prop.Artist}" +
73 | $", Genres: {prop.Genres}, PlaybackType: {prop.PlaybackType}, Subtitle: {prop.Subtitle}, Title: {prop.Title}, TrackNumber: {prop.TrackNumber}" + Environment.NewLine;
74 | Console.Text += Environment.NewLine;
75 | });
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/MediaControls.WPF/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MediaControls.WPF/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MediaControls.WPF/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace MediaControls.WPF
10 | {
11 | ///
12 | /// Logique d'interaction pour App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MediaControls.WPF/FocusMe.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Interop;
9 |
10 | namespace MediaControls.WPF
11 | {
12 | public static class FocusMe
13 | {
14 | [DllImport("user32.dll", SetLastError = true)]
15 | static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
16 |
17 | // When you don't want the ProcessId, use this overload and pass IntPtr.Zero for the second parameter
18 | [DllImport("user32.dll")]
19 | static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId);
20 |
21 | [DllImport("kernel32.dll")]
22 | static extern uint GetCurrentThreadId();
23 |
24 | /// The GetForegroundWindow function returns a handle to the foreground window.
25 | [DllImport("user32.dll")]
26 | private static extern IntPtr GetForegroundWindow();
27 |
28 | [DllImport("user32.dll")]
29 | static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach);
30 |
31 | [DllImport("user32.dll", SetLastError = true)]
32 | static extern bool BringWindowToTop(IntPtr hWnd);
33 |
34 | [DllImport("user32.dll", SetLastError = true)]
35 | static extern bool BringWindowToTop(HandleRef hWnd);
36 |
37 | [DllImport("user32.dll")]
38 | static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow);
39 |
40 | public static void Focus(Window window)
41 | {
42 | var windowHandle = new WindowInteropHelper(window).Handle;
43 |
44 | // force window to have focus
45 | uint foreThread = GetWindowThreadProcessId(GetForegroundWindow(), IntPtr.Zero);
46 | uint appThread = GetCurrentThreadId();
47 | const uint SW_SHOW = 5;
48 | if (foreThread == appThread)
49 | {
50 | AttachThreadInput(foreThread, appThread, true);
51 | BringWindowToTop(windowHandle);
52 | ShowWindow(windowHandle, SW_SHOW);
53 | AttachThreadInput(foreThread, appThread, false);
54 | }
55 | else
56 | {
57 | BringWindowToTop(windowHandle);
58 | ShowWindow(windowHandle, SW_SHOW);
59 | }
60 | window.Activate();
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/MediaControls.WPF/Logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls.WPF/Logo.ico
--------------------------------------------------------------------------------
/MediaControls.WPF/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/MediaControls.WPF/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Timers;
3 | using System.Windows;
4 | using System.Windows.Interop;
5 | using Taskbar = System.Windows.Forms.Taskbar;
6 |
7 | namespace MediaControls.WPF
8 | {
9 | ///
10 | /// Logique d'interaction pour MainWindow.xaml
11 | ///
12 | public partial class MainWindow : Window
13 | {
14 | public MainWindow()
15 | {
16 | InitializeComponent();
17 |
18 | UserControl.SetCorner(true);
19 |
20 | Top = SystemParameters.WorkArea.Height;
21 | Left = SystemParameters.WorkArea.Left + 168;
22 |
23 | timer = new Timer();
24 | taskBarHandle = Taskbar.Handle; //WindowManagement.FindWindow("Shell_TrayWnd", null);
25 | windowIsShowed = IsActive;
26 |
27 | //var newTaskbarHandle = WindowManagement.FindWindowEx(taskBarHandle, IntPtr.Zero, "Windows.UI.Composition.DesktopWindowContentBridge", null);
28 | //var barHandle = WindowManagement.FindWindowEx(taskBarHandle, IntPtr.Zero, "ReBarWindow32", null);
29 | }
30 |
31 | private readonly Timer timer;
32 | private IntPtr windowHandle;
33 | private IntPtr taskBarHandle;
34 | private bool windowIsShowed;
35 |
36 | private void Time_Elapsed(object sender, ElapsedEventArgs e)
37 | {
38 | SetOnTopOfTaskBar();
39 | }
40 |
41 | private void Window_Loaded(object sender, RoutedEventArgs e)
42 | {
43 | windowHandle = new WindowInteropHelper(this).Handle;
44 |
45 | timer.Interval = 50;
46 | timer.Elapsed += Time_Elapsed;
47 | timer.Start();
48 |
49 | //SetOnTopOfTaskBar();
50 |
51 | //FocusMe.Focus(this);
52 | }
53 |
54 | private void SetOnTopOfTaskBar()
55 | {
56 | var test = Taskbar.CurrentBounds;
57 | var test2 = Taskbar.DisplayBounds;
58 | var test3 = Taskbar.Position;
59 | var test4 = Taskbar.AutoHide;
60 | var hided = WindowManagement.IsWindowVisible(taskBarHandle);
61 |
62 | if (hided)
63 | {
64 | if (!windowIsShowed)
65 | {
66 | Dispatcher.Invoke(() => Show());
67 | windowIsShowed = true;
68 | }
69 |
70 | //var newTaskbarHandle = WindowManagement.FindWindowEx(taskBarHandle, IntPtr.Zero, "Windows.UI.Composition.DesktopWindowContentBridge", null);
71 | //WindowManagement.SetParent(taskBarHandle, barHandle);
72 |
73 | WindowManagement.SetWindowPos(
74 | windowHandle, new IntPtr(-1),
75 | 0, 0, 0, 0,
76 | WindowManagement.SWP_NOMOVE | WindowManagement.SWP_NOSIZE | WindowManagement.SWP_SHOWWINDOW);
77 | }
78 | else
79 | {
80 | if (windowIsShowed)
81 | {
82 | Dispatcher.Invoke(() => Hide());
83 | windowIsShowed = false;
84 | }
85 | }
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/MediaControls.WPF/MediaControls.WPF.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {59A77689-AF93-43B4-8366-B8E86E74F8E9}
8 | WinExe
9 | MediaControls.WPF
10 | MediaControls.WPF
11 | v4.8
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 | true
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 | false
28 |
29 |
30 | AnyCPU
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 |
38 |
39 | Logo.ico
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | 4.0
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | MSBuild:Compile
61 | Designer
62 |
63 |
64 |
65 |
66 | MSBuild:Compile
67 | Designer
68 |
69 |
70 | App.xaml
71 | Code
72 |
73 |
74 | MainWindow.xaml
75 | Code
76 |
77 |
78 |
79 |
80 | Code
81 |
82 |
83 | True
84 | True
85 | Resources.resx
86 |
87 |
88 | True
89 | Settings.settings
90 | True
91 |
92 |
93 | ResXFileCodeGenerator
94 | Resources.Designer.cs
95 |
96 |
97 | SettingsSingleFileGenerator
98 | Settings.Designer.cs
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | {d31c5efd-96e2-4e28-a169-0e42a55ffce5}
107 | MediaControls
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/MediaControls.WPF/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // Les informations générales relatives à un assembly dépendent de
8 | // l'ensemble d'attributs suivant. Pour modifier les informations
9 | // associées à un assembly.
10 | [assembly: AssemblyTitle("TaskBar Media Controls")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("TaskBar Media Controls")]
15 | [assembly: AssemblyCopyright("Tom OLIVIER 2022")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
20 | // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
21 | // COM, affectez la valeur True à l'attribut ComVisible sur ce type.
22 | [assembly: ComVisible(false)]
23 |
24 | //Pour commencer à générer des applications localisables, définissez
25 | //CultureUtiliséePourCoder dans votre fichier .csproj
26 | //dans . Par exemple, si vous utilisez le français
27 | //dans vos fichiers sources, définissez à fr-FR. Puis, supprimez les marques de commentaire de
28 | //l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans
29 | //la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème
36 | //(utilisé si une ressource est introuvable dans la page,
37 | // ou dictionnaires de ressources de l'application)
38 | ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique
39 | //(utilisé si une ressource est introuvable dans la page,
40 | // dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème)
41 | )]
42 |
43 |
44 | // Les informations de version pour un assembly se composent des quatre valeurs suivantes :
45 | //
46 | // Version principale
47 | // Version secondaire
48 | // Numéro de build
49 | // Révision
50 | //
51 | // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
52 | // en utilisant '*', comme indiqué ci-dessous :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.3.0.0")]
55 | [assembly: AssemblyFileVersion("1.3.0.0")]
56 |
--------------------------------------------------------------------------------
/MediaControls.WPF/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Ce code a été généré par un outil.
4 | // Version du runtime :4.0.30319.42000
5 | //
6 | // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
7 | // le code est régénéré.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 |
12 | namespace MediaControls.WPF.Properties
13 | {
14 | ///
15 | /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
16 | ///
17 | // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
18 | // à l'aide d'un outil, tel que ResGen ou Visual Studio.
19 | // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
20 | // avec l'option /str ou régénérez votre projet VS.
21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
24 | internal class Resources
25 | {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources()
33 | {
34 | }
35 |
36 | ///
37 | /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
38 | ///
39 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
40 | internal static global::System.Resources.ResourceManager ResourceManager
41 | {
42 | get
43 | {
44 | if ((resourceMan == null))
45 | {
46 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediaControls.WPF.Properties.Resources", typeof(Resources).Assembly);
47 | resourceMan = temp;
48 | }
49 | return resourceMan;
50 | }
51 | }
52 |
53 | ///
54 | /// Remplace la propriété CurrentUICulture du thread actuel pour toutes
55 | /// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
56 | ///
57 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
58 | internal static global::System.Globalization.CultureInfo Culture
59 | {
60 | get
61 | {
62 | return resourceCulture;
63 | }
64 | set
65 | {
66 | resourceCulture = value;
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/MediaControls.WPF/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/MediaControls.WPF/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 |
12 | namespace MediaControls.WPF.Properties
13 | {
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
17 | {
18 |
19 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
20 |
21 | public static Settings Default
22 | {
23 | get
24 | {
25 | return defaultInstance;
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MediaControls.WPF/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MediaControls.WPF/WindowManagement.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace MediaControls.WPF
10 | {
11 | public static class WindowManagement
12 | {
13 | [StructLayout(LayoutKind.Sequential)]
14 | public struct RECT
15 | {
16 | public int Left; // x position of upper-left corner
17 | public int Top; // y position of upper-left corner
18 | public int Right; // x position of lower-right corner
19 | public int Bottom; // y position of lower-right corner
20 | }
21 |
22 | ///
23 | /// Retains the current size (ignores the cx and cy parameters).
24 | ///
25 | public const int SWP_NOSIZE = 0x0001;
26 | ///
27 | /// Retains the current position (ignores X and Y parameters).
28 | ///
29 | public const int SWP_NOMOVE = 0x0002;
30 | ///
31 | /// Retains the current Z order (ignores the hWndInsertAfter parameter).
32 | ///
33 | public const int SWP_NOZORDER = 0x0004;
34 | ///
35 | /// Displays the window.
36 | ///
37 | public const int SWP_SHOWWINDOW = 0x0040;
38 |
39 | [DllImport("user32.dll", SetLastError = true)]
40 | public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass,
41 | string lpszWindow);
42 |
43 | [DllImport("user32.dll", SetLastError = true)]
44 | public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
45 |
46 | ///
47 | /// Changes the size, position, and Z order of a child, pop-up, or top-level window.
48 | /// These windows are ordered according to their appearance on the screen.
49 | /// The topmost window receives the highest rank and is the first window in the Z order.
50 | ///
51 | /// A handle to the window.
52 | /// A handle to the window to precede the positioned window in the Z order.
53 | /// The new position of the left side of the window, in client coordinates.
54 | /// The new position of the top of the window, in client coordinates.
55 | /// The new width of the window, in pixels.
56 | /// The new height of the window, in pixels.
57 | /// The window sizing and positioning flags.
58 | ///
59 | [DllImport("user32.dll", SetLastError = true)]
60 | public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
61 |
62 | /// Changes the parent window of the specified child window.
63 | /// A handle to the child window.
64 | ///
65 | /// A handle to the new parent window.
66 | /// If this parameter is NULL, the desktop window becomes the new parent window.
67 | /// If this parameter is HWND_MESSAGE, the child window becomes a message-only window.
68 | ///
69 | ///
70 | /// If the function succeeds, the return value is a handle to the previous parent window.
71 | /// If the function fails, the return value is NULL.To get extended error information, call GetLastError.
72 | ///
73 | [DllImport("user32.dll", SetLastError = true)]
74 | public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
75 |
76 | [DllImport("user32.dll")]
77 | [return: MarshalAs(UnmanagedType.Bool)]
78 | public static extern bool IsWindowVisible(IntPtr hWnd);
79 |
80 | public static IntPtr GetWindowHandle() => Process.GetCurrentProcess().MainWindowHandle;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/MediaControls/DefinitionExtension.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace MediaControls
4 | {
5 | public static class DefinitionExtension
6 | {
7 | public static RowDefinition Clone(this RowDefinition rowDefinition) => new RowDefinition()
8 | {
9 | MaxHeight = rowDefinition.MaxHeight,
10 | Height = rowDefinition.Height,
11 | MinHeight = rowDefinition.MinHeight
12 | };
13 |
14 | public static ColumnDefinition Clone(this ColumnDefinition colDefinition) => new ColumnDefinition()
15 | {
16 | MaxWidth = colDefinition.MaxWidth,
17 | Width = colDefinition.Width,
18 | MinWidth = colDefinition.MinWidth
19 | };
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/MediaControls/GitHubHelper.cs:
--------------------------------------------------------------------------------
1 | using Octokit;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using System.Net.Http;
6 | using System.Reflection;
7 | using System.Threading.Tasks;
8 |
9 | public class GitHubHelper
10 | {
11 | #region Constructors
12 | public GitHubHelper(string repositoryOwner, string repositoryName)
13 | {
14 | RepositoryOwner = repositoryOwner;
15 | RepositoryName = repositoryName;
16 | }
17 | #endregion
18 |
19 | #region Variables
20 | private string RepositoryOwner;
21 | private string RepositoryName;
22 | private string LastTag;
23 | #endregion
24 |
25 | #region Methods
26 | ///
27 | /// Check if a new release is available on GitHub
28 | ///
29 | /// true a new release is available, else false
30 | public async Task CheckNewerVersion()
31 | {
32 | //Get all releases from GitHub
33 | //Source: https://octokitnet.readthedocs.io/en/latest/getting-started/
34 | try
35 | {
36 | GitHubClient client = new GitHubClient(new ProductHeaderValue(RepositoryName));
37 | IReadOnlyList releases = await client.Repository.Release.GetAll(RepositoryOwner, RepositoryName);
38 |
39 | foreach (var release in releases)
40 | {
41 | /*if (release.Prerelease)
42 | continue;*/
43 |
44 | //Setup the versions
45 | Version latestGitHubVersion;
46 | if (!Version.TryParse(release.TagName, out latestGitHubVersion) &&
47 | !Version.TryParse(release.Name, out latestGitHubVersion))
48 | return false;
49 | Version localVersion = Assembly.GetExecutingAssembly().GetName().Version;
50 |
51 | //Compare the Versions
52 | //Source: https://stackoverflow.com/questions/7568147/compare-version-numbers-without-using-split-function
53 | int versionComparison = localVersion.CompareTo(latestGitHubVersion);
54 |
55 | if (versionComparison < 0)
56 | {
57 | //The version on GitHub is more up to date than this local release.
58 | LastTag = release.TagName;
59 | return true;
60 | }
61 | else if (versionComparison > 0)
62 | {
63 | //This local version is greater than the release version on GitHub.
64 | return false;
65 | }
66 | else
67 | {
68 | //This local Version and the Version on GitHub are equal.
69 | return false;
70 | }
71 | }
72 | }
73 | catch (HttpRequestException) { }
74 |
75 | return false;
76 | }
77 |
78 | ///
79 | /// Open a link to the lastest release
80 | ///
81 | public void Update()
82 | {
83 | ProcessStartInfo psi = new ProcessStartInfo { UseShellExecute = true };
84 | psi.FileName = string.IsNullOrEmpty(LastTag) ?
85 | $"https://github.com/{RepositoryOwner}/{RepositoryName}/releases" :
86 | $"https://github.com/{RepositoryOwner}/{RepositoryName}/releases/tag/{LastTag}";
87 | Process.Start(psi);
88 | }
89 | #endregion
90 | }
--------------------------------------------------------------------------------
/MediaControls/IconUtilities.cs:
--------------------------------------------------------------------------------
1 | using Shell32;
2 | using System;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.IO;
6 | using System.Runtime.InteropServices;
7 | using System.Runtime.InteropServices.WindowsRuntime;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using System.Windows.Interop;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using Windows.Storage.Streams;
14 |
15 | namespace MediaControls
16 | {
17 | internal static class ImageUtilities
18 | {
19 | [DllImport("gdi32.dll", SetLastError = true)]
20 | private static extern bool DeleteObject(IntPtr hObject);
21 |
22 | public static ImageSource ToImageSource(this Icon icon)
23 | {
24 | Bitmap bitmap = icon.ToBitmap();
25 | return bitmap.ToImageSource();
26 | }
27 |
28 | public static ImageSource ToImageSource(this Bitmap bitmap)
29 | {
30 | IntPtr hBitmap = bitmap.GetHbitmap();
31 |
32 | ImageSource wpfBitmap = Imaging.CreateBitmapSourceFromHBitmap(
33 | hBitmap,
34 | IntPtr.Zero,
35 | Int32Rect.Empty,
36 | BitmapSizeOptions.FromEmptyOptions());
37 |
38 | if (!DeleteObject(hBitmap))
39 | {
40 | throw new Win32Exception();
41 | }
42 |
43 | return wpfBitmap;
44 | }
45 | public static async Task ToImageSource(this IRandomAccessStreamReference thumbnail)
46 | {
47 | if (thumbnail == null) return null;
48 |
49 | var read = await thumbnail.OpenReadAsync();
50 | var imageData = new byte[read.Size];
51 | var cover = new BitmapImage();
52 | var ms = new MemoryStream(imageData);
53 |
54 | await read.ReadAsync(imageData.AsBuffer(), Convert.ToUInt32(imageData.Length), InputStreamOptions.None);
55 |
56 | cover.BeginInit();
57 | cover.StreamSource = ms;
58 | cover.EndInit();
59 |
60 | return cover;
61 | }
62 |
63 | public static ImageSource ToImageSource(this Uri uri) => new BitmapImage(uri);
64 |
65 |
66 | public static Icon GetShortcutLinkIcon(string lnkPath)
67 | {
68 | var shl = new Shell(); // Move this to class scope
69 | lnkPath = Path.GetFullPath(lnkPath);
70 | var dir = shl.NameSpace(Path.GetDirectoryName(lnkPath));
71 | var itm = dir.Items().Item(Path.GetFileName(lnkPath));
72 | var lnk = (ShellLinkObject)itm.GetLink;
73 | lnk.GetIconLocation(out string strIcon);
74 |
75 | return Icon.ExtractAssociatedIcon(strIcon);
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/MediaControls/LightDarkModeGetter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Media;
7 | using Windows.UI.ViewManagement;
8 |
9 | namespace MediaControls
10 | {
11 | public static class LightDarkModeGetter
12 | {
13 | public static SolidColorBrush Foreground
14 | {
15 | get
16 | {
17 | UISettings settings = new UISettings();
18 | var foreground = settings.GetColorValue(UIColorType.Foreground);
19 | Color myforeColor = Color.FromArgb(foreground.A, foreground.R, foreground.G, foreground.B);
20 | return new SolidColorBrush(myforeColor);
21 | }
22 | }
23 |
24 | public static SolidColorBrush Background
25 | {
26 | get
27 | {
28 | UISettings settings = new UISettings();
29 | var background = settings.GetColorValue(UIColorType.Background);
30 |
31 | Color mybackColor = Color.FromArgb(background.A, background.R, background.G, background.B);
32 | return new SolidColorBrush(mybackColor);
33 | }
34 | }
35 |
36 | public static SolidColorBrush TranslucentForeground
37 | {
38 | get
39 | {
40 | UISettings settings = new UISettings();
41 | var foreground = settings.GetColorValue(UIColorType.Foreground);
42 | Color myforeColor = Color.FromArgb(40, foreground.R, foreground.G, foreground.B);
43 | return new SolidColorBrush(myforeColor);
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/MediaControls/Logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/MediaControls/Logo.ico
--------------------------------------------------------------------------------
/MediaControls/MediaControls.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D31C5EFD-96E2-4E28-A169-0E42A55FFCE5}
8 | Library
9 | Properties
10 | MediaControls
11 | MediaControls
12 | v4.8
13 | 512
14 | true
15 |
16 |
17 |
18 |
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 | Logo.ico
37 |
38 |
39 |
40 | ..\MediaControls.DeskBand\obj\Debug\Interop.Shell32.dll
41 | True
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | MediaSelectorWindow.xaml
73 |
74 |
75 | PlayersShorcutUserControl.xaml
76 |
77 |
78 | UserControl1.xaml
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | MSBuild:Compile
87 | Designer
88 |
89 |
90 | MSBuild:Compile
91 | Designer
92 |
93 |
94 | MSBuild:Compile
95 | Designer
96 |
97 |
98 |
99 |
100 | 10.0.22000.196
101 |
102 |
103 | 0.51.0
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/MediaControls/Modeles/Player.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows.Media;
3 | using Windows.Media.Control;
4 |
5 | namespace MediaControls.DeskBand
6 | {
7 | public class Player
8 | {
9 | ///
10 | /// Name of te media player
11 | ///
12 | public string Name { get; set; }
13 | ///
14 | /// Icon of the media player
15 | ///
16 | public ImageSource Icon { get; set; }
17 | ///
18 | /// Album title of the current media session
19 | ///
20 | public string Title { get; set; }
21 | ///
22 | /// Album cover of the current media session
23 | ///
24 | public ImageSource Cover { get; set; }
25 |
26 | public override bool Equals(object obj)
27 | {
28 | return obj is Player player &&
29 | Name == player.Name;
30 | }
31 |
32 | public override int GetHashCode()
33 | {
34 | return 539060726 + EqualityComparer.Default.GetHashCode(Name);
35 | }
36 |
37 | public override string ToString() => Name;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/MediaControls/Modeles/PlayerModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows.Media;
3 | using Windows.Media.Control;
4 |
5 | namespace MediaControls
6 | {
7 | public class PlayerModel
8 | {
9 | ///
10 | /// Name of te media player
11 | ///
12 | public string Name { get; set; }
13 | ///
14 | /// Icon of the media player
15 | ///
16 | public ImageSource Icon { get; set; }
17 | ///
18 | /// Album title of the current media session
19 | ///
20 | public string Title { get; set; }
21 | ///
22 | /// Album cover of the current media session
23 | ///
24 | public ImageSource Cover { get; set; }
25 | ///
26 | /// The current media session
27 | ///
28 | public GlobalSystemMediaTransportControlsSession Session { get; set; }
29 |
30 | public override bool Equals(object obj)
31 | {
32 | return obj is PlayerModel player &&
33 | Name == player.Name;
34 | }
35 |
36 | public override int GetHashCode()
37 | {
38 | return 539060726 + EqualityComparer.Default.GetHashCode(Name);
39 | }
40 |
41 | public override string ToString() => Name;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/MediaControls/Modeles/PlayerShortcut.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Media;
2 |
3 | namespace MediaControls
4 | {
5 | public class PlayerShortcut
6 | {
7 | #region Enumerators
8 | public enum ShortcutType
9 | {
10 | Win32,
11 | WinRT,
12 | Url,
13 | }
14 | #endregion
15 |
16 | #region Variables
17 | public string Link;
18 | public ShortcutType Type;
19 | #endregion
20 |
21 | #region Properties
22 | public string Name { get; set; }
23 | public ImageSource Icon { get; set; }
24 | #endregion
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MediaControls/PlayerUtilities.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Media.Imaging;
9 | using Windows.ApplicationModel;
10 | using Windows.Management.Deployment;
11 | using Windows.System;
12 |
13 | namespace MediaControls
14 | {
15 | class PlayerUtilities
16 | {
17 | private static PlayerShortcut[] KnownPlayersPackage = new PlayerShortcut[]
18 | {
19 | new PlayerShortcut() { Link = "SpotifyAB.SpotifyMusic_zpdnekdrzrea0" , Type = PlayerShortcut.ShortcutType.WinRT }, // Spotify Store
20 | new PlayerShortcut() { Link = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "Spotify.lnk") , Type = PlayerShortcut.ShortcutType.Win32 }, // Spotify Win32
21 | new PlayerShortcut() { Link = "SoundcloudLtd.SoundCloudforWindowsBeta_2xc63xn306dnw" , Type = PlayerShortcut.ShortcutType.WinRT }, // SoundCloud Store
22 | new PlayerShortcut() { Link = "Deezer.62021768415AF_q7m17pa7q8kj0" , Type = PlayerShortcut.ShortcutType.WinRT }, // Deezer Store
23 | new PlayerShortcut() { Link = "https://music.youtube.com/" , Type = PlayerShortcut.ShortcutType.Url, Name = "Youtube Music" }, // YouTube Music
24 | };
25 |
26 | public static List PlayersSupportVolControl = new List
27 | {
28 | "Spotify.exe",
29 | "vlc.exe"
30 | };
31 |
32 | public static IList GetPlayers()
33 | {
34 | PackageManager packageManager = new PackageManager();
35 | List players = new List();
36 |
37 | try
38 | {
39 | foreach (var player in KnownPlayersPackage)
40 | {
41 | switch (player.Type)
42 | {
43 | case PlayerShortcut.ShortcutType.Win32:
44 | if (File.Exists(player.Link))
45 | {
46 | player.Name = Path.GetFileNameWithoutExtension(player.Link);
47 | player.Icon = ImageUtilities.GetShortcutLinkIcon(player.Link).ToImageSource();
48 | players.Add(player);
49 | }
50 | break;
51 |
52 | case PlayerShortcut.ShortcutType.WinRT:
53 | var package = packageManager.FindPackagesForUser(string.Empty, player.Link).FirstOrDefault();
54 | if (package != null)
55 | {
56 | player.Name = package.DisplayName;
57 | player.Icon = package.Logo.ToImageSource();
58 | players.Add(player);
59 | }
60 | break;
61 |
62 | case PlayerShortcut.ShortcutType.Url:
63 | player.Icon = new BitmapImage(new Uri(Path.Combine(player.Link, "favicon.ico")));
64 | players.Add(player);
65 | break;
66 |
67 | }
68 | }
69 | }
70 | catch (Exception e)
71 | {
72 | MessageBox.Show(e.Message + Environment.NewLine + e.ToString(), "Player utilities error", MessageBoxButton.OK, MessageBoxImage.Error);
73 | }
74 |
75 | return players;
76 | }
77 |
78 | public static async Task StartPlayer(PlayerShortcut player)
79 | {
80 | PackageManager packageManager = new PackageManager();
81 |
82 | try
83 | {
84 | switch (player.Type)
85 | {
86 | case PlayerShortcut.ShortcutType.WinRT:
87 | var package = packageManager.FindPackagesForUser(string.Empty, player.Link).FirstOrDefault();
88 | if (package != null)
89 | {
90 | var apps = await package.GetAppListEntriesAsync();
91 | var firstApp = apps.FirstOrDefault();
92 | return await firstApp.LaunchAsync();
93 | }
94 | break;
95 |
96 | default:
97 | Process.Start(player.Link);
98 | break;
99 |
100 | }
101 | }
102 | catch (Exception e)
103 | {
104 | MessageBox.Show(e.Message + Environment.NewLine + e.ToString(), "Player utilities error", MessageBoxButton.OK, MessageBoxImage.Error);
105 | }
106 |
107 | return false;
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/MediaControls/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Les informations générales relatives à un assembly dépendent de
6 | // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
7 | // associées à un assembly.
8 | [assembly: AssemblyTitle("Media Controls")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TaskBar Media Controls")]
13 | [assembly: AssemblyCopyright("Tom OLVIVIER 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
18 | // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
19 | // COM, affectez la valeur true à l'attribut ComVisible sur ce type.
20 | [assembly: ComVisible(false)]
21 |
22 | // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
23 | [assembly: Guid("d31c5efd-96e2-4e28-a169-0e42a55ffce5")]
24 |
25 | // Les informations de version pour un assembly se composent des quatre valeurs suivantes :
26 | //
27 | // Version principale
28 | // Version secondaire
29 | // Numéro de build
30 | // Révision
31 | //
32 | // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
33 | // en utilisant '*', comme indiqué ci-dessous :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.3.0.0")]
36 | [assembly: AssemblyFileVersion("1.3.0.0")]
37 |
--------------------------------------------------------------------------------
/MediaControls/SegoeIcons.cs:
--------------------------------------------------------------------------------
1 | namespace MediaControls
2 | {
3 | public static class SegoeIcons
4 | {
5 | public static string Play = char.ConvertFromUtf32(0xE768);
6 | public static string Pause = char.ConvertFromUtf32(0xE769);
7 | public static string PlayPause = Play + Pause;
8 | public static string ChevronUp = char.ConvertFromUtf32(0xE70E);
9 | public static string ChevronDown = char.ConvertFromUtf32(0xE70D);
10 | public static string ChevronLeft = char.ConvertFromUtf32(0xE76B);
11 | public static string ChevronRight = char.ConvertFromUtf32(0xE76C);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MediaControls/SessionManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.Media.Control;
8 |
9 | namespace MediaControls
10 | {
11 | public class SessionManager
12 | {
13 | [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
14 | internal static extern int GetWindowText(IntPtr hWnd, [Out] StringBuilder lpString, int nMaxCount);
15 |
16 | #region Constructors
17 | private SessionManager(GlobalSystemMediaTransportControlsSessionManager manager)
18 | {
19 | Singleton = this;
20 | Manager = manager;
21 |
22 | manager.SessionsChanged += (sender, args) => CheckCurrentSession();
23 | manager.CurrentSessionChanged += (sender, args) => CheckCurrentSession();
24 | //manager.CurrentSessionChanged += (sender, args) => UpdateCurrentSession();
25 | }
26 | #endregion
27 |
28 | #region Variables
29 | ///
30 | /// Invoke when the current player has changed, can be null
31 | ///
32 | public event EventHandler CurrentSessionChanged;
33 | private GlobalSystemMediaTransportControlsSession currentSession;
34 | #endregion
35 |
36 | #region Properties
37 | public static SessionManager Singleton { get; private set; }
38 | public GlobalSystemMediaTransportControlsSessionManager Manager { get; private set; }
39 | public GlobalSystemMediaTransportControlsSession CurrentSession
40 | {
41 | get => currentSession;
42 | set
43 | {
44 | currentSession = value;
45 | if (CurrentSessionChanged != null)
46 | CurrentSessionChanged(this, currentSession);
47 | }
48 | }
49 | #endregion
50 |
51 | #region Methods
52 | public static async Task InitializeAsync()
53 | {
54 | GlobalSystemMediaTransportControlsSessionManager manager = null;
55 |
56 | while (manager == null)
57 | {
58 | try
59 | {
60 | manager = await GlobalSystemMediaTransportControlsSessionManager.RequestAsync();
61 | }
62 | catch
63 | {
64 | await Task.Delay(500);
65 | }
66 | }
67 |
68 | var sessionManager = new SessionManager(manager);
69 |
70 | sessionManager.UpdateCurrentSession();
71 |
72 | return sessionManager;
73 | }
74 |
75 | private async void CheckCurrentSession()
76 | {
77 | var sessions = Manager.GetSessions();
78 |
79 | // Check if the current player is still alive
80 | if (CurrentSession != null)
81 | {
82 | if (!sessions.ToList().Exists(x => x.SourceAppUserModelId == CurrentSession.SourceAppUserModelId))
83 | {
84 | // If the process still exist wait in case is loading the next content
85 | var processes = Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(CurrentSession.SourceAppUserModelId));
86 | if (processes.Length != 0)
87 | await Task.Delay(10000);
88 |
89 | UpdateCurrentSession();
90 | }
91 | }
92 | else
93 | {
94 | UpdateCurrentSession();
95 | }
96 | }
97 |
98 | private void UpdateCurrentSession()
99 | {
100 | CurrentSession = Manager.GetCurrentSession();
101 | /*
102 | // Get the process which is probably related to the session
103 | var prop = await CurrentSession.TryGetMediaPropertiesAsync();
104 | var processes = Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(CurrentSession.SourceAppUserModelId));
105 |
106 | foreach(var process in processes)
107 | {
108 | process.main
109 | if (process.ProcessName.Contains(prop.Title))
110 | {
111 | CurrentProcess = process;
112 | CurrentProcess.Exited += (s, e) => CurrentProcess = null;
113 | //break;
114 | }
115 | }
116 | // And don't update is the process is still active (Like a YouTube tab that is not closed or that it loads the next content)
117 | */
118 | }
119 | #endregion
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/MediaControls/TargetInput.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace MediaControls
10 | {
11 | class TargetInput
12 | {
13 | public const uint WM_KEYDOWN = 0x0100;
14 | public const uint WM_CHAR = 0x0102;
15 | public const uint WM_KEYUP = 0x0101;
16 | // https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
17 | public const long VK_RETURN = 0x0D;
18 | public const long VK_CONTROL = 0x11;
19 | public const long VK_UP = 0x26;
20 | public const long VK_DOWN = 0x28;
21 |
22 | [DllImport("user32.dll")]
23 | static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
24 |
25 | public static bool SendInput(IntPtr handle, uint action, long key) => PostMessage(handle, action, new IntPtr(key), new IntPtr(0));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/MediaControls/Taskbar.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Name: Taskbar.cs
3 | * Description: Class to get the taskbar's position, size and other properties.
4 | * Author: Franz Alex Gaisie-Essilfie
5 | * based on code from https://winsharp93.wordpress.com/2009/06/29/find-out-size-and-position-of-the-taskbar/
6 | *
7 | * Change Log:
8 | * Date | Description
9 | * -------------|--------------------------------------------------------------
10 | * 2017-05-16 | Initial design
11 | */
12 |
13 | using System.Drawing;
14 | using System.Runtime.InteropServices;
15 |
16 | namespace System.Windows.Forms
17 | {
18 | public enum TaskbarPosition
19 | {
20 | Unknown = -1,
21 | Left,
22 | Top,
23 | Right,
24 | Bottom,
25 | }
26 |
27 | public static class Taskbar
28 | {
29 | private enum ABS
30 | {
31 | AutoHide = 0x01,
32 | AlwaysOnTop = 0x02,
33 | }
34 |
35 | ////private enum ABE : uint
36 | private enum AppBarEdge : uint
37 | {
38 | Left = 0,
39 | Top = 1,
40 | Right = 2,
41 | Bottom = 3
42 | }
43 |
44 | ////private enum ABM : uint
45 | private enum AppBarMessage : uint
46 | {
47 | New = 0x00000000,
48 | Remove = 0x00000001,
49 | QueryPos = 0x00000002,
50 | SetPos = 0x00000003,
51 | GetState = 0x00000004,
52 | GetTaskbarPos = 0x00000005,
53 | Activate = 0x00000006,
54 | GetAutoHideBar = 0x00000007,
55 | SetAutoHideBar = 0x00000008,
56 | WindowPosChanged = 0x00000009,
57 | SetState = 0x0000000A,
58 | }
59 |
60 | private const string ClassName = "Shell_TrayWnd";
61 | private static APPBARDATA _appBarData;
62 |
63 | /// Static initializer of the class.
64 | static Taskbar()
65 | {
66 | _appBarData = new APPBARDATA
67 | {
68 | cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA)),
69 | hWnd = FindWindow(Taskbar.ClassName, null)
70 | };
71 | }
72 |
73 | ///
74 | /// Gets a value indicating whether the taskbar is always on top of other windows.
75 | ///
76 | /// true if the taskbar is always on top of other windows; otherwise, false.
77 | /// This property always returns false on Windows 7 and newer.
78 | public static bool AlwaysOnTop
79 | {
80 | get
81 | {
82 | int state = SHAppBarMessage(AppBarMessage.GetState, ref _appBarData).ToInt32();
83 | return ((ABS)state).HasFlag(ABS.AlwaysOnTop);
84 | }
85 | }
86 |
87 | ///
88 | /// Gets a value indicating whether the taskbar is automatically hidden when inactive.
89 | ///
90 | /// true if the taskbar is set to auto-hide is enabled; otherwise, false.
91 | public static bool AutoHide
92 | {
93 | get
94 | {
95 | int state = SHAppBarMessage(AppBarMessage.GetState, ref _appBarData).ToInt32();
96 | return ((ABS)state).HasFlag(ABS.AutoHide);
97 | }
98 | }
99 |
100 | /// Gets the current display bounds of the taskbar.
101 | public static Rectangle CurrentBounds
102 | {
103 | get
104 | {
105 | var rect = new RECT();
106 | if (GetWindowRect(Handle, ref rect))
107 | return Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom);
108 |
109 | return Rectangle.Empty;
110 | }
111 | }
112 |
113 | /// Gets the display bounds when the taskbar is fully visible.
114 | public static Rectangle DisplayBounds
115 | {
116 | get
117 | {
118 | if (RefreshBoundsAndPosition())
119 | return Rectangle.FromLTRB(_appBarData.rect.Left,
120 | _appBarData.rect.Top,
121 | _appBarData.rect.Right,
122 | _appBarData.rect.Bottom);
123 |
124 | return CurrentBounds;
125 | }
126 | }
127 |
128 | /// Gets the taskbar's window handle.
129 | public static IntPtr Handle
130 | {
131 | get { return _appBarData.hWnd; }
132 | }
133 |
134 | /// Gets the taskbar's position on the screen.
135 | public static TaskbarPosition Position
136 | {
137 | get
138 | {
139 | if (RefreshBoundsAndPosition())
140 | return (TaskbarPosition)_appBarData.uEdge;
141 |
142 | return TaskbarPosition.Unknown;
143 | }
144 | }
145 |
146 | /// Hides the taskbar.
147 | public static void Hide()
148 | {
149 | const int SW_HIDE = 0;
150 | ShowWindow(Handle, SW_HIDE);
151 | }
152 |
153 | /// Shows the taskbar.
154 | public static void Show()
155 | {
156 | const int SW_SHOW = 1;
157 | ShowWindow(Handle, SW_SHOW);
158 | }
159 |
160 | private static bool RefreshBoundsAndPosition()
161 | {
162 | //! SHAppBarMessage returns IntPtr.Zero **if it fails**
163 | return SHAppBarMessage(AppBarMessage.GetTaskbarPos, ref _appBarData) != IntPtr.Zero;
164 | }
165 |
166 | #region DllImports
167 |
168 | [DllImport("user32.dll", SetLastError = true)]
169 | private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
170 |
171 | [DllImport("user32.dll")]
172 | [return: MarshalAs(UnmanagedType.Bool)]
173 | private static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
174 |
175 | [DllImport("shell32.dll", SetLastError = true)]
176 | private static extern IntPtr SHAppBarMessage(AppBarMessage dwMessage, [In] ref APPBARDATA pData);
177 |
178 | [DllImport("user32.dll")]
179 | private static extern int ShowWindow(IntPtr hwnd, int command);
180 |
181 | #endregion DllImports
182 |
183 | [StructLayout(LayoutKind.Sequential)]
184 | private struct APPBARDATA
185 | {
186 | public uint cbSize;
187 | public IntPtr hWnd;
188 | public uint uCallbackMessage;
189 | public AppBarEdge uEdge;
190 | public RECT rect;
191 | public int lParam;
192 | }
193 |
194 | [StructLayout(LayoutKind.Sequential)]
195 | private struct RECT
196 | {
197 | public int Left;
198 | public int Top;
199 | public int Right;
200 | public int Bottom;
201 | }
202 | }
203 | }
--------------------------------------------------------------------------------
/MediaControls/View/MediaSelectorWindow.xaml:
--------------------------------------------------------------------------------
1 |
18 |
23 |
24 |
25 |
26 |
30 |
31 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/MediaControls/View/PlayersShorcutUserControl.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/MediaControls/View/PlayersShorcutUserControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace MediaControls
18 | {
19 | ///
20 | /// Logique d'interaction pour PlayersShorcutUserControl.xaml
21 | ///
22 | public partial class PlayersShorcutUserControl : UserControl
23 | {
24 | public ObservableCollection PlayerShortcutItems { get; set; }
25 | public StackPanel LstStkPanel { get; private set; }
26 |
27 | public PlayersShorcutUserControl()
28 | {
29 | try
30 | {
31 | var players = PlayerUtilities.GetPlayers();
32 | PlayerShortcutItems = new ObservableCollection(players);
33 |
34 | InitializeComponent();
35 | }
36 | catch (Exception e)
37 | {
38 | MessageBox.Show(e.Message + Environment.NewLine + e.ToString(), "Players shortcut error", MessageBoxButton.OK, MessageBoxImage.Error);
39 | }
40 | }
41 |
42 |
43 | private async void lst_Player_SelectionChanged(object sender, SelectionChangedEventArgs e)
44 | {
45 | if (lst_Player.SelectedItem is PlayerShortcut player)
46 | {
47 | await PlayerUtilities.StartPlayer(player);
48 | }
49 | lst_Player.SelectedIndex = -1;
50 | }
51 |
52 | private void lstStkPanel_Loaded(object sender, RoutedEventArgs e)
53 | {
54 | if (sender is StackPanel lstStkPanel)
55 | LstStkPanel = lstStkPanel;
56 | }
57 |
58 | /*public void HideActivePlayer()
59 | {
60 | if (SessionManager.Singleton == null || SessionManager.Singleton.Manager == null) return;
61 |
62 | var manager = SessionManager.Singleton.Manager;
63 |
64 | var session = SessionManager.Singleton.Manager.GetSessions()
65 | }*/
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DeskBand Media Controls
2 |
3 | Control your music from your taskbar.
4 |
5 |
6 |
7 |
8 |
9 | ## Features
10 | - Displays your music (Thumbnail, Title, Artist).
11 | - Control your music (Play, Pause, Previous, Next).
12 | - Support most music players (Spotify, SoundCloud, Deezer, Chrome/Chromium based - Edge - Opera, VLC, etc).
13 | - 1-click installation.
14 | - Support Windows Dark/Light Mode
15 | - Support TaskBar resize and orientation.
16 |
17 | ## Installation
18 | Only works on Windows 10 version 1809 (build 17763) or newer, not Windows 11 see [#8](https://github.com/Tom60chat/DeskBand-Media-Controls/issues/8)
19 |
20 | - [Download](https://github.com/Tom60chat/DeskBand-Media-Controls/releases/tag/release) the installer.
21 | - Click on the install button.
22 | - Done.
23 |
24 | ## Screenshots
25 | 
26 |
27 | 
28 |
29 | 
30 |
--------------------------------------------------------------------------------
/Sans titre.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Sans titre.png
--------------------------------------------------------------------------------
/Store/Intro.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Intro.gif
--------------------------------------------------------------------------------
/Store/Logo 256.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Logo 256.ico
--------------------------------------------------------------------------------
/Store/Logo 48.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Logo 48.ico
--------------------------------------------------------------------------------
/Store/Logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Logo.ico
--------------------------------------------------------------------------------
/Store/Logo.pfi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Logo.pfi
--------------------------------------------------------------------------------
/Store/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Logo.png
--------------------------------------------------------------------------------
/Store/Media control.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Media control.png
--------------------------------------------------------------------------------
/Store/Media controls Resize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Media controls Resize.png
--------------------------------------------------------------------------------
/Store/OneClick Install Resize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/OneClick Install Resize.png
--------------------------------------------------------------------------------
/Store/OneClick Install.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/OneClick Install.png
--------------------------------------------------------------------------------
/Store/Player selector resize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Player selector resize.png
--------------------------------------------------------------------------------
/Store/Player selector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Player selector.png
--------------------------------------------------------------------------------
/Store/Simple 2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Simple 2.png
--------------------------------------------------------------------------------
/Store/Simple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tom60chat/DeskBand-Media-Controls/25bbd4014af4a21294b19f45bb8dad68814da95d/Store/Simple.png
--------------------------------------------------------------------------------