private void UserControl_PreviewMouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { if (Parent != null) { (Parent as StackPanel).Children.Remove(this); caption_MouseLeave(this, null); try { WorkPage.RestoreModuleFromShortcut(new HistoryShortcut { Caption = Caption, Shortcut = Shortcut, ActionAfterRestore = ActionAfterRestore, ConstructorParams = ConstructorParams, DataContextParam = DataContextParam, ModuleType = ModuleType, ModuleDrawingBrushName = ModuleDrawingBrushName, }); } catch (Exception ex) { Manager.UI.ShowMessage(ex.Message); } //Manager.UI.AddTab(Caption, Frame as FrameworkElement); } } else { LastClicked = this; } }
void Header_PreviewMouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (TabHeader.LastClosed != null) { var history = (WorkPage.CurrentPage as WorkPage).HistoryContent as StackPanel; HistoryShortcut founded = null; foreach (HistoryShortcut hs in history.Children) { if (hs.Frame == TabHeader.LastClosed) { founded = hs; break; } } if (founded != null) { HistoryShortcut.LastClicked = founded; (WorkPage.CurrentPage as WorkPage).del_Click(null, null); TabHeader.LastClosed = null; } } }
public HistoryShortcut() { InitializeComponent(); HistoryShortcut.HistoryContextMenu(this, new DependencyPropertyChangedEventArgs(ShowHistoryContextMenuProperty, ShowHistoryContextMenu, ShowHistoryContextMenu)); }