private void Awake()
    {
        Instance = this;
        vertices = new List <Vector3>(16);
        indices  = new List <int>();
        colors   = new List <Color>();

        if (!Debug.isDebugBuild)
        {
            enabled = false;
        }
    }
        async Task ExecuteGetWeatherCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                WeatherRoot weatherRoot = null;

                var units = IsImperial ? Units.Imperial : Units.Metric;

                if (UseGPS)
                {
                    var gps = await CrossGeolocator.Current.GetPositionAsync(TimeSpan.FromSeconds(10)).ConfigureAwait(false);

                    weatherRoot = await WeatherService.GetWeather(gps.Latitude, gps.Longitude, units).ConfigureAwait(false);
                }
                else
                {
                    //Get weather by city
                    weatherRoot = await WeatherService.GetWeather(Location.Trim(), units).ConfigureAwait(false);
                }

                //Get forecast based on cityId
                Forecast = await WeatherService.GetForecast(weatherRoot, units).ConfigureAwait(false);

                var unit = IsImperial ? "F" : "C";
                Temperature = $"Temp: {weatherRoot?.MainWeather?.Temperature ?? 0}°{unit}";
                Condition   = $"{weatherRoot.Name}: {weatherRoot?.Weather?[0]?.Description ?? string.Empty}";

                IsBusy = false;

                await CrossTextToSpeech.Current.Speak(Temperature + " " + Condition).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                DebugServices.Report(e);
                Temperature = "Unable to get Weather";
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #3
0
 static void Report(Exception e, [CallerMemberName] string callerMemberName = "") => DebugServices.Report(e, callerMemberName);
Example #4
0
        public StackValue Bounce(int exeblock, int entry, ProtoCore.Runtime.Context context, List<Instruction> breakpoints, ProtoCore.DSASM.StackFrame stackFrame, int locals = 0, 
            DSASM.Executive exec = null, DebugServices.EventSink sink = null, bool fepRun = false)
        {
            if (stackFrame != null)
            {
                StackValue svThisPtr = stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kThisPtr);
                int ci = (int)stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kClass).opdata;
                int fi = (int)stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kFunction).opdata;
                int returnAddr = (int)stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kReturnAddress).opdata;
                int blockDecl = (int)stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kFunctionBlock).opdata;
                int blockCaller = (int)stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kFunctionCallerBlock).opdata;
                ProtoCore.DSASM.StackFrameType callerFrameType = (ProtoCore.DSASM.StackFrameType)stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kCallerStackFrameType).opdata;
                ProtoCore.DSASM.StackFrameType frameType = (ProtoCore.DSASM.StackFrameType)stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kStackFrameType).opdata;
                Validity.Assert(frameType == StackFrameType.kTypeLanguage);

                int depth = (int)stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kStackFrameDepth).opdata;
                int framePointer = (int)stackFrame.GetAt(DSASM.StackFrame.AbsoluteIndex.kFramePointer).opdata;
                List<StackValue> registers = stackFrame.GetRegisters();

                DebugProps.SetUpBounce(exec, blockCaller, returnAddr);

                Rmem.PushStackFrame(svThisPtr, ci, fi, returnAddr, blockDecl, blockCaller, callerFrameType, frameType, depth + 1, framePointer, registers, locals, 0);
            }

            ProtoCore.Language id = DSExecutable.instrStreamList[exeblock].language;
            CurrentExecutive = Executives[id];

            StackValue sv = Executives[id].Execute(exeblock, entry, context, breakpoints, sink, fepRun);
            return sv;
        }
Example #5
0
        public StackValue Bounce(int exeblock, int entry, ProtoCore.Runtime.Context context, ProtoCore.DSASM.StackFrame stackFrame, int locals = 0, DebugServices.EventSink sink = null)
        {
            if (stackFrame != null)
            {
                StackValue svThisPtr = stackFrame.ThisPtr;
                int ci = stackFrame.ClassScope;
                int fi = stackFrame.FunctionScope;
                int returnAddr = stackFrame.ReturnPC;
                int blockDecl = stackFrame.FunctionBlock;
                int blockCaller = stackFrame.FunctionCallerBlock;
                StackFrameType callerFrameType = stackFrame.CallerStackFrameType;
                StackFrameType frameType = stackFrame.StackFrameType;
                Validity.Assert(frameType == StackFrameType.kTypeLanguage);

                int depth = stackFrame.Depth;
                int framePointer = stackFrame.FramePointer;
                List<StackValue> registers = stackFrame.GetRegisters();

                Rmem.PushStackFrame(svThisPtr, ci, fi, returnAddr, blockDecl, blockCaller, callerFrameType, frameType, depth + 1, framePointer, registers, locals, 0);
            }

            ProtoCore.Language id = DSExecutable.instrStreamList[exeblock].language;
            CurrentExecutive = Executives[id];
            StackValue sv = Executives[id].Execute(exeblock, entry, context, sink);
            return sv;
        }