Skip to content

Commit

Permalink
Merge pull request #23 from haruki1234/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bem130 authored Mar 1, 2022
2 parents a684e7d + b32ff39 commit 6830c6e
Show file tree
Hide file tree
Showing 15 changed files with 162 additions and 115 deletions.
6 changes: 6 additions & 0 deletions typing/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<setting name="keyboard_dir" serializeAs="String">
<value />
</setting>
<setting name="username" serializeAs="String">
<value />
</setting>
<setting name="posturl" serializeAs="String">
<value />
</setting>
</typing.Properties.Settings>
</userSettings>
</configuration>
11 changes: 7 additions & 4 deletions typing/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,24 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="35"/>
<RowDefinition />
<RowDefinition Height="25"/>
<RowDefinition Height="40"/>
<RowDefinition Height="2"/>
</Grid.RowDefinitions>
<TextBlock x:Name="title" Grid.Row="0" FontSize="30" TextAlignment="left" Height="60" Padding="10,10,10,10" VerticalAlignment="Top" Foreground="{DynamicResource cFontcolor}" Background="{DynamicResource cTopbarBackground}" FontFamily="Noto Sans Light,Noto Sans JP">Typing - Home</TextBlock>
<Button Click="Go_title" FontSize="15" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="3" Style="{DynamicResource Button}">タイトル</Button>
<Button Click="Go_setting" FontSize="15" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="2" Style="{DynamicResource Button}">設定</Button>
<Grid Grid.Row="1" Margin="76,20,76,20">
<TextBlock x:Name="messagea" Grid.Row="1" FontSize="24" TextAlignment="left" Height="30" Padding="0,3,0,0" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}" FontFamily="Noto Sans Light,Noto Sans JP" HorizontalAlignment="Center">Hi!</TextBlock>

<Button Click="Go_title" FontSize="15" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="4" Style="{DynamicResource Button}">タイトル</Button>
<Button Click="Go_setting" FontSize="15" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="3" Style="{DynamicResource Button}">設定</Button>
<Grid Grid.Row="2" Margin="76,10,76,10">
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Grid Background="White">
<Grid Background="White" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="*"/>
Expand Down
12 changes: 11 additions & 1 deletion typing/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ public HomePage()
Menu.SelectionMode = System.Windows.Controls.SelectionMode.Multiple;
makemenu();

string username;
if (Properties.Settings.Default.username == "")
{
username = "ゲスト";
}
else
{
username = Properties.Settings.Default.username;
}
Application.Current.Properties["UserName"] = username;
messagea.Text = username+"さん "+"こんにちは!";
}

public void setcolortheme()
Expand Down Expand Up @@ -98,7 +109,6 @@ private void start(object sender, RoutedEventArgs e)
}

Application.Current.Properties["FilePaths"] = string.Join("|", menupath);
Debug.Print("filepaths " + Application.Current.Properties["FilePaths"]);
var tpage = new PlayPage();
NavigationService.Navigate(tpage);
}
Expand Down
12 changes: 0 additions & 12 deletions typing/LogWindow.xaml

This file was deleted.

43 changes: 0 additions & 43 deletions typing/LogWindow.xaml.cs

This file was deleted.

