-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathGameProfileWindow.xaml.fs
79 lines (63 loc) · 2.54 KB
/
GameProfileWindow.xaml.fs
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
// ModelMod: 3d data snapshotting & substitution program.
// Copyright(C) 2015,2016 John Quigley
// This program is free software : you can redistribute it and / or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
// GNU General Public License for more details.
// You should have received a copy of the GNU Lesser General Public License
// along with this program.If not, see <http://www.gnu.org/licenses/>.
namespace MMLaunch
open System
open System.Diagnostics
open System.Threading
open System.Windows
open System.Windows.Threading
open System.IO
open FSharp.ViewModule
open FSharp.ViewModule.Validation
open System.Windows.Input
open System.ComponentModel
open System.Collections.ObjectModel
open Microsoft.Win32
open FsXaml
open ViewModelUtil
open ModelMod
open ModelMod.CoreTypes
type GameProfileView = XAML<"GameProfileWindow.xaml", true>
type GameProfileViewModel() =
inherit ViewModelBase()
// The viewmodel is also the actual Model for the GameProfile
let mutable profile = {
GameProfile.ReverseNormals = false
UpdateTangentSpace = true
CommandLineArguments = ""
DataPathName = ""
}
let mutable profileChangedCb: GameProfile -> unit = ignore
let updateProfile newProfile =
profile <- newProfile
profileChangedCb profile
member x.Profile
with get() = profile
and set value =
profile <- value
x.RaisePropertyChanged(String.Empty)
member x.ProfileChangedCb
with get() = profileChangedCb
and set value = profileChangedCb <- value
member x.ReverseNormals
with get () = profile.ReverseNormals
and set (value:bool) = updateProfile { profile with ReverseNormals = value }
member x.UpdateTangentSpace
with get() = profile.UpdateTangentSpace
and set (value:bool) = updateProfile { profile with UpdateTangentSpace = value }
member x.CommandLineArguments
with get () = profile.CommandLineArguments
and set (value:string) = updateProfile { profile with CommandLineArguments = value}
member x.DataPathName
with get() = profile.DataPathName
and set (value:string) = updateProfile { profile with DataPathName = value }