public ProgressDialog(CushWindow owningWindow, ProgressDialogSettings settings) : base(owningWindow, settings) { InitializeComponent(); if (settings == null) settings = ProgressDialogSettings.Cancellable; CancelButton.Visibility = settings.ShowCancelButton ? Visibility.Visible : Visibility.Collapsed; }
internal void HandleFlyoutStatusChange(Flyout flyout, CushWindow parentWindow) { if (flyout == null || parentWindow == null) { return; } ReorderZIndices(flyout); var visibleFlyouts = GetFlyouts(Items).Where(i => i.IsOpen).OrderBy(Panel.GetZIndex); parentWindow.HandleFlyoutStatusChange(flyout, visibleFlyouts); }
public SettingsDialog(ISettingsViewModel vm, CushWindow owningWindow, DialogSettings settings) : base(owningWindow, settings) { DataContext = vm; InitializeComponent(); _originalScheme = new ColorScheme(this.ColorScheme); if (vm.ConfigFileHasPassword) InitializePassword(); //Apply.IsEnabled = false; var cvs = CollectionViewSource.GetDefaultView(FontCombo.ItemsSource); cvs.SortDescriptions.Clear(); cvs.SortDescriptions.Add(new SortDescription("Source", ListSortDirection.Ascending)); cvs.Refresh(); }
public AboutDialog(IAboutViewModel vm, CushWindow owningWindow, DialogSettings settings) : base(owningWindow, settings) { DataContext = vm; InitializeComponent(); }
/// <summary> /// Initializes a new DialogBase. /// </summary> /// <param name="owningWindow">The window that is the parent of the dialog.</param> /// <param name="settings"></param> protected DialogBase(CushWindow owningWindow, DialogSettings settings) { DialogSettings = settings ?? owningWindow?.DialogOptions ?? new DialogSettings(); OwningWindow = owningWindow; Initialize(); }
private static SizeChangedEventHandler SetupAndOpenDialog(CushWindow window, DialogBase dialog) { dialog.SetValue(Panel.ZIndexProperty, (int) window.OverlayBox.GetValue(Panel.ZIndexProperty) + 1); dialog.MinHeight = window.ActualHeight/4.0; dialog.MaxHeight = window.ActualHeight; //an event handler for auto resizing an open dialog. SizeChangedEventHandler sizeHandler = (sender, args) => { dialog.MinHeight = window.ActualHeight/4.0; dialog.MaxHeight = window.ActualHeight; }; window.SizeChanged += sizeHandler; if (!window.DialogContainer.Children.Contains(dialog)) { window.DialogContainer.Children.Add(dialog); //add the dialog to the container } dialog.OnShown(); return sizeHandler; }
private static Task HandleOverlayOnShow(DialogSettings settings, CushWindow window) { return (settings == null || settings.AnimateShow ? window.ShowOverlayAsync() : Task.Factory.StartNew(() => window.Dispatcher.Invoke(window.ShowOverlay))); }
private static ContentDialog GetDialog(CushWindow window, ContentDialog content, DialogSettings settings) { // Return the existing dialog, if it exists. // Otherwise, create a new one. return window.DialogContainer.Children.Cast<ContentDialog>() .FirstOrDefault(item => item.Guid == content.Guid) ?? CreateDialog(window, content, settings); }
private static ContentDialog CreateDialog(CushWindow window, ContentDialog content, DialogSettings settings) { if (settings == null) settings = window.DialogOptions; // Pull the content out of the dialog and put it into a new dialog. // (For some reason, using the dialog directly doesn't work.) var body = content; var bodyContext = (content).DataContext; //create the dialog control var dialog = new ContentDialog(window, settings) { Content = body, Guid = content.Guid, DataContext = bodyContext }; return dialog; }
protected internal void CleanUp(FlyoutsControl flyoutsControl) { if (_windowTitleThumb != null) { _windowTitleThumb.DragDelta -= WindowTitleThumbMoveOnDragDelta; _windowTitleThumb.MouseDoubleClick -= WindowTitleThumbChangeWindowStateOnMouseDoubleClick; _windowTitleThumb.MouseRightButtonUp -= WindowTitleThumbSystemMenuOnMouseRightButtonUp; } _parentWindow = null; }
internal static ProgressDialogResult ExecuteInternal(CushWindow owner, string title, object operation, ProgressDialogSettings settings) { var dialog = new ProgressDialog(owner, settings); if (!string.IsNullOrEmpty(title)) dialog.Title = title; return dialog.Execute(operation); }
internal static ProgressDialogResult Execute(CushWindow owner, string label, Action<BackgroundWorker, DoWorkEventArgs> operation, ProgressDialogSettings settings) { return ExecuteInternal(owner, label, operation, settings); }
/// <summary> /// Initializes a new ContentDialog. /// </summary> /// <param name="owningWindow">The window that is the parent of the dialog.</param> /// <param name="settings"></param> public ContentDialog(CushWindow owningWindow, DialogSettings settings) : base(owningWindow, settings) { Initialize(); }