Skip to content

Commit

Permalink
DYN-6500: disable cancel button if no changes (#14692)
Browse files Browse the repository at this point in the history
* disable cancel button of no changes

- if there are no changes, disable the cancel button

* revert namespaces

* revert namespaces

* rename button cancel to reset
  • Loading branch information
dnenov authored Dec 6, 2023
1 parent 0450cc0 commit 6b64aee
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,9 @@ Next assemblies were loaded several times:
<data name="PublishPackageLocally" xml:space="preserve">
<value>Publish Locally</value>
</data>
<data name="PublishPackageResetButton" xml:space="preserve">
<value>Reset</value>
</data>
<data name="PublishPackageMessage" xml:space="preserve">
<value>Package published successfully.
Want to publish a different package?</value>
Expand Down
3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2322,6 +2322,9 @@ Do you want to install the latest Dynamo update?</value>
<data name="PublishPackageLocally" xml:space="preserve">
<value>Publish Locally</value>
</data>
<data name="PublishPackageResetButton" xml:space="preserve">
<value>Reset</value>
</data>
<data name="PublishPackageSelectPackageContentsMessage" xml:space="preserve">
<value>Select package contents</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ public string Group
{
_group = value;
RaisePropertyChanged("Group");
RaisePropertyChanged(nameof(HasChanges));
}
}
}
Expand All @@ -273,6 +274,7 @@ public string Description
{
_Description = value;
RaisePropertyChanged("Description");
RaisePropertyChanged(nameof(HasChanges));
BeginInvoke(() =>
{
SubmitCommand.RaiseCanExecuteChanged();
Expand Down Expand Up @@ -301,6 +303,7 @@ public string Keywords

_Keywords = value;
RaisePropertyChanged("Keywords");
RaisePropertyChanged(nameof(HasChanges));
KeywordList = value.Split(' ').Where(x => x.Length > 0).ToList();
}
}
Expand Down Expand Up @@ -354,6 +357,7 @@ public string MinorVersion
if (value.Length != 1) value = value.TrimStart(new char[] { '0' });
_MinorVersion = value;
RaisePropertyChanged("MinorVersion");
RaisePropertyChanged(nameof(HasChanges));
BeginInvoke(() =>
{
SubmitCommand.RaiseCanExecuteChanged();
Expand All @@ -380,6 +384,7 @@ public string BuildVersion
if (value.Length != 1) value = value.TrimStart(new char[] { '0' });
_BuildVersion = value;
RaisePropertyChanged("BuildVersion");
RaisePropertyChanged(nameof(HasChanges));
BeginInvoke(() =>
{
SubmitCommand.RaiseCanExecuteChanged();
Expand All @@ -406,6 +411,7 @@ public string MajorVersion
if (value.Length != 1) value = value.TrimStart(new char[] { '0' });
_MajorVersion = value;
RaisePropertyChanged("MajorVersion");
RaisePropertyChanged(nameof(HasChanges));
BeginInvoke(() =>
{
SubmitCommand.RaiseCanExecuteChanged();
Expand All @@ -429,6 +435,7 @@ public string License
{
_license = value;
RaisePropertyChanged(nameof(License));
RaisePropertyChanged(nameof(HasChanges));
}
}
}
Expand All @@ -444,6 +451,7 @@ public string CopyrightHolder
{
copyrightHolder = value;
RaisePropertyChanged(nameof(CopyrightHolder));
RaisePropertyChanged(nameof(HasChanges));
}
}

Expand All @@ -458,6 +466,7 @@ public string CopyrightYear
{
copyrightYear = value;
RaisePropertyChanged(nameof(CopyrightYear));
RaisePropertyChanged(nameof(HasChanges));
}
}

Expand All @@ -475,6 +484,7 @@ public string SiteUrl
{
_siteUrl = value;
RaisePropertyChanged("SiteUrl");
RaisePropertyChanged(nameof(HasChanges));
}
}
}
Expand All @@ -493,6 +503,7 @@ public string RepositoryUrl
{
_repositoryUrl = value;
RaisePropertyChanged("RepositoryUrl");
RaisePropertyChanged(nameof(HasChanges));
}
}
}
Expand All @@ -516,6 +527,8 @@ public string Name
SubmitCommand.RaiseCanExecuteChanged();
PublishLocallyCommand.RaiseCanExecuteChanged();
});

RaisePropertyChanged(nameof(HasChanges));
}
}
}
Expand Down Expand Up @@ -581,6 +594,7 @@ public List<string> SelectedHosts
SelectedHostsString = SelectedHostsString.Trim().TrimEnd(',');
RaisePropertyChanged( nameof(SelectedHosts));
RaisePropertyChanged( nameof(SelectedHostsString));
RaisePropertyChanged(nameof(HasChanges));
}
}
}
Expand All @@ -598,6 +612,7 @@ public string SelectedHostsString
{
selectedHostsString = value;
RaisePropertyChanged(nameof(SelectedHostsString));
RaisePropertyChanged(nameof(HasChanges));
}
}
}
Expand Down Expand Up @@ -759,6 +774,7 @@ public ObservableCollection<string> AdditionalFiles
{
_additionalFiles = value;
RaisePropertyChanged("AdditionalFiles");
RaisePropertyChanged(nameof(HasChanges));
}
}
}
Expand All @@ -784,6 +800,7 @@ public string DependencyNames
{
dependencyNames = value;
RaisePropertyChanged(nameof(DependencyNames));
RaisePropertyChanged(nameof(HasChanges));
}
}

Expand Down Expand Up @@ -892,9 +909,18 @@ public string RootFolder
{
_rootFolder = value;
RaisePropertyChanged(nameof(RootFolder));
RaisePropertyChanged(nameof(HasChanges));
}
}

/// <summary>
/// Indicates if the user has made any changes to the current publish package form
/// </summary>
public bool HasChanges
{
get { return AnyUserChanges(); }
}

#endregion

internal PublishPackageViewModel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@

<!-- Cancel -->
<Button Click="CancelButton_Click"
Content="{x:Static p:Resources.CancelButton}"
Content="{x:Static p:Resources.PublishPackageResetButton}"
IsEnabled="{Binding HasChanges}"
DockPanel.Dock="Right"
Background="Transparent"
Foreground="White"
Expand Down

0 comments on commit 6b64aee

Please sign in to comment.