Added start on windows startup feature IO-404
This commit is contained in:
@@ -63,6 +63,9 @@
|
||||
<setting name="RefreshToken" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="StartWithWindows" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</BodyshopPartner.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace BodyshopPartner
|
||||
|
||||
private void Application_Exit(object sender, ExitEventArgs e)
|
||||
{
|
||||
BodyshopPartner.Properties.Settings.Default.Save();
|
||||
Utils.QuickBooksInterop.DisconnectFromQuickBooks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,6 +240,15 @@ namespace BodyshopPartner.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Start with Windows.
|
||||
/// </summary>
|
||||
public static string Label_StartWithWindows {
|
||||
get {
|
||||
return ResourceManager.GetString("Label_StartWithWindows", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Status.
|
||||
/// </summary>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="Label_StartAllMonitors" xml:space="preserve">
|
||||
<value>Start _All Monitors</value>
|
||||
</data>
|
||||
<data name="Label_StartWithWindows" xml:space="preserve">
|
||||
<value>Start with Windows</value>
|
||||
</data>
|
||||
<data name="Label_Status" xml:space="preserve">
|
||||
<value>Status</value>
|
||||
</data>
|
||||
|
||||
12
BodyshopUploader/Properties/Settings.Designer.cs
generated
12
BodyshopUploader/Properties/Settings.Designer.cs
generated
@@ -128,5 +128,17 @@ namespace BodyshopPartner.Properties {
|
||||
this["RefreshToken"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool StartWithWindows {
|
||||
get {
|
||||
return ((bool)(this["StartWithWindows"]));
|
||||
}
|
||||
set {
|
||||
this["StartWithWindows"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,5 +29,8 @@
|
||||
<Setting Name="RefreshToken" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="StartWithWindows" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -192,7 +192,23 @@ namespace BodyshopPartner.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ICommand _startWithWindowsCommand;
|
||||
public ICommand StartWithWindowsCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_startWithWindowsCommand == null)
|
||||
{
|
||||
_startWithWindowsCommand = new RelayCommand(
|
||||
p => true,
|
||||
p =>
|
||||
{
|
||||
ToggleStartWithWindows((bool)(p));
|
||||
});
|
||||
}
|
||||
return _startWithWindowsCommand;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,24 @@ namespace BodyshopPartner.ViewModels
|
||||
App.Current.Shutdown();
|
||||
}
|
||||
|
||||
public async Task LoadBodyshopData()
|
||||
public void ToggleStartWithWindows(bool shouldStart)
|
||||
{
|
||||
|
||||
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
||||
if (shouldStart)
|
||||
{
|
||||
// Add the value in the registry so that the application runs at startup
|
||||
rkApp.SetValue(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, System.Reflection.Assembly.GetEntryAssembly().Location);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove the value from the registry so that the application doesn't start
|
||||
rkApp.DeleteValue(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task LoadBodyshopData()
|
||||
{
|
||||
var r = new GraphQLRequest
|
||||
{
|
||||
|
||||
@@ -128,6 +128,12 @@
|
||||
<CheckBox IsChecked="{Binding Source={x:Static p:Settings.Default}, Path=AutoStartMonitor}"
|
||||
Margin="8"
|
||||
Content="{x:Static p:Resources.Label_AutoStartMonitor}" />
|
||||
<CheckBox IsChecked="{Binding Source={x:Static p:Settings.Default}, Path=StartWithWindows}"
|
||||
Margin="8"
|
||||
Content="{x:Static p:Resources.Label_StartWithWindows}"
|
||||
Command="{Binding StartWithWindowsCommand}"
|
||||
CommandParameter="{Binding Source={x:Static p:Settings.Default}, Path=StartWithWindows}"/>
|
||||
|
||||
<Button Command="{Binding AddMonitoringPathCommand, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="8"
|
||||
ToolTip="{x:Static p:Resources.Label_AddMonitoringPath}"
|
||||
|
||||
Reference in New Issue
Block a user