Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,33 @@ public RepositoryPublishControl()
d(this.Bind(ViewModel, vm => vm.RepositoryName, v => v.nameText.Text));

d(this.Bind(ViewModel, vm => vm.Description, v => v.description.Text));
d(this.Bind(ViewModel, vm => vm.KeepPrivate, v => v.makePrivate.IsChecked));

d(this.WhenAnyValue(x => x.ViewModel.KeepPrivate)
.Subscribe(keepPrivate =>
{
// because we removed this.Bind, set this by hand
if (keepPrivate != makePrivate.IsChecked)
{
makePrivate.IsChecked = keepPrivate;
}
}));

// BEGIN DANGER ZONE
//
// This replaces the default Bind behaviour as the Checkbox control
// does not raise an event here when it is hosted in the Team Explorer
// view.
//
// We've used this.Bind in other places (popups) so it's something
// we need to investigate further
//
d(Observable.FromEventPattern<RoutedEventArgs>(makePrivate, "Checked")
.Subscribe(_ => ViewModel.KeepPrivate = true));
d(Observable.FromEventPattern<RoutedEventArgs>(makePrivate, "Unchecked")
.Subscribe(_ => ViewModel.KeepPrivate = false));
// END DANGER ZONE


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment on why this abomination is required as opposed to the more straightforward code that works elsewhere. 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

d(this.OneWayBind(ViewModel, vm => vm.CanKeepPrivate, v => v.makePrivate.IsEnabled));

//d(this.OneWayBind(ViewModel, vm => vm.ShowUpgradeToMicroPlanWarning, v => v.upgradeToMicroPlanWarning.Visibility));
Expand Down