/// <summary>
        /// Show detailed information about a crash.
        /// </summary>
        /// <param name="crashesForm">A form of user data passed up from the client.</param>
        /// <param name="id">The unique id of the crash we wish to show the details of.</param>
        /// <returns>A view to show crash details.</returns>
        public ActionResult Show(FormCollection crashesForm, int id)
        {
            using (var logTimer = new FAutoScopedLogTimer(this.GetType().ToString() + "(CrashId=" + id + ")", bCreateNewLog: true))
            {
                CallStackContainer currentCallStack = null;

                // Update the selected crash based on the form contents
                var currentCrash = _unitOfWork.CrashRepository.GetById(id);

                if (currentCrash == null)
                {
                    return(RedirectToAction("Index"));
                }

                string FormValue;

                FormValue = crashesForm["SetStatus"];
                if (!string.IsNullOrEmpty(FormValue))
                {
                    currentCrash.Status = FormValue;
                }

                FormValue = crashesForm["SetFixedIn"];
                if (!string.IsNullOrEmpty(FormValue))
                {
                    currentCrash.FixedChangeList = FormValue;
                }

                FormValue = crashesForm["SetTTP"];
                if (!string.IsNullOrEmpty(FormValue))
                {
                    currentCrash.Jira = FormValue;
                }

                // Valid to set description to an empty string
                FormValue = crashesForm["Description"];
                if (FormValue != null)
                {
                    currentCrash.Description = FormValue;
                }

                currentCallStack    = new CallStackContainer(currentCrash);
                currentCrash.Module = currentCallStack.GetModuleName();

                //Set call stack properties
                currentCallStack.bDisplayModuleNames          = true;
                currentCallStack.bDisplayFunctionNames        = true;
                currentCallStack.bDisplayFileNames            = true;
                currentCallStack.bDisplayFilePathNames        = true;
                currentCallStack.bDisplayUnformattedCallStack = false;

                currentCrash.CallStackContainer = new CallStackContainer(currentCrash);

                var Model = new CrashViewModel {
                    Crash = currentCrash, CallStack = currentCallStack
                };
                Model.GenerationTime = logTimer.GetElapsedSeconds().ToString("F2");
                return(View("Show", Model));
            }
        }
Exemplo n.º 2
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            CrashViewModel viewModel = new CrashViewModel();

            this.BindingContext = viewModel;
            await viewModel.Refresh();
        }
        /// <summary>
        /// Show detailed information about a crash.
        /// </summary>
        /// <param name="CrashesForm">A form of user data passed up from the client.</param>
        /// <param name="id">The unique id of the crash we wish to show the details of.</param>
        /// <returns>A view to show crash details.</returns>
        public ActionResult Show(FormCollection CrashesForm, int id)
        {
            using (FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer(this.GetType().ToString() + "(CrashId=" + id + ")", bCreateNewLog: true))
            {
                CrashRepository Crashes = new CrashRepository();

                CallStackContainer CurrentCallStack = null;

                // Update the selected crash based on the form contents
                Crash CurrentCrash = Crashes.GetCrash(id);

                if (CurrentCrash == null)
                {
                    return(RedirectToAction(""));
                }

                string FormValue;

                FormValue = CrashesForm["SetStatus"];
                if (!string.IsNullOrEmpty(FormValue))
                {
                    CurrentCrash.Status = FormValue;
                }

                FormValue = CrashesForm["SetFixedIn"];
                if (!string.IsNullOrEmpty(FormValue))
                {
                    CurrentCrash.FixedChangeList = FormValue;
                }

                FormValue = CrashesForm["SetTTP"];
                if (!string.IsNullOrEmpty(FormValue))
                {
                    CurrentCrash.Jira = FormValue;
                }

                // Valid to set description to an empty string
                FormValue = CrashesForm["Description"];
                if (FormValue != null)
                {
                    CurrentCrash.Description = FormValue;
                }

                CurrentCallStack = new CallStackContainer(CurrentCrash);

                // Set callstack properties
                CurrentCallStack.bDisplayModuleNames          = true;
                CurrentCallStack.bDisplayFunctionNames        = true;
                CurrentCallStack.bDisplayFileNames            = true;
                CurrentCallStack.bDisplayFilePathNames        = true;
                CurrentCallStack.bDisplayUnformattedCallStack = false;

                CurrentCrash.CallStackContainer = CurrentCrash.GetCallStack();

                // Populate the crash with the correct user data
                Crashes.PopulateUserInfo(CurrentCrash);
                Crashes.SubmitChanges();

                var Model = new CrashViewModel {
                    Crash = CurrentCrash, CallStack = CurrentCallStack
                };
                Model.GenerationTime = LogTimer.GetElapsedSeconds().ToString("F2");
                return(View("Show", Model));
            }
        }