aboutsummaryrefslogtreecommitdiffstats
path: root/WarframeClock/OverlayWindowViewModel.cs
blob: 296cb3ab2b5b8545c518dc6cbbc03c5a05ae5876 (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using System.Windows;
using System.Windows.Media;

namespace WarframeClock
{
    public class OverlayWindowViewModel : BindableBase
    {
        public PlainsTimeOverlayItemViewModel PlainsTimeOverlayItemViewModel { get; } =
            new PlainsTimeOverlayItemViewModel();
        public ArbitrationOverlayItemViewModel ArbitrationOverlayItemViewModel { get; } =
            new ArbitrationOverlayItemViewModel();
        public KuvaFloodOverlayItemViewModel KuvaFloodOverlayItemViewModel { get; } =
            new KuvaFloodOverlayItemViewModel();

        private bool _settingsMode;
        public bool SettingsMode
        {
            get => _settingsMode;
            set
            {
                _settingsMode = value;
                NotifyPropertyChanged();
            }
        }

        #region "App Settings"
        public FontFamily FontFamily => new FontFamily(Settings.FontFamilyName);

        public double FontSize => Settings.FontSize;
        public double FontSizeTiny => Settings.FontSize * 0.4;
        public double FontSizeSmall => Settings.FontSize * 0.5;

        public HorizontalAlignment HorizontalAlignment =>
            Settings.DockToX == Settings.AlignmentX.Left ? HorizontalAlignment.Left : HorizontalAlignment.Right;

        public VerticalAlignment VerticalAlignment =>
            Settings.DockToY == Settings.AlignmentY.Top ? VerticalAlignment.Top : VerticalAlignment.Bottom;

        public Thickness Margin =>
            new Thickness(
                Settings.DockToX == Settings.AlignmentX.Left ? Settings.MarginX : 0.0,
                Settings.DockToY == Settings.AlignmentY.Top ? Settings.MarginY : 0.0,
                Settings.DockToX == Settings.AlignmentX.Right ? Settings.MarginX : 0.0,
                Settings.DockToY == Settings.AlignmentY.Bottom ? Settings.MarginY : 0.0);

        public void RefreshPosition()
        {
            NotifyPropertyChanged(nameof(HorizontalAlignment));
            NotifyPropertyChanged(nameof(VerticalAlignment));
            NotifyPropertyChanged(nameof(Margin));
        }

        public void RefreshFont()
        {
            NotifyPropertyChanged(nameof(FontFamily));
            NotifyPropertyChanged(nameof(FontSize));
            NotifyPropertyChanged(nameof(FontSizeSmall));
            NotifyPropertyChanged(nameof(FontSizeTiny));
        }

        public bool ShowArbitration
        {
            get => Settings.ShowArbitration;
            set
            {
                Settings.ShowArbitration = value;
                NotifyPropertyChanged();
            }
        }

        public bool ShowKuvaFlood
        {
            get => Settings.ShowKuvaFlood;
            set
            {
                Settings.ShowKuvaFlood = value;
                NotifyPropertyChanged();
            }
        }

        public bool Standalone
        {
            get => Settings.Standalone;
            set
            {
                Settings.Standalone = value;
                NotifyPropertyChanged();
            }
        }

        public bool StandaloneAlwaysOnTop
        {
            get => Settings.StandaloneAlwaysOnTop;
            set
            {
                Settings.StandaloneAlwaysOnTop = value;
                NotifyPropertyChanged();
            }
        }
        #endregion

        public void Refresh()
        {
            PlainsTimeOverlayItemViewModel.Refresh();
            ArbitrationOverlayItemViewModel.Refresh();
            KuvaFloodOverlayItemViewModel.Refresh();
        }
    }
}