Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
L
lottokone
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
M1888
lottokone
Commits
29acc7dd
Commit
29acc7dd
authored
Apr 16, 2019
by
M1888
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
16.4
parent
e20e8b43
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
67 additions
and
15 deletions
+67
-15
Lottokone/App.config
Lottokone/App.config
+3
-0
Lottokone/Asetukset.xaml
Lottokone/Asetukset.xaml
+20
-5
Lottokone/Asetukset.xaml.cs
Lottokone/Asetukset.xaml.cs
+6
-0
Lottokone/Model/Lotto.cs
Lottokone/Model/Lotto.cs
+8
-3
Lottokone/Model/Lottorivi.cs
Lottokone/Model/Lottorivi.cs
+6
-0
Lottokone/Model/Pelaaja.cs
Lottokone/Model/Pelaaja.cs
+6
-4
Lottokone/ObservableCollectionEx.cs
Lottokone/ObservableCollectionEx.cs
+3
-3
Lottokone/Properties/Settings.Designer.cs
Lottokone/Properties/Settings.Designer.cs
+12
-0
Lottokone/Properties/Settings.settings
Lottokone/Properties/Settings.settings
+3
-0
No files found.
Lottokone/App.config
View file @
29acc7dd
...
@@ -13,6 +13,9 @@
...
@@ -13,6 +13,9 @@
<
setting
name
=
"Pelaajia"
serializeAs
=
"String"
>
<
setting
name
=
"Pelaajia"
serializeAs
=
"String"
>
<
value
>
100000
</
value
>
<
value
>
100000
</
value
>
</
setting
>
</
setting
>
<
setting
name
=
"Riveja"
serializeAs
=
"String"
>
<
value
>
5
</
value
>
</
setting
>
</
Lottokone
.
Properties
.
Settings
>
</
Lottokone
.
Properties
.
Settings
>
</
userSettings
>
</
userSettings
>
</
configuration
>
</
configuration
>
\ No newline at end of file
Lottokone/Asetukset.xaml
View file @
29acc7dd
...
@@ -7,18 +7,33 @@
...
@@ -7,18 +7,33 @@
mc:Ignorable="d"
mc:Ignorable="d"
Title="Asetukset" Height="450" Width="800">
Title="Asetukset" Height="450" Width="800">
<Grid>
<Grid>
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<StackPanel Width="
25
0" x:Name="spSettings">
<StackPanel Width="
30
0" x:Name="spSettings">
<Label FontWeight="Bold">Simulaation asetukset</Label>
<Label FontWeight="Bold">Simulaation asetukset</Label>
<StackPanel Margin="5" Orientation="Horizontal">
<StackPanel>
<Label>Pelaajia</Label>
<StackPanel Margin="5" Orientation="Horizontal">
<TextBox Margin="5" x:Name="txbPelaajia" Text="{Binding Pelaajia, Mode=TwoWay}" />
<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>
<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>
<StackPanel>
<StackPanel>
<Label FontWeight="Bold">Omat rivit</Label>
<Label FontWeight="Bold">Omat rivit</Label>
</StackPanel>
</StackPanel>
</StackPanel>
<Button x:Name="btnSave" Content="Tallenna & sulje" Click="btnSave_Click" Margin="15" />
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</Window>
</Window>
Lottokone/Asetukset.xaml.cs
View file @
29acc7dd
...
@@ -26,5 +26,11 @@ namespace Lottokone
...
@@ -26,5 +26,11 @@ namespace Lottokone
InitializeComponent
();
InitializeComponent
();
spSettings
.
DataContext
=
Properties
.
Settings
.
Default
;
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
...
@@ -114,6 +114,8 @@ namespace Lottokone.Model
Voittorivi
=
new
Voittorivi
();
Voittorivi
=
new
Voittorivi
();
StatusHistory
=
new
ObservableCollectionEx
<
string
>(
new
List
<
String
>());
StatusHistory
=
new
ObservableCollectionEx
<
string
>(
new
List
<
String
>());
Status
=
"Alustetaan pelaajia..."
;
Status
=
"Alustetaan pelaajia..."
;
for
(
int
i
=
0
;
i
<
Properties
.
Settings
.
Default
.
Pelaajia
;
i
++)
for
(
int
i
=
0
;
i
<
Properties
.
Settings
.
Default
.
Pelaajia
;
i
++)
{
{
Pelaaja
p
=
new
Pelaaja
();
Pelaaja
p
=
new
Pelaaja
();
...
@@ -128,11 +130,14 @@ namespace Lottokone.Model
...
@@ -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
...
@@ -10,5 +10,11 @@ namespace Lottokone.Model
{
{
public
short
Viikko
{
get
;
set
;
}
public
short
Viikko
{
get
;
set
;
}
public
short
Voimassa
{
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
...
@@ -32,12 +32,14 @@ namespace Lottokone.Model
public
void
Tick
()
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;
...
@@ -4,10 +4,10 @@ using System.Collections.ObjectModel;
using
System.Collections.Specialized
;
using
System.Collections.Specialized
;
using
System.Windows.Threading
;
using
System.Windows.Threading
;
/* Kopioitu täältä:
/* Thread-safe ObservableCollection
* https://www.codeproject.com/Tips/414407/Thread-Safe-Improvement-for-ObservableCollection
*
*
* ObservableCollection, joka toimii threadeissa
* Kopioitu täältä:
* https://www.codeproject.com/Tips/414407/Thread-Safe-Improvement-for-ObservableCollection
*/
*/
namespace
Custom.Collections
namespace
Custom.Collections
...
...
Lottokone/Properties/Settings.Designer.cs
View file @
29acc7dd
...
@@ -34,5 +34,17 @@ namespace Lottokone.Properties {
...
@@ -34,5 +34,17 @@ namespace Lottokone.Properties {
this
[
"Pelaajia"
]
=
value
;
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 @@
...
@@ -5,5 +5,8 @@
<Setting
Name=
"Pelaajia"
Type=
"System.Int32"
Scope=
"User"
>
<Setting
Name=
"Pelaajia"
Type=
"System.Int32"
Scope=
"User"
>
<Value
Profile=
"(Default)"
>
100000
</Value>
<Value
Profile=
"(Default)"
>
100000
</Value>
</Setting>
</Setting>
<Setting
Name=
"Riveja"
Type=
"System.Int32"
Scope=
"User"
>
<Value
Profile=
"(Default)"
>
5
</Value>
</Setting>
</Settings>
</Settings>
</SettingsFile>
</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