public ActionResult Open(int ID)
        {
            bool isAdmin = new bool();

            if (Request.QueryString["IsAdmin"] != null)
            {
                bool.TryParse(Request.QueryString["IsAdmin"], out isAdmin);
            }
            try
            {
                var solution = _solutionService.GetSolution(ID);
                if (solution != null)
                {
                    _utilityService.OpenDotNETSolution(solution.FilePath, isAdmin);
                }

                try
                {
                    solution.LastTimeOpened = DateTime.Now;
                    _solutionService.SaveSolution();
                }
                catch
                { }

                return(RedirectToAction("Index").WithSuccess(solution.Name + " is being opening.. Happy coding!"));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index").WithError("Error trying to open selected solution. " + ex.Message));
            }
        }
        /// <summary>
        /// This is async because it must wait for the solution to finish its operation(s).
        /// </summary>
        /// <returns></returns>
        public async Task <MvvmToolsSettings> LoadSettings()
        {
            // rval starts out containing default values, exceptLocalTemplateFolder, which is null
            // so we use our DefaultLocalTemplateFolder, which is a subfolder off My Docs.
            var rval = new MvvmToolsSettings
            {
                GoToViewOrViewModelOption         = GetEnum(GoToViewOrViewModelPropName, GoToViewOrViewModelOption.ShowUi),
                GoToViewOrViewModelSearchSolution = GetBool(GoToViewOrViewModelSearchSolutionPropName, true),
                ViewSuffixes        = GetStringCollection(ViewSuffixesPropName, DefaultViewSuffixes),
                LocalTemplateFolder = GetString(LocalTemplateFolderPropName, DefaultLocalTemplateFolder)
            };

            // Get any saved settings

            // Make sure the LocalTemplateFolder setting exists in our saved values.  It might not
            // because the setting is being introduced in version 0.5 of MVVM Tools.
            if (string.IsNullOrWhiteSpace(rval.LocalTemplateFolder))
            {
                rval.LocalTemplateFolder = DefaultLocalTemplateFolder;
            }

            try
            {
                if (!Directory.Exists(rval.LocalTemplateFolder))
                {
                    // This creates all the intermediate folders as well, if they don't exist.
                    Directory.CreateDirectory(rval.LocalTemplateFolder);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine($"In {nameof(SettingsService)}.{nameof(LoadSettings)}(), failed to check existence of or create local template folder.  Value: {rval.LocalTemplateFolder}" + Environment.NewLine + ex);
                await _dialogService.ShowMessage("Error",
                                                 "Couldn't read or create the local template folder, which was:" + Environment.NewLine +
                                                 Environment.NewLine + "\t" + rval.LocalTemplateFolder + Environment.NewLine + ex);

                throw;
            }

            // Get solution's structure.  Waits for solution operations to complete.
            var solution = await _solutionService.GetSolution();

            if (solution == null)
            {
                return(rval);
            }

            // Get options for solution.  Apply global defaults to solution
            // file if it doesn't exist.
            var solutionOptions = GetProjectOptionsFromSettingsFile(solution, SolutionDefaultProjectOptions);

            rval.SolutionOptions = solutionOptions;

            // Get options for each project.  Inherited solution options are
            // applied for each project file if it doesn't exist.
            AddProjectOptionsFlattenedRecursive(solutionOptions, rval.ProjectOptions, solution.Children);

            return(rval);
        }
Example #3
0
        public async Task RedirectToExistingSolution(string rooturl, bool masterPage)
        {
            SolutionInfo solInfo = solutionService.GetSolution(rooturl);

            if (solInfo != null)
            {
                SolutionInfo copy = solInfo.Clone();
                await Store.SetJSONAsync(AppConst.SOLUTION_OBJ, copy);

                App.Settings.CurrentSolution = copy;

                await App.Navigation.NavigateToLogin(masterPage);
            }
        }
Example #4
0
        public ActionResult GetSolution(int id)
        {
            var solution = _solutionService.GetSolution(id);

            return(Ok(solution));
        }