private void Overlay_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (Visibility != Visibility.Visible) { ContentPopup.SetCurrentValue(Popup.IsOpenProperty, false); } }
public void SetElement(ContentPopup element) { if (element.Parent == null) { element.Parent = Application.Current; } element.PropertyChanged += OnElementPropertyChanged; _element = element; UpdateContent(); if (_element.BackgroundColor != XColor.Default) { UpdateBackgroundColor(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_popup != null) { _popup.BackButtonPressed -= OnBackButtonPressed; _popup.Dismissed -= OnDismissed; _popup.Unrealize(); _popup = null; } if (_element != null) { _element.PropertyChanged -= OnElementPropertyChanged; _element = null; } } }
private async void DownloadLocationExecute() { var dialog = new ContentPopup(); var stack = new StackPanel(); stack.Margin = new Thickness(12, 16, 12, 0); stack.Children.Add(new RadioButton { Tag = 1, Content = "Temp folder, cleared on logout or uninstall", IsChecked = FilesDirectory == null }); stack.Children.Add(new RadioButton { Tag = 2, Content = "Custom folder, cleared only manually", IsChecked = FilesDirectory != null }); dialog.Title = "Choose download location"; dialog.Content = stack; dialog.PrimaryButtonText = Strings.Resources.OK; dialog.SecondaryButtonText = Strings.Resources.Cancel; var confirm = await dialog.ShowQueuedAsync(); if (confirm == ContentDialogResult.Primary) { var mode = 1; var path = FilesDirectory + string.Empty; foreach (RadioButton current in stack.Children) { if (current.IsChecked == true) { mode = (int)current.Tag; break; } } switch (mode) { case 0: break; case 1: FilesDirectory = null; break; case 2: var picker = new FolderPicker(); picker.SuggestedStartLocation = PickerLocationId.Downloads; picker.FileTypeFilter.Add("*"); var folder = await picker.PickSingleFolderAsync(); if (folder != null) { StorageApplicationPermissions.FutureAccessList.AddOrReplace("FilesDirectory", folder); FilesDirectory = folder.Path; } break; } if (string.Equals(path, FilesDirectory, StringComparison.OrdinalIgnoreCase)) { return; } ProtoService.Send(new Close()); } }