コード例 #1
0
ファイル: Dialog.cs プロジェクト: radtek/Shopdrawing
        public new bool?ShowDialog()
        {
            bool?dialogResult = null;

            using (IDisposable disposable = TemporaryCursor.SetCursor(Cursors.Arrow))
            {
                try
                {
                    try
                    {
                        base.SetValue(Dialog.IsModalProperty, (object)true);
                        IExternalChanges service = null;
                        if (Dialog.ServiceProvider != null)
                        {
                            service = (IExternalChanges)Dialog.ServiceProvider.GetService(typeof(IExternalChanges));
                        }
                        if (service == null)
                        {
                            dialogResult = base.ShowDialog();
                        }
                        else
                        {
                            using (IDisposable disposable1 = service.DelayNotification())
                            {
                                dialogResult = base.ShowDialog();
                            }
                        }
                    }
                    catch (Win32Exception win32Exception1)
                    {
                        Win32Exception win32Exception = win32Exception1;
                        if (win32Exception.ErrorCode != -2147467259 || (win32Exception.NativeErrorCode != 1400 || !(win32Exception.TargetSite.Name == "PostMessage")) && (win32Exception.NativeErrorCode != 87 || !(win32Exception.TargetSite.Name == "SetFocus")))
                        {
                            throw;
                        }
                        else
                        {
                            dialogResult = base.DialogResult;
                        }
                    }
                }
                finally
                {
                    base.SetValue(Dialog.IsModalProperty, (object)false);
                    if (Application.Current != null && Application.Current.MainWindow != null)
                    {
                        Application.Current.MainWindow.Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 3), new DispatcherOperationCallback((object arg) => null), null);
                    }
                }
            }
            return(dialogResult);
        }
コード例 #2
0
        public static SceneNode CreateAndSetBindingOrData(DataSchemaNodePath bindingPath, SceneNode target, bool useDesignDataContext, ref ReferenceStep targetProperty)
        {
            MiniTargetBindingDialogModel bindingDialogModel = new MiniTargetBindingDialogModel(bindingPath, target, targetProperty, useDesignDataContext);
            MiniBindingDialog            miniBindingDialog  = new MiniBindingDialog((MiniBindingDialogModel)bindingDialogModel);

            if (targetProperty == null)
            {
                using (TemporaryCursor.SetCursor((Cursor)null))
                {
                    bool?nullable = miniBindingDialog.ShowDialog();
                    if ((!nullable.GetValueOrDefault() ? 1 : (!nullable.HasValue ? true : false)) != 0)
                    {
                        return((SceneNode)null);
                    }
                }
            }
            return(bindingDialogModel.CreateAndSetBindingOrData(ref targetProperty));
        }