@@ -23,7 +23,7 @@ private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
2323
2424 public MainWindowViewModel ( )
2525 {
26- Keys = new ObservableCollection < FileMakerClip > ( ) ;
26+ Keys = new ObservableCollection < ClipViewModel > ( ) ;
2727 }
2828
2929 public void ExitApplication ( )
@@ -38,7 +38,10 @@ public void NewEmptyItem()
3838 {
3939 try
4040 {
41- Keys . Add ( new FileMakerClip ( "New" , FileMakerClip . ClipTypes . First ( ) ? . KeyId ?? "" , Array . Empty < byte > ( ) ) ) ;
41+ var clip = new FileMakerClip ( "New" , FileMakerClip . ClipTypes . First ( ) ? . KeyId ?? "" , Array . Empty < byte > ( ) ) ;
42+ var clipVm = new ClipViewModel ( clip ) ;
43+
44+ Keys . Add ( clipVm ) ;
4245 }
4346 catch ( Exception e )
4447 {
@@ -62,7 +65,7 @@ public void CopyAsClass()
6265 desktop . MainWindow ? . Clipboard is not { } provider )
6366 throw new NullReferenceException ( "Missing Clipboard instance." ) ;
6467
65- var classString = SelectedClip . CreateClass ( ) ;
68+ var classString = SelectedClip . Clip . CreateClass ( ) ;
6669 provider . SetTextAsync ( classString ) ;
6770 }
6871 catch ( Exception e )
@@ -99,12 +102,12 @@ public async Task PasteFileMakerClipData(CancellationToken token)
99102
100103 // don't bother adding a duplicate. For some reason entries were getting entered twice per clip
101104 // this is not the most efficient method to detect it, but it works well enough for now
102- if ( Keys . Any ( k => k . XmlData == clip . XmlData ) )
105+ if ( Keys . Any ( k => k . ClipXml == clip . XmlData ) )
103106 {
104107 continue ;
105108 }
106109
107- Keys . Add ( clip ) ;
110+ Keys . Add ( new ClipViewModel ( clip ) ) ;
108111 }
109112 }
110113 catch ( Exception e )
@@ -123,12 +126,12 @@ public async Task CopySelectedToClip(CancellationToken token)
123126
124127 var dp = new DataPackage ( ) ;
125128
126- if ( SelectedClip is not FileMakerClip data )
129+ if ( SelectedClip is not ClipViewModel data )
127130 {
128131 return ; // no data
129132 }
130133
131- dp . SetData ( data . ClipboardFormat , data . RawData ) ;
134+ dp . SetData ( data . ClipType , data . Clip . RawData ) ;
132135
133136 await provider . SetDataObjectAsync ( dp ) ;
134137 }
@@ -137,10 +140,10 @@ public async Task CopySelectedToClip(CancellationToken token)
137140 }
138141 }
139142
140- public ObservableCollection < FileMakerClip > Keys { get ; set ; }
143+ public ObservableCollection < ClipViewModel > Keys { get ; set ; }
141144
142- private FileMakerClip ? _selectedClip ;
143- public FileMakerClip ? SelectedClip
145+ private ClipViewModel ? _selectedClip ;
146+ public ClipViewModel ? SelectedClip
144147 {
145148 get => _selectedClip ;
146149 set
0 commit comments