Exemplo n.º 1
0
        public TsViewModel(MainViewModel mvm)
        {
            TsVm = this;
            _mvm = mvm;

            Persistence.Tracker.Configure <TsViewModel>()
            .Id(p => p.WindowName, includeType: false)
            .Properties(p => new { p.Top, p.Left })
            .Property(p => p.Height, 430, "Window Height")
            .Property(p => p.Width, 310, "Window Width")

            .Property(p => p.TsItems, "Saved TS Channel paths")

            .Property(p => p.TsChannelNameText, string.Empty, "Default TS channel")
            .Property(p => p.TsChannelPasswordText, string.Empty, "Default TS password")

            .PersistOn(nameof(PropertyChanged));

            Persistence.Tracker.Track(this);
        }
        public MainViewModel()
        {
            WindowState           = WindowState.Normal;
            IsUpdateVisible       = Visibility.Hidden;
            MfRowHeight           = new GridLength(0);
            IsProgressBarVisible  = Visibility.Hidden;
            IsStopDownloadVisible = Visibility.Hidden;

            new Download(this);
            new Notification(this);
            new Update(this);
            _tsViewModel = new TsViewModel(this);

            Directory.CreateDirectory(Properties.GetArma3FolderPath);
            Directory.CreateDirectory(Properties.GetArma3MissionFolderPath);

            Persistence.Tracker.Configure <MainViewModel>()
            .Id(p => p.WindowName, includeType: false)
            .Property(p => p.Height, 430, "Window Height")
            .Property(p => p.Width, 900, "Window Width")

            .Property(p => p.MissionItems, "Saved Mission File(s)")
            .Property(p => p.IsOrdered, false, "Specify if Server 1 mission file should appear first in the list (S1 mf will download first)")

            .Property(p => p.MfColumnWidth, new GridLength(290, GridUnitType.Pixel), "GridSplitter Column Width")
            .Property(p => p.IgnoredItems, "Ignored Item(s)")

            .Property(p => p.TsSelectorUrlText, "https://grandtheftarma.com/", "TeamSpeak Selector URL")
            .Property(p => p.Servers, "Saved Servers")

            .Property(p => p.IsDeleteIgnoredMfChecked, false, "Delete Ignored Mission File Checkbox")
            .Property(p => p.IsRemoveMfsChecked, false, "Remove old files from the Ignored list if they are no longer available on GTA's Google Drive Checkbox")
            .Property(p => p.IsHideExceptionMissionChecked, false, "Hide any exception messages in Mission tab Checkbox")

            .Property(p => p.IsServerChecked, false, "Join Game Server Automatically Checkbox")
            .Property(p => p.DelayJoinValue, 10, "Delay Join Value (Seconds)")
            .Property(p => p.IsTsChecked, false, "Run TS Automatically Checkbox")
            .Property(p => p.IsHideExceptionServerChecked, false, "Hide any exception messages in Servers tab Checkbox")

            .Property(p => p.ThemeToggleSwitch, false, "Theme")
            .Property(p => p.Accents, "Accent Items")
            .Property(p => p.SelectedAccentIndex, 1, "Selected Accent")
            .Property(p => p.IsStartUpChecked, false, "StartUp Checkbox")
            .Property(p => p.IsHiddenChecked, false, "Hide at Startup Checkbox")
            .Property(p => p.IsUpdateNotifyChecked, true, "Notify when Program is outdated Checkbox")

            .PersistOn(nameof(PropertyChanged));

            Persistence.Tracker.Track(this);

            //Temporarily
            Properties.KeyStartUp.DeleteValue("GTADownloader", false);
            foreach (var item in IgnoredItems)
            {
                if (item.Item == "readme.txt")
                {
                    IgnoredItems.Remove(item);
                    break;
                }
            }
        }