Skip to content

Commit

Permalink
Merge branch 'releases/beta'
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Hofmann <[email protected]>
  • Loading branch information
hoffe86 committed Jul 13, 2021
2 parents eaf75db + f540127 commit 937010e
Show file tree
Hide file tree
Showing 119 changed files with 3,086 additions and 1,121 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/actions/app-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ inputs:
required: false
default: '${{github.workspace}}\build'

bundle_Platforms:
description: 'Defines the platforms for the app package.'
required: false
default: ' x86|x64|ARM'

GITHUB_TOKEN:
description: 'Token for Authentication with GitHub'
required: true

SONAR_TOKEN:
description: 'Token for Authentication with Sonar Cloud'
required: true

runs:
using: "composite"
steps:
Expand All @@ -27,9 +40,16 @@ runs:
./Set-Version.ps1 -SourceDirectory '${{github.workspace}}\src\' -Major $major -Minor $minor -Build $build -Revision 0 -SetVersion
- name: Restore nuget packages
shell: cmd
run: nuget restore ${{github.workspace}}\src\OpenHAB.Windows.sln
shell: pwsh
run: |
Write-Host "==== Restore Nuget packages ====" -ForegroundColor Green
nuget restore ${{github.workspace}}\src\OpenHAB.Windows.sln
- name: Build OpenHab Windows App
shell: cmd
run: msbuild.exe ${{github.workspace}}\src\OpenHAB.Windows.sln /p:AppxBundlePlatforms="x86|x64|ARM" /p:AppxPackageDir="${{inputs.output_directory}}" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /p:configuration="${{inputs.build_configuration}}"
shell: pwsh
env:
GITHUB_TOKEN: ${{inputs.GITHUB_TOKEN}}
SONAR_TOKEN: ${{inputs.SONAR_TOKEN}}
run: |
Write-Host "==== Build app package ====" -ForegroundColor Green
msbuild.exe ${{github.workspace}}\src\OpenHAB.Windows.sln /p:Platform="x86" /p:AppxBundlePlatforms="${{inputs. bundle_Platforms}}" /p:AppxPackageDir="${{inputs.output_directory}}" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /p:configuration="${{inputs.build_configuration}}" /t:rebuild
57 changes: 54 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: 'CI Build'
env:
BUILD_NUMBER: '1970.1.1'
BuildDirectory: '${{github.workspace}}\build'
ACTIONS_RUNNER_DEBUG: true

on: [push, pull_request]

Expand All @@ -26,9 +27,59 @@ jobs:
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11

- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{runner.os}}-sonar
restore-keys: ${{runner.os}}-sonar

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{runner.os}}-sonar-scanner-msbuild
restore-keys: ${{runner.os}}-sonar-scanner-msbuild

- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: pwsh
run: |
$directory = New-Item -Path .\.sonar\scanner -ItemType Directory
# dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
$file = Join-Path $directory.FullName "sonar-scanner.zip"
Invoke-WebRequest -Uri "https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/5.2.1.31210/sonar-scanner-msbuild-5.2.1.31210-net46.zip" -OutFile $file
Expand-Archive -LiteralPath $file -DestinationPath "$($directory.FullName)"
- name: Begin SonarQube analyze
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
SONAR_TOKEN: ${{secrets.SONAR_TOKE }}
shell: pwsh
run: |
.\.sonar\scanner\SonarScanner.MSBuild.exe begin /k:"openhab_openhab-windows" /o:"openhab" /d:sonar.login="${{secrets.SONAR_TOKEN}}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.verbose="true"
- name: Build App
id: create_app_package
uses: ./src/.github/workflows/actions/app-build
uses: .\src\.github\workflows\actions\app-build
with:
build_configuration: 'release'
output_directory: '${{env.BuildDirectory}}'
build_configuration: 'debug'
output_directory: '${{env.BuildDirectory}}'
bundle_Platforms: 'x86'
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}

