public MyWordTipsControl(FloatingPanel floatingPanel) { InitializeComponent(); MyFloatingPanel = floatingPanel; this.DataContext = viewModel; EventAggregatorRepository.EventAggregator.GetEvent <SendSelectNumberToMyWordTipsEvent>().Subscribe(SendSelectNumberToMyWordTips); EventAggregatorRepository.EventAggregator.GetEvent <CloseMyWordTipsEvent>().Subscribe(CloseMyWordTips); }
/// <summary> /// 打开同义词替换窗体 /// </summary> void OpenMyFloatingPanel() { try { Point currentPos = GetPositionForShowing(this.Application.Selection); FloatingPanel wpfHost = new FloatingPanel(); MyWordTipsControl myWordTips = new MyWordTipsControl(wpfHost); wpfHost.MyWordTipsWPFHost.HostContainer.Children.Add(myWordTips); wpfHost.Location = currentPos; wpfHost.ShowDialog(); } catch (Exception ex) { } }