Skip to content

Commit

Permalink
Add show in taskbar option.
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikgolda committed Apr 8, 2019
1 parent 4ef22db commit f378d5c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Soloplan.WhatsON.GUI/Config/MainConfigPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding OpenOnSystemStart}" />
<Label>Run when Windows starts</Label>
</StackPanel>
<StackPanel Orientation="Horizontal">
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding ShowInTaskbar}"/>
<Label>Show in Taskbar</Label>
</StackPanel>
</StackPanel>
</Page>
20 changes: 20 additions & 0 deletions src/Soloplan.WhatsON.GUI/Config/ViewModel/ConfigViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public class ConfigViewModel : ViewModelBase
/// </summary>
private bool? openOnSystemStart;

/// <summary>
/// Backing field for <see cref="ShowInTaskbar"/>.
/// </summary>
private bool showInTaskbar;

/// <summary>
/// Occurs when configuration was applied.
/// </summary>
Expand Down Expand Up @@ -66,6 +71,19 @@ public bool DarkThemeEnabled
}
}

/// <summary>
/// Gets or sets a value indicating whether window should be shown in taskbar.
/// </summary>
public bool ShowInTaskbar
{
get => this.showInTaskbar;
set
{
this.showInTaskbar = value;
this.OnPropertyChanged();
}
}

/// <summary>
/// Gets or sets a value indicating whether application should start with system.
/// </summary>
Expand Down Expand Up @@ -161,6 +179,7 @@ public void Load(ApplicationConfiguration configurationSource)
}

this.DarkThemeEnabled = configurationSource.DarkThemeEnabled;
this.ShowInTaskbar = configurationSource.ShowInTaskbar;
this.openOnSystemStart = null; // as this option is not really saved, we reset the private variable value.
this.OnPropertyChanged(nameof(this.OpenOnSystemStart));

Expand Down Expand Up @@ -225,6 +244,7 @@ public void ApplyToSourceAndSave()
}

this.Configuration.DarkThemeEnabled = this.DarkThemeEnabled;
this.Configuration.ShowInTaskbar = this.ShowInTaskbar;
this.ApplyRunWithWindowsOption();
SerializationHelper.SaveConfiguration(this.Configuration);
}
Expand Down
3 changes: 3 additions & 0 deletions src/Soloplan.WhatsON.GUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public MainWindow(ObservationScheduler scheduler, ApplicationConfiguration confi
this.scheduler = scheduler;
this.config = configuration;
this.mainTreeView.Init(this.scheduler, this.config, initialSubjectState);
this.ShowInTaskbar = this.config.ShowInTaskbar;
}

public MainWindowSettigns GetVisualSettigns()
Expand Down Expand Up @@ -99,6 +100,8 @@ private void ApplyConfiguration()
{
this.scheduler.Start();
}

this.ShowInTaskbar = this.config.ShowInTaskbar;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public class ApplicationConfiguration
/// </summary>
public bool DarkThemeEnabled { get; set; }

/// <summary>
/// Gets or sets a value indicating whether icon on taskbar should be shown.
/// </summary>
public bool ShowInTaskbar { get; set; }

/// <summary>
/// Gets the subjects configuration.
/// </summary>
Expand Down

0 comments on commit f378d5c

Please sign in to comment.