forked from paulirwin/JavaToCSharp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainWindow.axaml
More file actions
158 lines (157 loc) · 10.4 KB
/
Copy pathMainWindow.axaml
File metadata and controls
158 lines (157 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:JavaToCSharpGui.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="JavaToCSharpGui.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
Icon="/Assets/JavaToCSharpIcon.ico"
Title="Java to C# Converter">
<Design.DataContext>
<!-- This only sets the DataContext for the previewer in an IDE,
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
<vm:MainWindowViewModel />
</Design.DataContext>
<Grid>
<Grid Grid.RowDefinitions="*, Auto" Margin="10">
<Grid Grid.Row="0" RowDefinitions="Auto,Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="*,Auto">
<TextBlock TextWrapping="Wrap">
<Span FontWeight="Bold">NOTE:</Span> This tool does a
<Span FontStyle="Italic">syntactic conversion only</Span> from Java
to C#. It does not resolve symbols or namespaces, so the resulting C# code likely will not compile without
modification. You must verify the results of the conversion manually.
</TextBlock>
<StackPanel Grid.Column="1" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Right"
Orientation="Horizontal">
<Button Content="fork me on GitHub!" Command="{CompiledBinding ForkMeOnGitHubCommand}" />
<ToggleSwitch
Grid.Column="1"
Padding="4"
IsCheckedChanged="ToggleButton_OnIsCheckedChanged"
Theme="{DynamicResource ButtonToggleSwitch}">
<ToggleSwitch.OnContent>
<PathIcon
Width="16"
Height="16"
Data="M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM17 15C17.476 15 17.9408 14.9525 18.3901 14.862C17.296 17.3011 14.8464 19 12 19C8.13401 19 5 15.866 5 12C5 8.60996 7.40983 5.78277 10.6099 5.13803C10.218 6.01173 10 6.98041 10 8C10 11.866 13.134 15 17 15Z"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
</ToggleSwitch.OnContent>
<ToggleSwitch.OffContent>
<PathIcon
Width="16"
Height="16"
Data="M3.55 19.09L4.96 20.5L6.76 18.71L5.34 17.29M12 6C8.69 6 6 8.69 6 12S8.69 18 12 18 18 15.31 18 12C18 8.68 15.31 6 12 6M20 13H23V11H20M17.24 18.71L19.04 20.5L20.45 19.09L18.66 17.29M20.45 5L19.04 3.6L17.24 5.39L18.66 6.81M13 1H11V4H13M6.76 5.39L4.96 3.6L3.55 5L5.34 6.81L6.76 5.39M1 13H4V11H1M13 20H11V23H13"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
</ToggleSwitch.OffContent>
</ToggleSwitch>
</StackPanel>
</Grid>
<!-- GroupBox -->
<DockPanel Grid.Row="1">
<Label DockPanel.Dock="Top" FontWeight="Bold" Content="Options" />
<Grid DockPanel.Dock="Bottom" ColumnDefinitions="*,*">
<StackPanel Orientation="Vertical" Margin="0,0,10,0">
<TextBlock Margin="5">Add Usings:</TextBlock>
<Grid ColumnDefinitions="*,Auto">
<TextBox Name="AddUsingInput" Margin="5,2,5,2" Text="{CompiledBinding AddUsingInput}" />
<Button Name="AddUsing" Grid.Column="1" Margin="5,2,5,2"
Command="{CompiledBinding AddUsingCommand}">
Add
</Button>
</Grid>
<ListBox MinHeight="100"
Margin="5"
Name="Usings"
ItemsSource="{CompiledBinding Usings}"
SelectedItem="{CompiledBinding SelectedUsing}">
</ListBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Column="1">
<CheckBox Margin="5" Name="IncludeUsings" IsChecked="{CompiledBinding IncludeUsings}">Include Usings in Output</CheckBox>
<CheckBox Margin="5" Name="IncludeNamespace" IsChecked="{CompiledBinding IncludeNamespace}">Include Namespace in Output</CheckBox>
<CheckBox Margin="5" Name="IncludeComments" IsChecked="{CompiledBinding IncludeComments}">Include Comments in Output</CheckBox>
<CheckBox Margin="5" Name="UseDebugAssertForAsserts"
IsChecked="{CompiledBinding UseDebugAssertForAsserts}">
Use Debug.Assert() for asserts
</CheckBox>
<CheckBox Margin="5" Name="UseUnrecognizedCodeToComment"
IsChecked="{CompiledBinding UseUnrecognizedCodeToComment}">
Use Unrecognized Code To Comment
</CheckBox>
<CheckBox Margin="5" Name="UseFolderConvert" IsChecked="{CompiledBinding UseFolderConvert}">Use Folder Convert</CheckBox>
<CheckBox Margin="5" Name="ConvertSystemOutToConsole"
IsChecked="{CompiledBinding ConvertSystemOutToConsole}">
Convert System.out to Console
</CheckBox>
</StackPanel>
</Grid>
</DockPanel>
<Grid Grid.Row="2" ColumnDefinitions="*,Auto,*">
<Grid RowDefinitions="Auto,Auto,*">
<TextBlock Margin="10">Java Source Code Input:</TextBlock>
<Grid Grid.Row="1" ColumnDefinitions="Auto,*,Auto">
<TextBlock Margin="10,5,10,5">File:</TextBlock>
<TextBox Name="OpenPath" Grid.Column="1" Margin="5" Text="{CompiledBinding OpenPath}" />
<Button Grid.Column="2" Margin="10,5,10,5"
Command="{CompiledBinding OpenFileDialogCommand}" Name="OpenFileDialog">
...
</Button>
</Grid>
<TextBox Name="JavaText"
Text="{CompiledBinding JavaText}"
Grid.Row="2"
Margin="10"
ScrollViewer.VerticalScrollBarVisibility="Visible"
FontFamily="{CompiledBinding MonospaceFontFamily}"
VerticalContentAlignment="Top"
AcceptsReturn="True" />
</Grid>
<Button Grid.Column="1" Name="Convert" IsEnabled="{CompiledBinding IsConvertEnabled}"
Command="{CompiledBinding ConvertCommand}" Height="35" Margin="10">
Convert!
</Button>
<Grid Grid.Column="2" RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto">
<TextBlock Margin="10">C# Output:</TextBlock>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Name="CopiedText" Margin="10" />
<Button Name="CopyOutput"
Margin="10"
Content="{CompiledBinding CopyToClipboardText}"
Command="{CompiledBinding CopyOutputCommand}" />
</StackPanel>
</Grid>
<TextBox Name="CSharpText"
Text="{CompiledBinding CSharpText}"
Grid.Row="1"
Margin="10"
ScrollViewer.VerticalScrollBarVisibility="Visible"
FontFamily="{CompiledBinding MonospaceFontFamily}"
VerticalContentAlignment="Top" />
</Grid>
</Grid>
</Grid>
<!-- StatusBar -->
<DockPanel Grid.Row="1">
<TextBlock Name="ConversionStateLabel" Text="{CompiledBinding ConversionStateLabel}" Margin="10" />
</DockPanel>
</Grid>
<!-- MessageBox -->
<Border Background="DarkGray" IsVisible="{CompiledBinding IsMessageShown}" Opacity="0.5" />
<WrapPanel Opacity="1" HorizontalAlignment="Center" VerticalAlignment="Center"
IsVisible="{CompiledBinding IsMessageShown}">
<Border BorderBrush="Black" BorderThickness="2">
<Grid MinWidth="100" RowDefinitions="Auto,*,Auto" Background="{StaticResource WindowDefaultBackground}">
<Label Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold"
Content="{CompiledBinding MessageTitle}" />
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10" TextWrapping="Wrap"
Grid.Row="1" Text="{CompiledBinding Message}" />
<Button Content="OK" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Center"
Grid.Row="2" Command="{CompiledBinding ClearMessageCommand}" />
</Grid>
</Border>
</WrapPanel>
</Grid>
</Window>