Skip to content

Commit 540fd48

Browse files
Initial commands setup with dummy values in Model
1 parent ad26dc8 commit 540fd48

File tree

6 files changed

+376
-209
lines changed

6 files changed

+376
-209
lines changed

Samples/StyleTransfer/AppModel.cs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Diagnostics;
5+
using System.Linq;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices.WindowsRuntime;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
using Windows.Media.Core;
11+
12+
namespace StyleTransfer
13+
{
14+
class AppModel : INotifyPropertyChanged
15+
{
16+
private string _modelSource; // Not initialized vs. have a default model to use?
17+
public string ModelSource
18+
{
19+
get { return _modelSource; }
20+
set
21+
{
22+
_modelSource = value;
23+
OnPropertyChanged();
24+
}
25+
}
26+
27+
private string _inputMediaSource;
28+
public string InputMediaSource
29+
{
30+
get { return _inputMediaSource; }
31+
set
32+
{
33+
_inputMediaSource = value;
34+
OnPropertyChanged();
35+
}
36+
}
37+
38+
private bool _useGPU;
39+
public bool UseGPU
40+
{
41+
get { return _useGPU; }
42+
set
43+
{
44+
_useGPU = value;
45+
OnPropertyChanged();
46+
}
47+
}
48+
49+
public event PropertyChangedEventHandler PropertyChanged;
50+
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
51+
{
52+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
53+
}
54+
55+
public AppModel()
56+
{
57+
this._useGPU = true;
58+
}
59+
60+
}
61+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows.Input;
8+
using Windows.Media.Core;
9+
10+
namespace StyleTransfer
11+
{
12+
class AppViewModel : INotifyPropertyChanged
13+
{
14+
private AppModel _appModel;
15+
public AppModel CurrentApp
16+
{
17+
get { return _appModel; }
18+
}
19+
20+
private ICommand _saveCommand;
21+
public ICommand SaveCommand
22+
{
23+
get { return _saveCommand; }
24+
set
25+
{
26+
_saveCommand = value;
27+
}
28+
}
29+
30+
public ICommand MediaSourceCommand { get; set; }
31+
32+
public event PropertyChangedEventHandler PropertyChanged;
33+
public AppViewModel()
34+
{
35+
_appModel = new AppModel();
36+
SaveCommand = new RelayCommand(new Action<object>(SaveOutput));
37+
MediaSourceCommand = new RelayCommand(new Action<object>(SetMediaSource));
38+
}
39+
40+
public void SaveOutput(object obj)
41+
{
42+
return;
43+
}
44+
public void SetMediaSource(object obj)
45+
{
46+
_appModel.InputMediaSource = obj.ToString();
47+
return;
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)