3 changes: 2 additions & 1 deletion typing/PlayPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,10 @@ private void PlaySound(string path)
/// <summary>
/// 一時停止
/// </summary>
private void Pause_button(object sender, RoutedEventArgs e)
async private void Pause_button(object sender, RoutedEventArgs e)
{
pause();
await Task.Delay(10);
kinput.Focus();
}
private void Resume_button(object sender, RoutedEventArgs e)
Expand Down
6 changes: 3 additions & 3 deletions typing/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("typing")]
[assembly: AssemblyDescription("typing game of desktop")]
[assembly: AssemblyDescription("typing game")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("haruki1234")]
[assembly: AssemblyProduct("neknaj.typing")]
Expand Down Expand Up @@ -51,5 +51,5 @@
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.5")]
[assembly: AssemblyFileVersion("1.1.0.5")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
24 changes: 24 additions & 0 deletions typing/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions typing/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@
<Setting Name="keyboard_dir" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="username" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="posturl" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
4 changes: 3 additions & 1 deletion typing/ResultPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="230"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="50,0,50,0" ShowGridLines="True">
<Grid.RowDefinitions>
Expand Down Expand Up @@ -68,7 +69,8 @@
<TextBlock x:Name="typecntv" Grid.Row="4" Grid.Column="1" FontSize="25" HorizontalAlignment="Center" Foreground="{DynamicResource cFontcolor}">0</TextBlock>
<TextBlock x:Name="miscntv" Grid.Row="5" Grid.Column="1" FontSize="25" HorizontalAlignment="Center" Foreground="{DynamicResource cFontcolor}">0</TextBlock>
</Grid>
<Button Click="copyr_text" FontSize="20" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="1" Grid.ColumnSpan="2" Content="結果をコピー (テキスト)" Style="{DynamicResource Button}"/>
<Button Click="post" FontSize="20" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="1" Grid.ColumnSpan="2" Content="結果をポスト (テキスト)" Style="{DynamicResource Button}"/>
<Button Click="copyr_text" FontSize="20" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="2" Grid.ColumnSpan="2" Content="結果をコピー (テキスト)" Style="{DynamicResource Button}"/>
</Grid>

</ScrollViewer>
Expand Down
42 changes: 40 additions & 2 deletions typing/ResultPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Web;
using System.Net;
using System.Net.Http;
using System.Diagnostics;

namespace typing
{
Expand All @@ -21,11 +25,19 @@ namespace typing
public partial class ResultPage : Page
{
string date;

string aname;
string aversion;
public ResultPage()
{
date = DateTime.Now.ToString();
InitializeComponent();
setcolortheme();

System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
aname = asm.GetName().Name;
aversion = asm.GetName().Version.ToString();

show();
}
public void setcolortheme()
Expand All @@ -45,11 +57,12 @@ private void Go_home(object sender, RoutedEventArgs e)
var tpage = new HomePage();
NavigationService.Navigate(tpage);
}
private void copyr_text(object sender, RoutedEventArgs e)
private void copyr_text()
{
string resdic = "`~~~~~~~~~~~~`\n" + "[" + date + "]\n" + sdic_to_string(calcr(get(),1),":","\n") + "`~~~~~~~~~~~~`";
string resdic = aname+" v"+aversion+"\n"+"`~~~~~~~~~~~~` \n"+"["+date+"]\n"+sdic_to_string(calcr(get(), 1), ":", "\n")+"`~~~~~~~~~~~~`";
Clipboard.SetData(DataFormats.Text, resdic);
}
private void copyr_text(object sender, RoutedEventArgs e) {copyr_text();}
public Dictionary<string,string> calcr(Dictionary<string, string> dic,int _case=0)
{

Expand Down Expand Up @@ -133,5 +146,30 @@ private double cutnumber(double num, int len)
{
return ((double)((int)(num*len))/len);
}

async public void post()
{
string resdic = "`~~~~~~~~~~~~` \n"+"["+date+"]\n"+sdic_to_string(calcr(get(), 1), ":", "\n")+"`~~~~~~~~~~~~`";

var parameters = new Dictionary<string, string>()
{
{ "username", (string)Application.Current.Properties["UserName"] + " - " + aname+" v"+aversion},
{ "content", resdic },
};
var content = new FormUrlEncodedContent(parameters);

using (var client = new HttpClient())
{
try
{
var response = await client.PostAsync(Properties.Settings.Default.posturl, content);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Send fails");
}
}
}
private void post(object sender, RoutedEventArgs e) { post(); }
}
}
61 changes: 37 additions & 24 deletions typing/SettingPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,48 @@
<Button Click="cancel" FontSize="15" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="3" Style="{DynamicResource Button}">変更を破棄</Button>
<Button Click="save" FontSize="15" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="4" Style="{DynamicResource Button}">保存</Button>
<Button Click="save_Go_home" FontSize="15" FontFamily="Noto Sans Light,Noto Sans JP" Grid.Row="5" Style="{DynamicResource Button}">保存してホーム</Button>
<Grid Grid.Row="1" Margin="76,20,76,0" ShowGridLines="False">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="220"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>

<TextBlock Grid.Row="0" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">標準の問題フォルダ</TextBlock>
<TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" FontSize="20" Height="30" x:Name="serchdir"/>
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" CanContentScroll="True" Margin="76,20,76,0">
<Grid ShowGridLines="False">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="220"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>

<TextBlock Grid.Row="1" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">キーボードのファイル</TextBlock>
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" FontSize="20" Height="30" x:Name="keyboarddir"/>
<TextBlock Grid.Row="0" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">ユーザー名</TextBlock>
<TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" FontSize="20" Height="30" x:Name="username"/>

<TextBlock Grid.Row="2" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">表示サイズ</TextBlock>
<Slider Grid.Row="2" Grid.Column="1" Width="200" VerticalAlignment="Center" x:Name="scale" Minimum="0.5" Maximum="1.7" IsSnapToTickEnabled="True" TickFrequency="0.01" SmallChange="0.05" LargeChange="0.1"/>
<TextBlock Grid.Row="2" Grid.Column="2" x:Name="show_scale" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16">
<TextBlock Grid.Row="1" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">標準の問題フォルダ</TextBlock>
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" FontSize="20" Height="30" x:Name="serchdir"/>

<TextBlock Grid.Row="2" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">キーボードのファイル</TextBlock>
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" FontSize="20" Height="30" x:Name="keyboarddir"/>

<TextBlock Grid.Row="3" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">表示サイズ</TextBlock>
<Slider Grid.Row="3" Grid.Column="1" Width="200" VerticalAlignment="Center" x:Name="scale" Minimum="0.5" Maximum="1.7" IsSnapToTickEnabled="True" TickFrequency="0.01" SmallChange="0.05" LargeChange="0.1"/>
<TextBlock Grid.Row="3" Grid.Column="2" x:Name="show_scale" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16">
<Run Text="{Binding ElementName=scale,Path=Value}"/>
<Run Text=""/>
</TextBlock>
</TextBlock>

<TextBlock Grid.Row="4" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">カラーテーマ</TextBlock>
<ComboBox Grid.Row="4" Grid.Column="1" HorizontalAlignment="Center" Grid.ColumnSpan="2" x:Name="colortheme" VerticalAlignment="Center" Width="250" SelectedValuePath="Key" DisplayMemberPath="Value" />


<TextBlock Grid.Row="5" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">POSTするURL</TextBlock>
<TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" FontSize="20" Height="30" x:Name="posturl"/>

<TextBlock Grid.Row="3" Grid.Column="0" FontSize="20" VerticalAlignment="Center" Foreground="{DynamicResource cFontcolor}">カラーテーマ</TextBlock>
<ComboBox Grid.Row="3" Grid.Column="1" HorizontalAlignment="Center" Grid.ColumnSpan="2" x:Name="colortheme" VerticalAlignment="Center" Width="250" SelectedValuePath="Key" DisplayMemberPath="Value" />
</Grid>
</Grid>
</ScrollViewer>
</Grid>
</Page>
Loading

0 comments on commit 6830c6e

Please sign in to comment.