Example #1
0
        public override Task ActivateAsync()
        {
            try
            {
                Installations.Clear();

                foreach (var install in _settingsService.GetInstallations())
                {
                    Installations.Add(new InstallLocationModel(install));
                }

                if (Installations.Any())
                {
                    Installations[0].IsDefault.Value = true;
                }
            }
            catch (Exception e)
            {
                Tracer.Error(e);
            }
            finally
            {
                IsLoading.Value = false;
            }

            return(base.ActivateAsync());
        }
Example #2
0
        // TODO: This service should create the Installation itself
        /// <summary>
        /// Adds the installation if an installation with the same path doesn't already exist.
        /// </summary>
        /// <param name="install">The install.</param>
        /// <returns>If the install was added sucessfully</returns>
        public bool TryAddInstallation(IInstallation install)
        {
            if (install == null)
            {
                return(false);
            }

            if (Installations.Any(testInstall => install.Path.NormalizePath() == testInstall.Path.NormalizePath()))
            {
                return(false);
            }

            Installations.Add(install);
            return(true);
        }
Example #3
0
        public override bool Validate()
        {
            if (Installations.Any() && Installations.Count(i => i.IsDefault.Value) == 0)
            {
                var window = WindowAssist.GetWindow(Controller);
                MessageBoxEx.Show("You must set a default installation to continue.", "Default Installations", MessageBoxButton.OK, parent: window);
                return(false);
            }

            if (Installations.Count(i => i.ConcreteInstall.IsValidInstall) == 0)
            {
                var window = WindowAssist.GetWindow(Controller);
                return(MessageBoxEx.Show("No valid DCS World installations were found.   Are you sure you want to continue?", "Installations", MessageBoxButton.YesNo, parent: window) == MessageBoxResult.Yes);
            }

            return(base.Validate());
        }