Skip to content

Commit

Permalink
Fix start with windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rdec committed Mar 20, 2020
1 parent dfee307 commit 73f488e
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/Lurker.UI/ViewModels/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ public ShellViewModel(SimpleContainer container, SettingsService settingsService

if (settingsService.FirstLaunch)
{
if (this.StartWithWindows)
{
// RefreshShortcut
File.Delete(this.ShortcutFilePath);
this.CreateLink();
}

settingsService.FirstLaunch = false;
this._showUpdateSuccess = true;
settingsService.Save();
Expand Down Expand Up @@ -221,11 +228,7 @@ public void CreateShortCut()
}
else
{
var link = (IShellLink)new ShellLink();
link.SetDescription("PoeLurker");
link.SetPath(System.Reflection.Assembly.GetExecutingAssembly().Location);
var file = (IPersistFile)link;
file.Save(this.ShortcutFilePath, false);
this.CreateLink();
}

this.StartWithWindows = !this.StartWithWindows;
Expand Down Expand Up @@ -267,6 +270,19 @@ public void ShowSettings()
this.ActivateItem(this._settingsViewModel);
}

/// <summary>
/// Creates the link.
/// </summary>
private void CreateLink()
{
var link = (IShellLink)new ShellLink();
link.SetDescription("PoeLurker");
link.SetPath(System.Reflection.Assembly.GetExecutingAssembly().Location);
var file = (IPersistFile)link;
file.Save(this.ShortcutFilePath, false);
}


/// <summary>
/// Registers the instances.
/// </summary>
Expand Down

0 comments on commit 73f488e

Please sign in to comment.