1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- 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;
- namespace compdfkit_tools.PDFControlUI
- {
- public partial class CPDFBookmarkAddUI : UserControl
- {
- /// <summary>
- /// 书签添加按钮点击通知
- /// </summary>
- public event EventHandler<string> BookmarkAddEvent;
- private bool toggleState;
- public CPDFBookmarkAddUI()
- {
- InitializeComponent();
- }
- /// <summary>
- /// 书签添加界面切换显示添加输入界面
- /// </summary>
- private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- toggleState = !toggleState;
- BookmarkInputPanel.Visibility=toggleState?Visibility.Visible:Visibility.Collapsed;
- }
- /// <summary>
- /// 取消添加 隐藏 添加界面
- /// </summary>
- private void ButtonCancel_Click(object sender, RoutedEventArgs e)
- {
- toggleState = false;
- BookmarkInputPanel.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 书签添加按钮点击 触发添加通知
- /// </summary>
- private void ButtonAdd_Click(object sender, RoutedEventArgs e)
- {
- if(!string.IsNullOrEmpty(BookmarkText.Text))
- {
- BookmarkAddEvent?.Invoke(this, BookmarkText.Text);
- BookmarkText.Text = string.Empty;
- }
- }
- }
- internal class BoolEnableConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return false;
- }
- else
- {
- try
- {
- if (value is string)
- {
- string checkValue=value as string;
- if(checkValue.Length>0)
- {
- return true;
- }
- }
-
- }
- catch(Exception ex)
- {
- }
- return false;
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|