Exemplo n.º 1
0
        private async void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            Contractor contractor = (Contractor)this.popUp.DataContext;

            var clone = ContractorsContext.Current.CopyForEdit(contractor);

            PropertyDialog dialog = ContentDialogFactory.Create(clone, new Grid[] { this.OverlayPoup });

            this.escPopUpClosingSuspended = true;

            if (await dialog.ShowAsync() == ContentDialogResult.Primary)
            {
                var pointer = Window.Current.CoreWindow.PointerCursor;

                Window.Current.CoreWindow.PointerCursor =
                    new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Wait, 1);

                await ContractorsContext.Current.Update(contractor, clone);

                Window.Current.CoreWindow.PointerCursor = pointer;
            }

            this.escPopUpClosingSuspended = false;

            this.popUp.UpdateLayout();

            this.MovePopupRootToCenter();

            this.btnBack.Focus(FocusState.Programmatic);
        }
        public static PropertyDialog Create(Contractor contractor, Grid[] overlayGrids)
        {
            PropertyDialog dialog = new PropertyDialog(contractor);

            var trigger = BindTrigger(dialog, overlayGrids);

            trigger.SetBounds();

            return(dialog);
        }
        private static ContentDialogFactory BindTrigger(PropertyDialog dialog, Grid[] overlayGrids)
        {
            ContentDialogFactory trigger = new ContentDialogFactory(dialog);

            Window.Current.CoreWindow.SizeChanged += trigger.CoreWindow_SizeChanged;

            dialog.Closed += trigger.Dialog_Closed;

            trigger.overlays = overlayGrids;

            foreach (var overlay in overlayGrids)
            {
                overlay.Visibility = Visibility.Visible;
            }

            return(trigger);
        }
Exemplo n.º 4
0
        private async void AddContractor()
        {
            Contractor contractor = ContractorsContext.Current.CreateForEdit();

            PropertyDialog dialog = ContentDialogFactory.Create(contractor, new Grid[] { this.Overlay });

            if (await dialog.ShowAsync() == ContentDialogResult.Primary)
            {
                var pointer = Window.Current.CoreWindow.PointerCursor;

                Window.Current.CoreWindow.PointerCursor =
                    new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Wait, 1);

                await ContractorsContext.Current.Add(contractor);

                ContractorsContext.Current.Collapse(contractor);

                Window.Current.CoreWindow.PointerCursor = pointer;
            }
        }
 private ContentDialogFactory(PropertyDialog dialog)
 {
     this.contentDialog = dialog;
 }