Skip to content

Commit 8eba27a

Browse files
authored
Merge pull request #505 from emoacht/develop
Develop
2 parents 61336c0 + 26fcbf4 commit 8eba27a

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

Source/Installer/Product.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
<Product Id="*" Name="Monitorian" Manufacturer="emoacht" Version="4.4.9"
3+
<Product Id="*" Name="Monitorian" Manufacturer="emoacht" Version="4.4.11"
44
Language="1033" Codepage="1252" UpgradeCode="{81A4D148-75D3-462E-938D-8C208FB48E3C}">
55
<Package Id="*" InstallerVersion="500" Compressed="yes"
66
InstallScope="perMachine" InstallPrivileges="elevated"

Source/Monitorian.Core/Models/Watcher/BrightnessConnector.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private enum Result
3636
None = 0,
3737

3838
/// <summary>
39-
/// Rrequest is OK.
39+
/// Request is OK.
4040
/// </summary>
4141
OK,
4242

@@ -85,7 +85,7 @@ private static bool TryFindReport(Windows.Foundation.Collections.ValueSet messag
8585
/// <summary>
8686
/// Interval in seconds
8787
/// </summary>
88-
public float Interval { get; set; } = 0.1F;
88+
public float Interval { get; set; } = 0.5F;
8989

9090
#endregion
9191

@@ -131,13 +131,13 @@ public BrightnessConnector()
131131
/// <param name="onBrightnessChanged">Action to be invoked when brightness changed</param>
132132
/// <param name="onError">Action to be invoked when error occurred</param>
133133
/// <param name="onContinue">Action to be invoked when continuation of AppService is determined</param>
134-
public virtual async Task InitiateAsync(Action<int> onBrightnessChanged, Action<string> onError, Func<bool> onContinue)
134+
public virtual Task InitiateAsync(Action<int> onBrightnessChanged, Action<string> onError, Func<bool> onContinue)
135135
{
136136
this._onBrightnessChanged = onBrightnessChanged ?? throw new ArgumentNullException(nameof(onBrightnessChanged));
137137
this._onError = onError ?? throw new ArgumentNullException(nameof(onError));
138138
this._onContinue = onContinue ?? throw new ArgumentNullException(nameof(onContinue));
139139

140-
await ConnectAsync(true);
140+
return ConnectAsync(true);
141141
}
142142

143143
private AppService.AppServiceConnection _appServiceConnection;
@@ -169,11 +169,14 @@ public virtual async Task<bool> OpenAsync()
169169
_appServiceConnection.ServiceClosed += OnAppServiceConnectionServiceClosed;
170170
return true;
171171

172-
default:
172+
case not AppService.AppServiceConnectionStatus.AppUnavailable:
173+
// AppServiceConnectionStatus.AppUnavailable means temporarily unavailable and
174+
// thus it is excluded because AppServiceConnection can be available later.
173175
// https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.appservice.appserviceconnectionstatus
174-
if (status is not AppService.AppServiceConnectionStatus.AppUnavailable)
175-
_isAvailable = false;
176+
_isAvailable = false;
177+
goto default;
176178

179+
default:
177180
_onError?.Invoke($"Failed: {status}");
178181
return false;
179182
}
@@ -235,17 +238,13 @@ private void OnAppServiceConnectionRequestReceived(AppService.AppServiceConnecti
235238

236239
private async void OnAppServiceConnectionServiceClosed(AppService.AppServiceConnection sender, AppService.AppServiceClosedEventArgs args)
237240
{
238-
// AppService closes when around 25 seconds has elapsed after it opened.
241+
// AppService closes after 25 seconds has elapsed. It is explained as that AppService
242+
// is executed as background task.
239243
Debug.WriteLine("ServiceClosed");
240244
ReleaseAppServiceConnection();
241245

242-
if (_isMultiple)
243-
{
244-
await Task.Delay(TimeSpan.FromSeconds(Interval));
245-
246-
if (_onContinue.Invoke())
247-
await ConnectAsync(true);
248-
}
246+
if (_onContinue.Invoke())
247+
await ConnectAsync(_isMultiple);
249248
}
250249

251250
private void ReleaseAppServiceConnection()

Source/Monitorian.Core/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("4.4.9.0")]
37-
[assembly: AssemblyFileVersion("4.4.9.0")]
36+
[assembly: AssemblyVersion("4.4.11.0")]
37+
[assembly: AssemblyFileVersion("4.4.11.0")]
3838
[assembly: NeutralResourcesLanguage("en-US")]
3939

4040
// For unit test

Source/Monitorian/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("4.4.9.0")]
55-
[assembly: AssemblyFileVersion("4.4.9.0")]
54+
[assembly: AssemblyVersion("4.4.11.0")]
55+
[assembly: AssemblyFileVersion("4.4.11.0")]
5656
[assembly: Guid("a4cc5362-9b08-465b-ad64-5cfabc72a4c7")]
5757
[assembly: NeutralResourcesLanguage("en-US")]

0 commit comments

Comments
 (0)