Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
M1888
lottokone
Commits
29acc7dd
Commit
29acc7dd
authored
Apr 16, 2019
by
M1888
Browse files
16.4
parent
e20e8b43
Changes
9
Hide whitespace changes
Inline
Side-by-side
Lottokone/App.config
View file @
29acc7dd
...
...
@@ -13,6 +13,9 @@
<
setting
name
=
"Pelaajia"
serializeAs
=
"String"
>
<
value
>
100000
</
value
>
</
setting
>
<
setting
name
=
"Riveja"
serializeAs
=
"String"
>
<
value
>
5
</
value
>
</
setting
>
</
Lottokone
.
Properties
.
Settings
>
</
userSettings
>
</
configuration
>
\ No newline at end of file
Lottokone/Asetukset.xaml
View file @
29acc7dd
...
...
@@ -7,18 +7,33 @@
mc:Ignorable="d"
Title="Asetukset" Height="450" Width="800">
<Grid>
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Width="
25
0" x:Name="spSettings">
<StackPanel Width="
30
0" x:Name="spSettings">
<Label FontWeight="Bold">Simulaation asetukset</Label>
<StackPanel Margin="5" Orientation="Horizontal">
<Label>Pelaajia</Label>
<TextBox Margin="5" x:Name="txbPelaajia" Text="{Binding Pelaajia, Mode=TwoWay}" />
<StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<Label>Pelaajia</Label>
<TextBox Margin="5" x:Name="txbPelaajia" Text="{Binding Pelaajia, Mode=TwoWay}" Width="150" />
</StackPanel>
<Label Margin="25,-5,0,0" FontSize="10">Simulaatiossa käytettävien pelaajien määrä.</Label>
</StackPanel>
<StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<Label>Rivejä</Label>
<TextBox Margin="5" x:Name="txbRiveja" Text="{Binding Riveja, Mode=TwoWay}" Width="150" />
</StackPanel>
<Label Margin="25,-5,0,0" FontSize="10">Simuloitujen pelaajien rivien määrä per pelaaja.</Label>
</StackPanel>
</StackPanel>
<StackPanel>
<Label FontWeight="Bold">Omat rivit</Label>
</StackPanel>
</StackPanel>
<Button x:Name="btnSave" Content="Tallenna & sulje" Click="btnSave_Click" Margin="15" />
</StackPanel>
</Grid>
</Window>
Lottokone/Asetukset.xaml.cs
View file @
29acc7dd
...
...
@@ -26,5 +26,11 @@ namespace Lottokone
InitializeComponent
();
spSettings
.
DataContext
=
Properties
.
Settings
.
Default
;
}
private
void
btnSave_Click
(
object
sender
,
RoutedEventArgs
e
)
{
Properties
.
Settings
.
Default
.
Save
();
this
.
Close
();
}
}
}
Lottokone/Model/Lotto.cs
View file @
29acc7dd
...
...
@@ -114,6 +114,8 @@ namespace Lottokone.Model
Voittorivi
=
new
Voittorivi
();
StatusHistory
=
new
ObservableCollectionEx
<
string
>(
new
List
<
String
>());
Status
=
"Alustetaan pelaajia..."
;
for
(
int
i
=
0
;
i
<
Properties
.
Settings
.
Default
.
Pelaajia
;
i
++)
{
Pelaaja
p
=
new
Pelaaja
();
...
...
@@ -128,11 +130,14 @@ namespace Lottokone.Model
}
}
public
void
LisaaPelaajia
(
int
maar
a
)
public
void
LisaaPelaajia
(
int
pelaajia
,
int
rivej
a
)
{
for
(
int
i
=
0
;
i
<
maar
a
;
i
++)
for
(
int
i
=
0
;
i
<
pelaaji
a
;
i
++)
{
Pelaajat
.
Add
(
new
Pelaaja
());
for
(
int
j
=
0
;
j
<
riveja
;
j
++)
{
Pelaajat
.
Add
(
new
Pelaaja
());
}
}
}
...
...
Lottokone/Model/Lottorivi.cs
View file @
29acc7dd
...
...
@@ -10,5 +10,11 @@ namespace Lottokone.Model
{
public
short
Viikko
{
get
;
set
;
}
public
short
Voimassa
{
get
;
set
;
}
public
Lottorivi
()
:
base
()
{
// oletuksena rivit voimassa yhden arvonnan
Voimassa
=
1
;
}
}
}
Lottokone/Model/Pelaaja.cs
View file @
29acc7dd
...
...
@@ -32,12 +32,14 @@ namespace Lottokone.Model
public
void
Tick
()
{
foreach
(
R
ivi
r
in
Rivit
)
foreach
(
Lottor
ivi
r
in
Rivit
)
{
r
.
Voimassa
--;
if
(
r
.
Voimassa
<
0
)
{
Rivit
.
Remove
(
r
);
}
}
}
}
}
Lottokone/ObservableCollectionEx.cs
View file @
29acc7dd
...
...
@@ -4,10 +4,10 @@ using System.Collections.ObjectModel;
using
System.Collections.Specialized
;
using
System.Windows.Threading
;
/* Kopioitu täältä:
* https://www.codeproject.com/Tips/414407/Thread-Safe-Improvement-for-ObservableCollection
/* Thread-safe ObservableCollection
*
* ObservableCollection, joka toimii threadeissa
* Kopioitu täältä:
* https://www.codeproject.com/Tips/414407/Thread-Safe-Improvement-for-ObservableCollection
*/
namespace
Custom.Collections
...
...
Lottokone/Properties/Settings.Designer.cs
View file @
29acc7dd
...
...
@@ -34,5 +34,17 @@ namespace Lottokone.Properties {
this
[
"Pelaajia"
]
=
value
;
}
}
[
global
::
System
.
Configuration
.
UserScopedSettingAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Configuration
.
DefaultSettingValueAttribute
(
"5"
)]
public
int
Riveja
{
get
{
return
((
int
)(
this
[
"Riveja"
]));
}
set
{
this
[
"Riveja"
]
=
value
;
}
}
}
}
Lottokone/Properties/Settings.settings
View file @
29acc7dd
...
...
@@ -5,5 +5,8 @@
<Setting
Name=
"Pelaajia"
Type=
"System.Int32"
Scope=
"User"
>
<Value
Profile=
"(Default)"
>
100000
</Value>
</Setting>
<Setting
Name=
"Riveja"
Type=
"System.Int32"
Scope=
"User"
>
<Value
Profile=
"(Default)"
>
5
</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment