@@ -62,26 +62,34 @@ public void Init(PluginInitContext ctx)
6262
6363 public List < Result > Query ( Query query )
6464 {
65- var displayData = query . Search . Trim ( ) . Length == 0
66- ? _dataList . ToArray ( )
67- : _dataList . Where ( i =>
68- ! string . IsNullOrEmpty ( i . Text ) && i . Text . ToLower ( ) . Contains ( query . Search . Trim ( ) . ToLower ( ) ) ) . ToArray ( ) ;
65+ var displayData =
66+ query . Search . Trim ( ) . Length == 0
67+ ? _dataList . ToArray ( )
68+ : _dataList
69+ . Where (
70+ i =>
71+ ! string . IsNullOrEmpty ( i . Text )
72+ && i . Text . ToLower ( ) . Contains ( query . Search . Trim ( ) . ToLower ( ) )
73+ )
74+ . ToArray ( ) ;
6975
7076 var results = new List < Result > ( ) ;
7177 results . AddRange ( displayData . Select ( ClipDataToResult ) ) ;
72- results . Add ( new Result ( )
73- {
74- Title = "Clear All Records" ,
75- SubTitle = "Click to clear all records" ,
76- IcoPath = _defaultIconPath ,
77- Score = 1 ,
78- Action = _ =>
78+ results . Add (
79+ new Result ( )
7980 {
80- _dataList . Clear ( ) ;
81- CurrentScore = 1 ;
82- return true ;
83- } ,
84- } ) ;
81+ Title = "Clear All Records" ,
82+ SubTitle = "Click to clear all records" ,
83+ IcoPath = _defaultIconPath ,
84+ Score = 1 ,
85+ Action = _ =>
86+ {
87+ _dataList . Clear ( ) ;
88+ CurrentScore = 1 ;
89+ return true ;
90+ } ,
91+ }
92+ ) ;
8593 return results ;
8694 }
8795
@@ -98,31 +106,36 @@ private Result ClipDataToResult(ClipboardData o)
98106 Score = o . Score ,
99107 TitleToolTip = o . Text ,
100108 SubTitleToolTip = dispSubTitle ,
101- PreviewPanel = new Lazy < UserControl > ( ( ) => new PreviewPanel (
102- o ,
103- _context ! ,
104- ClipCacheDir ,
105- delAction : RemoveFromDatalist ,
106- copyAction : CopyToClipboard ,
107- pinAction : PinOneRecord
108- ) ) ,
109+ PreviewPanel = new Lazy < UserControl > (
110+ ( ) =>
111+ new PreviewPanel (
112+ o ,
113+ _context ! ,
114+ ClipCacheDir ,
115+ delAction : RemoveFromDatalist ,
116+ copyAction : CopyToClipboard ,
117+ pinAction : PinOneRecord
118+ )
119+ ) ,
109120 AsyncAction = async _ =>
110121 {
111122 CopyToClipboard ( o ) ;
112123 _context ! . API . HideMainWindow ( ) ;
113124 while ( _context ! . API . IsMainWindowVisible ( ) )
114125 await Task . Delay ( 100 ) ;
115- new InputSimulator ( )
116- . Keyboard
117- . ModifiedKeyStroke ( VirtualKeyCode . CONTROL , VirtualKeyCode . VK_V ) ;
126+ new InputSimulator ( ) . Keyboard . ModifiedKeyStroke (
127+ VirtualKeyCode . CONTROL ,
128+ VirtualKeyCode . VK_V
129+ ) ;
118130 return true ;
119131 } ,
120132 } ;
121133 }
122134
123135 private void _OnClipboardChange ( object ? sender , SharpClipboard . ClipboardChangedEventArgs e )
124136 {
125- if ( e . Content is null ) return ;
137+ if ( e . Content is null )
138+ return ;
126139 ClipboardData clipboardData = new ClipboardData
127140 {
128141 Text = "" ,
@@ -145,7 +158,8 @@ private void _OnClipboardChange(object? sender, SharpClipboard.ClipboardChangedE
145158 break ;
146159 case SharpClipboard . ContentTypes . Image :
147160 clipboardData . Text = $ "Image:{ clipboardData . Time : yy-MM-dd-HH:mm:ss} ";
148- if ( _settings . CacheImages ) Utils . SaveImageCache ( clipboardData , ClipCacheDir ) ;
161+ if ( _settings . CacheImages )
162+ Utils . SaveImageCache ( clipboardData , ClipCacheDir ) ;
149163 clipboardData . Icon = _clipboard . ClipboardImage . ToBitmapImage ( ) ;
150164 break ;
151165 case SharpClipboard . ContentTypes . Files :
@@ -173,9 +187,7 @@ private void _OnClipboardChange(object? sender, SharpClipboard.ClipboardChangedE
173187
174188 public Control CreateSettingPanel ( ) => new SettingsPanel ( _settings , _context ! ) ;
175189
176- public void Dispose ( )
177- {
178- }
190+ public void Dispose ( ) { }
179191
180192 public void CopyToClipboard ( ClipboardData clipboardData )
181193 {
@@ -205,4 +217,4 @@ public void Save()
205217 {
206218 _settings ? . Save ( ) ;
207219 }
208- }
220+ }
0 commit comments