File tree Expand file tree Collapse file tree 6 files changed +173
-163
lines changed
Expand file tree Collapse file tree 6 files changed +173
-163
lines changed Original file line number Diff line number Diff line change 1- using One . Toolbox . Views . Stick ;
2-
3- using System . IO ;
1+ using System . IO ;
42
53namespace One . Toolbox . Helpers
64{
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public MainWindowVM()
8383 //TargetPageType = typeof(Views.NotePad.NotePadPage),
8484 Content = new Views . Stick . StickPage ( ) ,
8585 } ,
86- new MainMenuItemVM ( )
86+ new ( )
8787 {
8888 Header = "EveryImage" ,
8989 Icon = ResourceHelper . Dic [ "ImageArea" ] ,
@@ -105,7 +105,7 @@ public MainWindowVM()
105105 // Content = new Views.TestPage(),
106106 //},
107107 //倒叙
108- new MainMenuItemVM ( )
108+ new ( )
109109 {
110110 Header = "Setting" ,
111111 Icon = ResourceHelper . Dic [ "SettingsRound" ] ,
Original file line number Diff line number Diff line change 77using One . Toolbox . Helpers ;
88
99using System . Collections . ObjectModel ;
10+ using System . Diagnostics ;
1011using System . IO ;
1112using System . Text ;
13+ using System . Windows . Controls ;
1214
1315namespace One . Toolbox . ViewModels . NotePad ;
1416
@@ -80,6 +82,8 @@ public EditFileInfoVM(string filePath)
8082 HighlightingDefinitionOC = HighlightingManager . Instance . HighlightingDefinitions ;
8183 }
8284
85+ #region RelayCommand
86+
8387 [ RelayCommand ]
8488 private void OpenFile ( )
8589 {
@@ -90,6 +94,12 @@ private void OpenFile()
9094 }
9195 }
9296
97+ [ RelayCommand ]
98+ private void OpenFilePath ( )
99+ {
100+ Process . Start ( "explorer.exe" , PathHelper . dataPath ) ;
101+ }
102+
93103 [ RelayCommand ]
94104 private void SaveFile ( )
95105 {
@@ -112,6 +122,28 @@ private void OnSelectedHighlightingChanged(object obj)
112122 return ;
113123 }
114124
125+ [ RelayCommand ]
126+ private void RenameFile ( object obj )
127+ {
128+ var parent = obj as Grid ;
129+ var txb = parent . FindName ( "txb1" ) as TextBox ;
130+ if ( txb != null )
131+ {
132+ IsEditFileName = true ;
133+ txb . LostFocus += Txb_LostFocus ;
134+ var res = txb . Focus ( ) ;
135+
136+ //txb.SelectAll();
137+ }
138+ }
139+
140+ private void Txb_LostFocus ( object sender , RoutedEventArgs e )
141+ {
142+ IsEditFileName = false ;
143+ }
144+
145+ #endregion RelayCommand
146+
115147 partial void OnFileNameChanged ( string ? oldValue , string newValue )
116148 {
117149 if ( oldValue == null )
Original file line number Diff line number Diff line change 99using One . Toolbox . ViewModels . Setting ;
1010
1111using System . Collections . ObjectModel ;
12- using System . Diagnostics ;
1312using System . IO ;
1413
1514namespace One . Toolbox . ViewModels . NotePad ;
@@ -101,27 +100,6 @@ private void DeleteFile()
101100 }
102101 }
103102
104- [ RelayCommand ]
105- private void RenameFile ( )
106- {
107- if ( SelectedEditFileInfo != null )
108- {
109- //var newFileName = "";
110- //SelectedEditFileInfo.RenameFile(newFileName);
111-
112- SelectedEditFileInfo . IsEditFileName = true ;
113- }
114- }
115-
116- [ RelayCommand ]
117- private void OpenFilePath ( )
118- {
119- if ( SelectedEditFileInfo != null )
120- {
121- Process . Start ( "explorer.exe" , PathHelper . dataPath ) ;
122- }
123- }
124-
125103 #endregion Command
126104
127105 #region Setting
Original file line number Diff line number Diff line change 6565 </ItemsPanelTemplate >
6666 </ListBox .ItemsPanel>
6767 <ListBox .ItemTemplate>
68- <DataTemplate DataType =" viewmodels:MainMenuItemViewModel " >
68+ <DataTemplate DataType =" viewmodels:MainMenuItemVM " >
6969 <Grid >
7070 <Grid .RowDefinitions>
7171 <RowDefinition />
8080 </DataTemplate >
8181 </ListBox .ItemTemplate>
8282 <d : ListBox .ItemsSource>
83- <x : Array Type =" {x:Type vms:MainMenuItemViewModel }" >
84- <vms : MainMenuItemViewModel Header =" 1" Icon =" {StaticResource HomeRound}" />
85- <vms : MainMenuItemViewModel Icon =" {StaticResource TextFieldsRound}" />
86- <vms : MainMenuItemViewModel Header =" 2" Icon =" {StaticResource SerialPort24Filled}" />
87- <vms : MainMenuItemViewModel Icon =" {StaticResource Network}" />
88- <vms : MainMenuItemViewModel Icon =" {StaticResource EditNoteFilled}" />
83+ <x : Array Type =" {x:Type vms:MainMenuItemVM }" >
84+ <vms : MainMenuItemVM Header =" 1" Icon =" {StaticResource HomeRound}" />
85+ <vms : MainMenuItemVM Icon =" {StaticResource TextFieldsRound}" />
86+ <vms : MainMenuItemVM Header =" 2" Icon =" {StaticResource SerialPort24Filled}" />
87+ <vms : MainMenuItemVM Icon =" {StaticResource Network}" />
88+ <vms : MainMenuItemVM Icon =" {StaticResource EditNoteFilled}" />
8989
90- <vms : MainMenuItemViewModel Dock =" Bottom" Icon =" {StaticResource SettingsRound}" />
91- <vms : MainMenuItemViewModel Dock =" Bottom" Icon =" {StaticResource CloudSyncFilled}" />
90+ <vms : MainMenuItemVM Dock =" Bottom" Icon =" {StaticResource SettingsRound}" />
91+ <vms : MainMenuItemVM Dock =" Bottom" Icon =" {StaticResource CloudSyncFilled}" />
9292 </x : Array >
9393 </d : ListBox .ItemsSource>
9494 </ListBox >
You can’t perform that action at this time.
0 commit comments