Example #1
0
        public async void SetDefaultValues()
        {
            var id = 100_000;

            // Find an unused id

            await Task.Run(() =>
            {
                while (_modsRepository.Find(id) != null)
                {
                    id++;
                }
            });

            // Set default values
            SelectedCategory = Category.Level;
            ChangedThings    = "";
            Mod = new Mod {
                Id = id, IsUserAdded = true
            };

            // Set event listeners for notifying change
            Mod.PropertyChanged         -= ModOnPropertyChanged;
            Mod.PropertyChanged         += ModOnPropertyChanged;
            Mod.Files.CollectionChanged -= FilesOnCollectionChanged;
            Mod.Files.CollectionChanged += FilesOnCollectionChanged;
        }
Example #2
0
        private async Task SetInformation()
        {
            UpdateAvailable = Release.UpdateAvailable;

            if (Downloaded)
            {
                Mod = _downloadedMods.Find(_model.Category, _model.ReleaseInfo);
                foreach (var file in Mod.Files)
                {
                    file.PropertyChanged -= FileOnPropertyChanged;
                    file.PropertyChanged += FileOnPropertyChanged;
                }
            }

            if (Retreivable())
            {
                Status    = "Available to use.";
                Available = true;
            }

            else
            {
                Status = "This cannot be automatically implemented. " +
                         "To use, download and set up manually.";
                Available = false;
            }

            Index = 0;
            Image = "";

            if (_model.Refresh)
            {
                await _modService.UpdateRelease(_model.ReleaseInfo);

                Release = await _modService.RequestRelease(_model.ReleaseInfo);

                Downloaded = _downloadedMods.Contains(_model.Category, Release);
            }

            if (UpdateAvailable)
            {
                Status = "An update is available.";
            }
        }