Skip to content

Commit

Permalink
fix potential error, add error dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Maassoft committed Nov 22, 2020
1 parent da5b760 commit d00595f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ColorControl/ColorControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<ProductName>ColorControl</ProductName>
<PublisherName>Maassoft</PublisherName>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.3.0.0</ApplicationVersion>
<ApplicationVersion>1.3.1.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand Down
2 changes: 1 addition & 1 deletion ColorControl/LgService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void SetDevicesTask(Task<List<PnpDev>> task)
Devices = task.Result;
if (Devices?.Count > 0)
{
var preferredDevice = Devices.FirstOrDefault(x => x.MacAddress.Equals(Config.PreferredMacAddress)) ?? Devices[0];
var preferredDevice = Devices.FirstOrDefault(x => x.MacAddress != null && x.MacAddress.Equals(Config.PreferredMacAddress)) ?? Devices[0];

SelectedDevice = preferredDevice;
}
Expand Down
2 changes: 1 addition & 1 deletion ColorControl/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public MainForm(StartUpParams startUpParams)

if (_lgService != null)
{
SystemEvents.SessionEnded += new SessionEndedEventHandler(SessionEnded);
//SystemEvents.SessionEnded += new SessionEndedEventHandler(SessionEnded);
SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(PowerModeChanged);
}

Expand Down
13 changes: 10 additions & 3 deletions ColorControl/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ static void Main(string[] args)
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm(startUpParams));
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm(startUpParams));
}
catch (Exception ex)
{
MessageBox.Show("Error while initializing application: " + ex.ToLogString(Environment.StackTrace), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
finally
Expand Down
4 changes: 2 additions & 2 deletions ColorControl/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyVersion("1.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]

0 comments on commit d00595f

Please sign in to comment.