/// <summary> /// Ask user for confirmation before closing panel /// </summary> /// <param name="e">The <see cref="ItemCancelEventArgs"/></param> private void PanelClosing(ItemCancelEventArgs e) { var docPanel = e.Item as LayoutPanel; if (docPanel is null) { return; } var panelViewModel = (IPanelViewModel)docPanel.Content; if (panelViewModel is null) { return; } if (!panelViewModel.IsDirty) { return; } var confirmation = new GenericConfirmationDialogViewModel(panelViewModel.Caption, MessageHelper.ClosingPanelConfirmation); if (this.dialogNavigationService.NavigateModal(confirmation)?.Result is not true) { e.Cancel = true; } }
private void DockItemClosing(object sender, ItemCancelEventArgs e) { Debug.WriteLine("DockItemClosing: {0}", e.Item); var info = new PanelLayoutInfo(); LayoutPanel panel = null; if (e.Item is LayoutPanel) { panel = (LayoutPanel)e.Item; info.IsFloating = false; } else if (e.Item is FloatGroup) { var g = (FloatGroup)e.Item; panel = (LayoutPanel)g.Items[0]; info.IsFloating = true; info.FloatLocation = g.FloatLocation; info.FloatSize = g.FloatSize; } var key = FindKeyByObject(panel); if (key != "") { _panelInfos[key] = info; _openDocuments.Remove(key); } }
public bool VerifyClosingCommandCancellation(bool userCancel) { var dialogStub = new Mock <IDialogNavigationService>(); dialogStub.Setup(d => d.NavigateModal(It.IsAny <IDialogViewModel>())) .Returns(new BaseDialogResult(userCancel)); var viewModel = new DockLayoutViewModel(dialogStub.Object); //Create panel view model stub var panelViewModelStub = new Mock <IPanelViewModel>(); panelViewModelStub.SetupAllProperties(); panelViewModelStub.SetupGet(p => p.IsDirty).Returns(true); //Add stub to dock view model viewModel.AddDockPanelViewModel(panelViewModelStub.Object); var args = new ItemCancelEventArgs(new LayoutPanel() { Content = panelViewModelStub.Object }); //Act viewModel.DockPanelClosingCommand.Execute(args); return(args.Cancel); }
private void DockLayoutManagerOnDockItemClosing(object sender, ItemCancelEventArgs e) { #region 提示是否可以关闭 //如果窗体正在编辑,则不能关闭 //e.Cancel = true; #endregion }
void dockManager_LayoutItemActivating(object sender, ItemCancelEventArgs e) { if (e.Item.Name == "newNotePage") { LayoutControlItem item = CreateNewNotePage(e.Item.Parent); e.Cancel = item != null; if (item != null) { ActivateDelegate activate = new ActivateDelegate(ActivateLayoutItem); Dispatcher.BeginInvoke(activate, new object[] { item }); } } }
void dockManager_DockItemActivating(object sender, ItemCancelEventArgs e) { if (e.Item.Name == "newNote") { DocumentPanel panel = CreateNewNote(); e.Cancel = panel != null; if (panel != null) { ActivateDelegate activate = new ActivateDelegate(ActivateDockItem); Dispatcher.BeginInvoke(activate, new object[] { panel }); } } }
public virtual void SelectedItemClosing(ItemCancelEventArgs e) { if (e == null) { return; } if (e.Item is DocumentPanel) { var panel = (DocumentPanel)e.Item; if (panel.Content is IScreen) { var screen = (IScreen)panel.Content; screen.TryClose(); } } }
private void OnTabPageClosing(object sender, ItemCancelEventArgs e) { if (!e.Cancel) { var parent = GetParent(); if (parent != null) { var tabControl = parent.GetControl <DockTabPanelControl>(); if (tabControl != null && Equals(e.Item, Control)) { Close(); e.Cancel = true; } } } }
private void DocManager_OnDockItemClosing(object sender, ItemCancelEventArgs e) { var layout = sender as DevExpress.Xpf.Docking.DockLayoutManager; if (layout == null || layout.ActiveDockItem == null) { return; } var uniqueId = layout.ActiveDockItem.Caption; var context = layout.DataContext as MainViewModel; if (context == null) { return; } if (context.WorkPlaceList.Any(x => x.DisplayName.Equals(uniqueId))) { WorkPlaceViewModelBase configPanel = context.WorkPlaceList.First(x => x.DisplayName.Equals(uniqueId)); configPanel.Close(); } }
private void OnDockManagerDockItemClosing(object sender, ItemCancelEventArgs e) { try { var dataContext = e.Item.DataContext; if (dataContext is ViewChatUser) { var item = dataContext as ViewChatUser; var itemsSource = documentContainer.ItemsSource as ObservableCollection <ViewChatUser>; if (itemsSource != null) { itemsSource.Remove(item); if (itemsSource.Count == 0) { Hide(); } } } } catch (Exception exception) { _log.Error(exception); } }
private void Preview_DockItemClosing(object sender, ItemCancelEventArgs e) { throw new NotImplementedException(); }
/// <summary> /// Handles the Dock Panel closing event /// </summary> /// <param name="region">The region</param> /// <param name="regionTarget">The region target</param> /// <param name="s">The sender</param> /// <param name="e">The <see cref="ItemCancelEventArgs"/></param> private void OnPanelClosing(IRegion region, DocumentGroup regionTarget, object s, ItemCancelEventArgs e) { if (!e.Item.Parent.Equals(regionTarget)) { return; } var docPanel = e.Item as LayoutPanel; if (docPanel == null) { return; } var view = (UserControl)docPanel.Content; var panelViewModel = (IPanelViewModel)view.DataContext; if (panelViewModel == null) { return; } if (!panelViewModel.IsDirty) { return; } if (this.dialogNavigationService == null) { this.dialogNavigationService = ServiceLocator.Current.GetInstance <IDialogNavigationService>(); } var confirmation = new GenericConfirmationDialogViewModel("Warning", MessageHelper.ClosingPanelConfirmation); var result = this.dialogNavigationService.NavigateModal(confirmation); if (result != null && result.Result.HasValue && result.Result.Value) { return; } e.Cancel = true; }
private void DockItemClosing(object sender, ItemCancelEventArgs e) { Debug.WriteLine("DockItemClosing: {0}", e.Item); var info = new PanelLayoutInfo(); LayoutPanel panel = null; if (e.Item is LayoutPanel) { panel = (LayoutPanel) e.Item; info.IsFloating = false; } else if (e.Item is FloatGroup) { var g = (FloatGroup) e.Item; panel = (LayoutPanel)g.Items[0]; info.IsFloating = true; info.FloatLocation = g.FloatLocation; info.FloatSize = g.FloatSize; } var key = FindKeyByObject(panel); if (key != "") { _panelInfos[key] = info; _openDocuments.Remove(key); } }
void DockItemStartDocking(object sender, ItemCancelEventArgs e) { Debug.WriteLine("DockItemStartDocking: {0}", e.Item); }
private void OnDockManagerDockItemClosing(object sender, ItemCancelEventArgs e) { try { var dataContext = e.Item.DataContext; if (dataContext is ViewChatUser) { var item = dataContext as ViewChatUser; var itemsSource = documentContainer.ItemsSource as ObservableCollection<ViewChatUser>; if (itemsSource != null) { itemsSource.Remove(item); if (itemsSource.Count == 0) { Hide(); } } } } catch (Exception exception) { _log.Error(exception); } }
private void DockLayoutManager_OnDockItemClosing(object sender, ItemCancelEventArgs e) { e.Item.Closed = true; }
static void ModalHelper_DockItemClosing(object sender, ItemCancelEventArgs e) { SetIsModal(e.Item, false); }
private void File_barEditRecent_ShowingEditor(object sender, ItemCancelEventArgs e) { repositoryItemLookUpEdit1.DataSource = mrudt; }
private void barEditItem2_ShowingEditor(object sender, ItemCancelEventArgs e) { }