Skip to content

Commit

Permalink
Merge pull request #49 from skowront/issue36
Browse files Browse the repository at this point in the history
Resolved issue #36
  • Loading branch information
krzysztof-lorenc authored Jun 16, 2020
2 parents f5f5633 + 2639a04 commit 8dced65
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/Soloplan.WhatsON.GUI/Configuration/View/ConfigWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Soloplan.WhatsON.GUI.Configuration.View
{
using System;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
Expand Down Expand Up @@ -43,6 +44,11 @@ public partial class ConfigWindow : Window
/// </summary>
private readonly ConfigViewModel configurationViewModel = new ConfigViewModel();

public ConfigViewModel ConfigurationViewModel
{
get { return configurationViewModel; }
}

/// <summary>
/// The connector which should be focused during initialization.
/// </summary>
Expand Down Expand Up @@ -247,6 +253,11 @@ private void ConfigurationViewModelPropertyChanged(object sender, System.Compone
{
this.connectorPage.SingleConnectorMode = this.configurationViewModel.SingleConnectorMode;
}

if (e.PropertyName == nameof(this.ConfigurationViewModel.ConfigurationIsModified))
{
this.connectorPage.OnConfigurationIsModified();
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@
<materialDesign:PackIcon Kind="DotsHorizontal" />
</materialDesign:PopupBox.ToggleContent>
<StackPanel>
<Button Click="DeleteConnectorClick" ToolTip="Delete project">
<Button Name="DeleteButton" Click="DeleteConnectorClick" ToolTip="Delete project">
<materialDesign:PackIcon Width="24"
Height="24"
Kind="RemoveCircle"
Foreground="White"/>
</Button>

<Button Click="RenameConnectorClick" ToolTip="Rename project">
<Button Name="RenameButtton" Click="RenameConnectorClick" ToolTip="Rename project">
<materialDesign:PackIcon Width="24"
Height="24"
Kind="Edit"
Foreground="White"/>
</Button>

<Button Click="AddConnectorClick" ToolTip="Add project manually">
<Button Name="AddButton" Click="AddConnectorClick" ToolTip="Add project manually">
<materialDesign:PackIcon Width="24"
Height="24"
Kind="Add"
Expand Down Expand Up @@ -95,7 +95,8 @@
</materialDesign:ColorZone>
</StackPanel>
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
<Button Height="30"
<Button Name="WizardButton"
Height="30"
Margin="8,0,0,1"
Click="NewInWizardClick"
Visibility="{Binding Path=SingleConnectorMode, Converter={StaticResource InvertBoolToVis}}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,5 +323,37 @@ private void NewInWizardClick(object sender, System.Windows.RoutedEventArgs e)
}
}
}

public void OnConfigurationIsModified()
{
ConfigWindow configWindow = (ConfigWindow)this.ownerWindow;
if (configWindow == null)
{
return;
}

if (configWindow.ConfigurationViewModel.ConfigurationIsModified==false)
{
if (this.AddButton != null)
{
this.AddButton.IsEnabled = true;
}
if (this.WizardButton != null)
{
this.WizardButton.IsEnabled = true;
}
}
else
{
if (this.AddButton != null)
{
this.AddButton.IsEnabled = false;
}
if (this.WizardButton != null)
{
this.WizardButton.IsEnabled = false;
}
}
}
}
}

0 comments on commit 8dced65

Please sign in to comment.