private static void OpenViewInDialog(View view, View parent) { var container = new DXWindow { Width = 800, Height = 500, ShowInTaskbar = true, Title = view.GetText() ?? string.Empty, WindowStartupLocation = WindowStartupLocation.CenterScreen, Content = view.GetControl() }; if (parent != null) { container.ShowIcon = false; container.WindowState = WindowState.Normal; container.WindowStyle = WindowStyle.ToolWindow; // Закрытие диалога по нажатию на Escape container.PreviewKeyDown += (s, e) => { if (e.Key == Key.Escape) { container.Close(); } }; } else { container.ShowIcon = true; container.WindowState = WindowState.Maximized; container.WindowStyle = WindowStyle.SingleBorderWindow; container.Icon = ImageRepository.GetImage(view.GetImage()); } var closingHandling = false; var closeHandling = false; view.OnClosing += (c, a) => TryExecuteBlock(ref closingHandling, () => a.IsCancel = (a.IsCancel == true) || !CloseView(view)); view.OnClosed += (c, a) => TryExecuteBlock(ref closeHandling, container.Close); container.Closing += (c, a) => TryExecuteBlock(ref closeHandling, () => a.Cancel = a.Cancel || !view.Close()); var gotFocusHandling = false; view.OnGotFocus += (c, a) => TryExecuteBlock(ref gotFocusHandling, () => container.Focus()); container.GotFocus += (s, e) => TryExecuteBlock(ref gotFocusHandling, () => view.InvokeScript(view.OnGotFocus)); var lostFocusHandling = false; container.LostFocus += (s, e) => TryExecuteBlock(ref lostFocusHandling, () => view.InvokeScript(view.OnLostFocus)); view.OnTextChanged += (c, a) => container.Title = a.Value; container.ShowDialog(); }
public virtual void AddNewRow() { DXWindow dialog = CreateDialogWindow(CreateNewRow(), false); dialog.Closed += OnNewRowDialogClosed; dialog.ShowDialog(); }
public void CreateEditDialog() { DXWindow dialog = CreateDialogWindow(EditRowItem, true); dialog.Closed += OnEditRowDialogClosed; dialog.ShowDialog(); }
private void ShowPreview(object sender, RoutedEventArgs e) { Report report = new Report(); var preview = new MyDocumentPreviewControl() { DocumentSource = report }; var window = new DXWindow() { Content = preview }; report.CreateDocument(true); window.ShowDialog(); }
/// <summary> /// 新建文档管理弹窗 /// </summary> /// <param name="beLongFunction">所属模块</param> /// <param name="functionPKNO">所属模块PKNO</param> /// <param name="Istate">文档状态 0:普通文档 1:封面</param> /// <param name="groupNo">分组编号</param> /// <param name="mode">是否可读可写</param> public static void NewDocumentManage(string beLongFunction, string functionPKNO, string groupNo, int Istate, DocumentMangMode mode) { DXWindow window = new DXWindow(); DocumentManageView documentManageView = new DocumentManageView(mode); documentManageView.BelongFunction = beLongFunction; documentManageView.FunctionPKNO = functionPKNO; documentManageView.GroupNo = groupNo; //documentManageView.IsRead = mode; documentManageView.BindGridView(); documentManageView.Istate = Istate; window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.Content = documentManageView; window.ShowDialog(); }
public virtual void EditRow() { if (View == null || Grid.CurrentItem == null || PrimaryKey == string.Empty) { return; } var en = DataServiceContext.Entities.GetEnumerator(); while (en.MoveNext()) { if (en.Current.Identity.EndsWith(string.Format("({0})", Grid.GetFocusedRowCellValue(PrimaryKey)))) { DXWindow dialog = CreateDialogWindow(en.Current.Entity, true); dialog.Closed += OnEditRowDialogClosed; dialog.ShowDialog(); break; } } }
public static void ShowDialog(this IElement target, string title) { if (target != null) { var dialogWindow = new DXWindow { Title = title ?? string.Empty, Content = target.GetControl(), Width = 600, Height = 300, ShowIcon = false, ShowInTaskbar = true, WindowState = WindowState.Normal, WindowStyle = WindowStyle.ToolWindow, WindowStartupLocation = WindowStartupLocation.CenterScreen }; dialogWindow.ShowDialog(); } }