- name: End SonarQube analyze
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
shell: pwsh
run: |
.\.sonar\scanner\SonarScanner.MSBuild.exe end /d:sonar.login="${{secrets.SONAR_TOKEN}}"
10 changes: 8 additions & 2 deletions OpenHAB.Windows.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29409.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenHAB.Windows", "OpenHAB.Windows\OpenHAB.Windows.csproj", "{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "openHAB.Windows", "OpenHAB.Windows\openHAB.Windows.csproj", "{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libs", "Libs", "{6D9E45E3-F3C1-4A9D-A62D-72DDBA11C31B}"
ProjectSection(SolutionItems) = preProject
Libs\MJPEGDecoderWinRTLib.dll = Libs\MJPEGDecoderWinRTLib.dll
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenHAB.Core", "OpenHAB.Core\OpenHAB.Core.csproj", "{2A8FD10E-4EE5-4E25-B47C-2296E071F482}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "openHAB.Core", "OpenHAB.Core\openHAB.Core.csproj", "{2A8FD10E-4EE5-4E25-B47C-2296E071F482}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A5CFF8A8-CFA1-4C8F-A197-4F095FAC2B76}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -19,14 +19,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Debug|Any CPU.ActiveCfg = Debug|x86
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Debug|ARM.ActiveCfg = Debug|ARM
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Debug|ARM.Build.0 = Debug|ARM
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Debug|ARM.Deploy.0 = Debug|ARM
Expand All @@ -36,6 +39,7 @@ Global
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Debug|x86.ActiveCfg = Debug|x86
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Debug|x86.Build.0 = Debug|x86
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Debug|x86.Deploy.0 = Debug|x86
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Release|Any CPU.ActiveCfg = Release|x86
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Release|ARM.ActiveCfg = Release|ARM
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Release|ARM.Build.0 = Release|ARM
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Release|ARM.Deploy.0 = Release|ARM
Expand All @@ -45,12 +49,14 @@ Global
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Release|x86.ActiveCfg = Release|x86
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Release|x86.Build.0 = Release|x86
{D65E41CE-1AE7-403A-B178-D69E8DAFB08B}.Release|x86.Deploy.0 = Release|x86
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Debug|Any CPU.ActiveCfg = Debug|x86
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Debug|ARM.ActiveCfg = Debug|ARM
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Debug|ARM.Build.0 = Debug|ARM
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Debug|x64.ActiveCfg = Debug|x64
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Debug|x64.Build.0 = Debug|x64
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Debug|x86.ActiveCfg = Debug|x86
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Debug|x86.Build.0 = Debug|x86
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Release|Any CPU.ActiveCfg = Release|x86
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Release|ARM.ActiveCfg = Release|ARM
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Release|ARM.Build.0 = Release|ARM
{2A8FD10E-4EE5-4E25-B47C-2296E071F482}.Release|x64.ActiveCfg = Release|x64
Expand Down
4 changes: 3 additions & 1 deletion OpenHAB.Windows/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

<converters:StateToBoolConverter x:Key="StateToBoolConverter" />
<converters:IconToPathConverter x:Key="IconToPathConverter" />
<converters:StringToColorBrushConverter x:Key="StringToColorConverter"/>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

<DataTemplate x:Key="FrameTemplate">
<controls:FrameWidget Widget="{Binding Mode=OneWay}" />
Expand All @@ -35,7 +37,7 @@
</DataTemplate>

<DataTemplate x:Key="SwitchTemplate">
<controls:SwitchWidget Widget="{Binding Mode=OneWay}" />
<controls:ToggleWidget Widget="{Binding Mode=OneWay}" />
</DataTemplate>

<DataTemplate x:Key="MapViewTemplate">
Expand Down
23 changes: 22 additions & 1 deletion OpenHAB.Windows/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
using OpenHAB.Core.Contracts.Services;
using OpenHAB.Core.Model;
using OpenHAB.Core.Services;
using OpenHAB.Windows.Services;
using OpenHAB.Windows.View;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation.Metadata;
using Windows.System;
using Windows.UI;
using Windows.UI.Core;
using Windows.UI.ViewManagement;
Expand Down Expand Up @@ -38,6 +42,9 @@ public App()

Suspending += OnSuspending;
UnhandledException += App_UnhandledException;

INotificationManager notificationManager = (INotificationManager)DIService.Instance.Services.GetService(typeof(INotificationManager));
notificationManager.ResetBadgeCount();
}

