コード例 #1
0
        /// <summary>
        /// Get my string
        /// </summary>
        /// <returns>String</returns>
        private ReturnArguments GetMyString()
        {
            ReturnArguments returnArguments = new ReturnArguments();

            try
            {
                returnArguments.Value = "My string";

                return(returnArguments);
            }
            catch (Exception ex)
            {
                returnArguments.Value   = string.Empty;
                returnArguments.Message = String.Format("{0} {1}", ex.InnerException, ex.Message);

                Dictionary <string, string> logData = new Dictionary <string, string>();
                logData.Add("Fails", "Sending the string 'My string'");

                ReturnArgumentsTracingModel returnArgumentsTracingModel = new ReturnArgumentsTracingModel()
                {
                    UserId     = "1",
                    EventName  = "user_action",
                    ScreenName = "MainPage",
                    ActionType = "Button",
                    ActionName = "GetMyString",
                    LogData    = logData,
                    Exception  = ex
                };

                returnArguments.TraceWithFirebase(returnArgumentsTracingModel);

                return(returnArguments);
            }
        }
コード例 #2
0
        /// <summary>
        /// Get my string
        /// </summary>
        /// <returns>String</returns>
        private ReturnArguments GetCars()
        {
            ReturnArguments returnArguments = new ReturnArguments();

            try
            {
                // Some external resources
                ObservableCollection <CarEntity> carEntities = new ObservableCollection <CarEntity>()
                {
                    new CarEntity()
                    {
                        Id = "55a6e9ec-11db-4f63-9d28-b50dcb147365", Maker = "Ford", Model = "EcoSport", Year = "2020"
                    }
                };

                /// Producing error
                carEntities[2].Year = "2020";

                returnArguments.Value = carEntities;

                return(returnArguments);
            }
            catch (Exception ex)
            {
                returnArguments.Value   = new ObservableCollection <CarEntity>();
                returnArguments.Message = String.Format("{0} {1}", ex.InnerException, ex.Message);

                Dictionary <string, string> logData = new Dictionary <string, string>();
                logData.Add("Fails", "Sending cars");

                ReturnArgumentsTracingModel returnArgumentsTracingModel = new ReturnArgumentsTracingModel()
                {
                    UserId     = "1",
                    EventName  = "user_action",
                    ScreenName = "MainPage",
                    ActionType = "Button",
                    ActionName = "GettingCars",
                    LogData    = logData,
                    Exception  = ex
                };

                returnArguments.TraceWithFirebase(returnArgumentsTracingModel);

                return(returnArguments);
            }
        }