File tree Expand file tree Collapse file tree 5 files changed +41
-17
lines changed Expand file tree Collapse file tree 5 files changed +41
-17
lines changed Original file line number Diff line number Diff line change 700
700
<x : String x : Key =" Text.URL" xml : space =" preserve" >URL:</x : String >
701
701
<x : String x : Key =" Text.ViewLogs" xml : space =" preserve" >Logs</x : String >
702
702
<x : String x : Key =" Text.ViewLogs.Clear" xml : space =" preserve" >CLEAR ALL</x : String >
703
+ <x : String x : Key =" Text.ViewLogs.CopyLog" xml : space =" preserve" >Copy</x : String >
704
+ <x : String x : Key =" Text.ViewLogs.Delete" xml : space =" preserve" >Delete</x : String >
703
705
<x : String x : Key =" Text.Warn" xml : space =" preserve" >Warning</x : String >
704
706
<x : String x : Key =" Text.Welcome" xml : space =" preserve" >Welcome Page</x : String >
705
707
<x : String x : Key =" Text.Welcome.AddRootFolder" xml : space =" preserve" >Create Group</x : String >
Original file line number Diff line number Diff line change 704
704
<x : String x : Key =" Text.URL" xml : space =" preserve" >仓库地址 :</x : String >
705
705
<x : String x : Key =" Text.ViewLogs" xml : space =" preserve" >日志列表</x : String >
706
706
<x : String x : Key =" Text.ViewLogs.Clear" xml : space =" preserve" >清空日志</x : String >
707
+ <x : String x : Key =" Text.ViewLogs.CopyLog" xml : space =" preserve" >复制</x : String >
708
+ <x : String x : Key =" Text.ViewLogs.Delete" xml : space =" preserve" >删除</x : String >
707
709
<x : String x : Key =" Text.Warn" xml : space =" preserve" >警告</x : String >
708
710
<x : String x : Key =" Text.Welcome" xml : space =" preserve" >起始页</x : String >
709
711
<x : String x : Key =" Text.Welcome.AddRootFolder" xml : space =" preserve" >新建分组</x : String >
Original file line number Diff line number Diff line change 704
704
<x : String x : Key =" Text.URL" xml : space =" preserve" >存放庫網址:</x : String >
705
705
<x : String x : Key =" Text.ViewLogs" xml : space =" preserve" >日誌清單</x : String >
706
706
<x : String x : Key =" Text.ViewLogs.Clear" xml : space =" preserve" >清除所有日誌</x : String >
707
+ <x : String x : Key =" Text.ViewLogs.CopyLog" xml : space =" preserve" >複製</x : String >
708
+ <x : String x : Key =" Text.ViewLogs.Delete" xml : space =" preserve" >刪除</x : String >
707
709
<x : String x : Key =" Text.Warn" xml : space =" preserve" >警告</x : String >
708
710
<x : String x : Key =" Text.Welcome" xml : space =" preserve" >起始頁</x : String >
709
711
<x : String x : Key =" Text.Welcome.AddRootFolder" xml : space =" preserve" >新增群組</x : String >
Original file line number Diff line number Diff line change 67
67
68
68
<ListBox .ItemTemplate>
69
69
<DataTemplate DataType =" vm:CommandLog" >
70
- <Grid >
70
+ <Grid Background = " Transparent " ContextRequested = " OnLogContextRequested " >
71
71
<Grid .ColumnDefinitions>
72
- <ColumnDefinition Width =" *" />
73
72
<ColumnDefinition Width =" Auto" />
73
+ <ColumnDefinition Width =" *" />
74
74
<ColumnDefinition Width =" Auto" SharedSizeGroup =" SearchCommitTimeColumn" />
75
- <ColumnDefinition Width =" 28" />
76
75
</Grid .ColumnDefinitions>
77
- <TextBlock Grid.Column=" 0"
76
+ <v : LoadingIcon Grid.Column=" 0"
77
+ Width =" 14" Height =" 14"
78
+ Margin =" 4,0,0,0"
79
+ IsVisible =" {Binding !IsComplete}" />
80
+
81
+ <TextBlock Grid.Column=" 1"
78
82
Classes =" primary"
79
- Text =" {Binding Name}"
80
83
Margin =" 4,0,0,0"
84
+ Text =" {Binding Name}"
81
85
VerticalAlignment =" Center"
82
86
TextTrimming =" CharacterEllipsis" />
83
87
84
- <v : LoadingIcon Grid.Column=" 1"
85
- Width =" 14" Height =" 14"
86
- Margin =" 2,0,0,0"
87
- IsVisible =" {Binding !IsComplete}" />
88
-
89
88
<TextBlock Grid.Column=" 2"
90
89
Classes =" primary"
91
90
Margin =" 4,0"
92
91
Foreground =" {DynamicResource Brush.FG2}"
93
92
Text =" {Binding TimeStr}"
94
93
HorizontalAlignment =" Right" VerticalAlignment =" Center" />
95
-
96
- <Button Grid.Column=" 3" Classes =" icon_button" Click =" OnRemoveLog" >
97
- <Path Width =" 14" Height =" 14" Data =" {StaticResource Icons.Clear}" />
98
- </Button >
99
94
</Grid >
100
95
</DataTemplate >
101
96
</ListBox .ItemTemplate>
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ protected override void OnLoaded(RoutedEventArgs e)
46
46
if ( _textMate == null )
47
47
{
48
48
_textMate = Models . TextMateHelper . CreateForEditor ( this ) ;
49
- Models . TextMateHelper . SetGrammarByFileName ( _textMate , "Log.log " ) ;
49
+ Models . TextMateHelper . SetGrammarByFileName ( _textMate , "Shell.sh " ) ;
50
50
}
51
51
}
52
52
@@ -97,10 +97,33 @@ public ViewLogs()
97
97
InitializeComponent ( ) ;
98
98
}
99
99
100
- private void OnRemoveLog ( object sender , RoutedEventArgs e )
100
+ private void OnLogContextRequested ( object sender , ContextRequestedEventArgs e )
101
101
{
102
- if ( sender is Button { DataContext : ViewModels . CommandLog log } && DataContext is ViewModels . ViewLogs vm )
102
+ if ( sender is not Grid { DataContext : ViewModels . CommandLog log } grid || DataContext is not ViewModels . ViewLogs vm )
103
+ return ;
104
+
105
+ var copy = new MenuItem ( ) ;
106
+ copy . Header = App . Text ( "ViewLogs.CopyLog" ) ;
107
+ copy . Icon = App . CreateMenuIcon ( "Icons.Copy" ) ;
108
+ copy . Click += ( _ , ev ) =>
109
+ {
110
+ App . CopyText ( log . Content ) ;
111
+ ev . Handled = true ;
112
+ } ;
113
+
114
+ var rm = new MenuItem ( ) ;
115
+ rm . Header = App . Text ( "ViewLogs.Delete" ) ;
116
+ rm . Icon = App . CreateMenuIcon ( "Icons.Clear" ) ;
117
+ rm . Click += ( _ , ev ) =>
118
+ {
103
119
vm . Logs . Remove ( log ) ;
120
+ ev . Handled = true ;
121
+ } ;
122
+
123
+ var menu = new ContextMenu ( ) ;
124
+ menu . Items . Add ( copy ) ;
125
+ menu . Items . Add ( rm ) ;
126
+ menu . Open ( grid ) ;
104
127
105
128
e . Handled = true ;
106
129
}
You can’t perform that action at this time.
0 commit comments