123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- using PDF_Office.ViewModels.PropertyPanel.ViewModular;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using System.Windows.Threading;
- namespace PDF_Office.Views.PropertyPanel.ViewModular
- {
- /// <summary>
- /// SplitScreenContent.xaml 的交互逻辑
- /// </summary>
- public partial class SplitScreenContent : UserControl
- {
- private SplitScreenContentViewModel splitScreenContentViewModel = null;
- private bool isLoadMenuSelectedFiles = false;
- private bool isLoadMenuReselect = false;
- public SplitScreenContent()
- {
- InitializeComponent();
- splitScreenContentViewModel = (SplitScreenContentViewModel)this.DataContext;
- }
- private void BtnSelectedFiles_Click(object sender, RoutedEventArgs e)
- {
- MenuSelectedFiles.PlacementTarget = this.BtnSelectedFiles;
- MenuSelectedFiles.IsOpen = true;
- if (splitScreenContentViewModel != null && !isLoadMenuSelectedFiles)
- {
- splitScreenContentViewModel.SelectedFilesCommand.Execute(MenuSelectedFiles);
- isLoadMenuSelectedFiles = true;
- }
- }
- private void BtnSelectedFiles_Initialized(object sender, EventArgs e)
- {
- this.BtnSelectedFiles.ContextMenu = null;
- }
- private void BtnReselect_Click(object sender, RoutedEventArgs e)
- {
- MenuReselect.PlacementTarget = this.BtnReselect;
- MenuReselect.IsOpen = true;
- if (splitScreenContentViewModel != null && !isLoadMenuReselect)
- {
- splitScreenContentViewModel.SelectedFilesCommand.Execute(MenuReselect);
- isLoadMenuReselect = true;
- }
- }
- private void BtnReselect_Initialized(object sender, EventArgs e)
- {
- this.BtnReselect.ContextMenu = null;
- }
- private void RectReselect_MouseEnter(object sender, MouseEventArgs e)
- {
- Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(delegate
- {
- this.BtnReselect.Visibility = Visibility.Visible;
- this.MenuReselect.Visibility = Visibility.Visible;
- this.RectReselect.Visibility = Visibility.Collapsed;
- }));
- }
- private async void BtnReselect_MouseLeave(object sender, MouseEventArgs e)
- {
- //IInputElement focusedControl = FocusManager.GetFocusedElement(MenuReselect);
- //if (focusedControl is MenuItem menu)
- //{
- // if (menu.Header.ToString() != "Select file")
- // {
- // await System.Threading.Tasks.Task.Delay(3000);
- // this.BtnReselect.Visibility = Visibility.Collapsed;
- // this.RectReselect.Visibility = Visibility.Visible;
- // }
- //}
- //else
- //{
- // await System.Threading.Tasks.Task.Delay(3000);
- // this.BtnReselect.Visibility = Visibility.Collapsed;
- // this.RectReselect.Visibility = Visibility.Visible;
- //}
- await System.Threading.Tasks.Task.Delay(3000);
- this.BtnReselect.Visibility = Visibility.Collapsed;
- this.MenuReselect.Visibility = Visibility.Collapsed;
- this.RectReselect.Visibility = Visibility.Visible;
- }
- private void MenuReselect_MouseEnter(object sender, MouseEventArgs e)
- {
- this.BtnReselect.Visibility = Visibility.Visible;
- this.MenuReselect.Visibility = Visibility.Visible;
- this.RectReselect.Visibility = Visibility.Collapsed;
- }
- }
- }
|