/// <summary>
Expand Down Expand Up @@ -85,6 +92,20 @@ protected override async void OnLaunched(LaunchActivatedEventArgs e)

// Ensure the current window is active
Window.Current.Activate();

Settings settings = _settingsService.Load();

if (settings.StartAppMinimized.HasValue && settings.StartAppMinimized.Value)
{
IList<AppDiagnosticInfo> infos = await AppDiagnosticInfo.RequestInfoForAppAsync();
AppDiagnosticInfo appDiagnosticInfo = infos.FirstOrDefault();

if (appDiagnosticInfo != null)
{
IList<AppResourceGroupInfo> resourceInfos = appDiagnosticInfo.GetResourceGroups();
await resourceInfos[0].StartSuspendAsync();
}
}
}
}

Expand Down Expand Up @@ -122,7 +143,7 @@ private void OnSuspending(object sender, SuspendingEventArgs e)

/// <summary>Handles the UnhandledException event of the App control.</summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="Windows.UI.Xaml.UnhandledExceptionEventArgs"/> instance containing the event data.</param>
/// <param name="e">The <see cref="global::Windows.UI.Xaml.UnhandledExceptionEventArgs"/> instance containing the event data.</param>
private void App_UnhandledException(object sender, global::Windows.UI.Xaml.UnhandledExceptionEventArgs e)
{
_logger.LogCritical(e.Exception, "UnhandledException occurred");
Expand Down
70 changes: 36 additions & 34 deletions OpenHAB.Windows/Controls/ChartWidget.xaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
<local:WidgetBase x:Class="OpenHAB.Windows.Controls.ChartWidget"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:OpenHAB.Windows.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:OpenHAB.Windows.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Visibility="{x:Bind Widget.Visibility, Converter={StaticResource BooleanToVisibilityConverter}}">

<Grid Style="{StaticResource Widget}"
Tapped="ImageWidget_OnTapped">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<local:ImageLabel Grid.Column="0"
IconPath="{x:Bind Widget, Mode=OneWay, Converter={StaticResource IconToPathConverter}}"
LabelText="{x:Bind Widget.Label, Mode=OneWay}" />
<Grid Style="{StaticResource Widget}"
Tapped="ImageWidget_OnTapped">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<local:ImageLabel Grid.Column="0"
IconPath="{x:Bind Widget, Mode=OneWay, Converter={StaticResource IconToPathConverter}}"
LabelText="{x:Bind Widget.Label, Mode=OneWay}"
LabelForeground="{x:Bind Widget.LabelColor,Converter={StaticResource StringToColorConverter}, Mode=OneWay}"/>

<ContentDialog x:Name="PopupDialog"
Title="{x:Bind Widget.Label}"
Grid.Column="0"
Grid.ColumnSpan="2"
Background="{StaticResource OpenHABLightColor}"
IsPrimaryButtonEnabled="True"
PrimaryButtonText="Close">
<Image x:Name="FullImage"
HorizontalAlignment="Right"
Source="http://demo.openhab.org:8080/chart?groups=Weather_Chart&amp;period=w"
Stretch="Uniform" />
</ContentDialog>
<ContentDialog x:Name="PopupDialog"
Title="{x:Bind Widget.Label}"
Grid.Column="0"
Grid.ColumnSpan="2"
Background="{StaticResource OpenHABLightColor}"
IsPrimaryButtonEnabled="True"
PrimaryButtonText="Close">
<Image x:Name="FullImage"
HorizontalAlignment="Right"
Source="http://demo.openhab.org:8080/chart?groups=Weather_Chart&amp;period=w"
Stretch="Uniform" />
</ContentDialog>

<Image x:Name="ThumbImage"
Grid.Column="1"
Margin="8"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Stretch="UniformToFill" />
</Grid>
<Image x:Name="ThumbImage"
Grid.Column="1"
Margin="8"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Stretch="UniformToFill" />
</Grid>
</local:WidgetBase>
Loading

0 comments on commit 937010e

Please sign in to comment.