Пример #1
0
        public ProgressDialog(CushWindow owningWindow, ProgressDialogSettings settings)
            : base(owningWindow, settings)
        {
            InitializeComponent();

            if (settings == null)
                settings = ProgressDialogSettings.Cancellable;

            CancelButton.Visibility = settings.ShowCancelButton ? Visibility.Visible : Visibility.Collapsed;
        }
Пример #2
0
        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);
        }
Пример #3
0
        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();
        }
Пример #4
0
 public AboutDialog(IAboutViewModel vm, CushWindow owningWindow, DialogSettings settings)
     : base(owningWindow, settings)
 {
     DataContext = vm;
     InitializeComponent();
 }
Пример #5
0
 /// <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();
 }
Пример #6
0
        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;
        }
Пример #7
0
 private static Task HandleOverlayOnShow(DialogSettings settings, CushWindow window)
 {
     return (settings == null || settings.AnimateShow
         ? window.ShowOverlayAsync()
         : Task.Factory.StartNew(() => window.Dispatcher.Invoke(window.ShowOverlay)));
 }
Пример #8
0
 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);
 }
Пример #9
0
        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;
        }
Пример #10
0
 protected internal void CleanUp(FlyoutsControl flyoutsControl)
 {
     if (_windowTitleThumb != null)
     {
         _windowTitleThumb.DragDelta -= WindowTitleThumbMoveOnDragDelta;
         _windowTitleThumb.MouseDoubleClick -= WindowTitleThumbChangeWindowStateOnMouseDoubleClick;
         _windowTitleThumb.MouseRightButtonUp -= WindowTitleThumbSystemMenuOnMouseRightButtonUp;
     }
     _parentWindow = null;
 }
Пример #11
0
        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);
        }
Пример #12
0
 internal static ProgressDialogResult Execute(CushWindow owner, string label,
     Action<BackgroundWorker, DoWorkEventArgs> operation, ProgressDialogSettings settings)
 {
     return ExecuteInternal(owner, label, operation, settings);
 }
Пример #13
0
 /// <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();
 }