Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Start adding stuff for tray support
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions committed Dec 25, 2021
1 parent 7867078 commit ee00d4c
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 2 deletions.
11 changes: 11 additions & 0 deletions DrasticMaui.Contracts/DrasticMaui.Contracts.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="..\stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>
16 changes: 16 additions & 0 deletions DrasticMaui.Contracts/ITrayService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// <copyright file="ITrayService.cs" company="Drastic Actions">
// Copyright (c) Drastic Actions. All rights reserved.
// </copyright>

using System;

namespace DrasticMaui
{
/// <summary>
/// Tray Service.
/// </summary>
public interface ITrayService
{
void Initialize();
}
}
24 changes: 24 additions & 0 deletions DrasticMaui.Mac/DrasticMaui.Mac.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-macos</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="..\stylecop.json" Link="stylecop.json" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DrasticMaui.Contracts\DrasticMaui.Contracts.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<EnableCodeSigning>false</EnableCodeSigning>
<UseSGen>false</UseSGen>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<EnableCodeSigning>false</EnableCodeSigning>
<UseSGen>false</UseSGen>
</PropertyGroup>
</Project>
22 changes: 22 additions & 0 deletions DrasticMaui.Mac/WindowCoordinator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// <copyright file="WindowCoordinator.cs" company="Drastic Actions">
// Copyright (c) Drastic Actions. All rights reserved.
// </copyright>

using System;
using AppKit;

namespace DrasticMaui.Mac
{
public class WindowCoordinator : ITrayService
{
public void Initialize()
{
NSStatusBar statusBar = NSStatusBar.SystemStatusBar;
var statusBarItem = statusBar.CreateStatusItem(NSStatusItemLength.Variable);
if (statusBarItem is null)
{
throw new NullReferenceException(nameof(statusBarItem));
}
}
}
}
2 changes: 1 addition & 1 deletion DrasticMaui.Sample/DrasticMaui.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<RootNamespace>DrasticMaui.Sample</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
Expand Down
1 change: 1 addition & 0 deletions DrasticMaui.Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static class MauiProgram
/// <returns>MauiApp.</returns>
public static MauiApp CreateMauiApp()
{
var trayService = new DrasticMaui.Tray.TrayService();
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
Expand Down
12 changes: 12 additions & 0 deletions DrasticMaui.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrasticMaui.Sample", "Drast
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrasticMaui", "DrasticMaui\DrasticMaui.csproj", "{ABBB7C06-7C93-4091-81FB-FAB580FBE76D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrasticMaui.Mac", "DrasticMaui.Mac\DrasticMaui.Mac.csproj", "{E1076FC6-242D-437D-9F41-E0501C0335F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrasticMaui.Contracts", "DrasticMaui.Contracts\DrasticMaui.Contracts.csproj", "{983E759D-4003-462B-9024-553139F49C65}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -22,6 +26,14 @@ Global
{ABBB7C06-7C93-4091-81FB-FAB580FBE76D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABBB7C06-7C93-4091-81FB-FAB580FBE76D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABBB7C06-7C93-4091-81FB-FAB580FBE76D}.Release|Any CPU.Build.0 = Release|Any CPU
{E1076FC6-242D-437D-9F41-E0501C0335F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1076FC6-242D-437D-9F41-E0501C0335F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1076FC6-242D-437D-9F41-E0501C0335F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1076FC6-242D-437D-9F41-E0501C0335F0}.Release|Any CPU.Build.0 = Release|Any CPU
{983E759D-4003-462B-9024-553139F49C65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{983E759D-4003-462B-9024-553139F49C65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{983E759D-4003-462B-9024-553139F49C65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{983E759D-4003-462B-9024-553139F49C65}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
11 changes: 10 additions & 1 deletion DrasticMaui/DrasticMaui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@
<AdditionalFiles Include="..\stylecop.json" Link="stylecop.json" />
</ItemGroup>

<ItemGroup>
<None Remove="Tray\" />
</ItemGroup>
<ItemGroup>
<None Include="DrasticMauiWindow.cs" />
</ItemGroup>


<ItemGroup>
<Folder Include="Tray\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DrasticMaui.Contracts\DrasticMaui.Contracts.csproj" />
</ItemGroup>
</Project>
19 changes: 19 additions & 0 deletions DrasticMaui/Tray/TrayService.MacCatalyst.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// <copyright file="TrayService.MacCatalyst.cs" company="Drastic Actions">
// Copyright (c) Drastic Actions. All rights reserved.
// </copyright>

using System;

namespace DrasticMaui.Tray
{
public partial class TrayService
{
public TrayService()
{
}

public void SetupTrayIcon()
{
}
}
}
16 changes: 16 additions & 0 deletions DrasticMaui/Tray/TrayService.Windows.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// <copyright file="TrayService.Windows.cs" company="Drastic Actions">
// Copyright (c) Drastic Actions. All rights reserved.
// </copyright>

using System;
namespace DrasticMaui.Tray
{
public partial class TrayService
{
public void SetupTrayIcon()
{

}
}
}

18 changes: 18 additions & 0 deletions DrasticMaui/Tray/TrayService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// <copyright file="TrayService.cs" company="Drastic Actions">
// Copyright (c) Drastic Actions. All rights reserved.
// </copyright>

using System;
namespace DrasticMaui.Tray
{
public partial class TrayService
{
#if ANDROID || IOS
public void SetupTrayIcon()
{

}
#endif
}
}

6 changes: 6 additions & 0 deletions MultiTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
<Compile Remove="**\Mac\**\*.cs" />
<None Include="**\Mac\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true">
<Compile Remove="**\*.MacCatalyst.cs" />
<None Include="**\*.MacCatalyst.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\MacCatalyst\**\*.cs" />
<None Include="**\MacCatalyst\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true">
<Compile Remove="**\*.MaciOS.cs" />
<None Include="**\*.MaciOS.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
Expand Down

0 comments on commit ee00d4c

Please sign in to comment.