Example #1
0
 public void Dispose()
 {
     mockrepo      = null;
     profile       = null;
     configuration = null;
     mapper        = null;
 }
Example #2
0
 public ControllerTest()
 {
     mockrepo      = new Mock <IWeather>();
     profile       = new WeatherProfile();
     configuration = new MapperConfiguration(c => c.AddProfile(profile));
     mapper        = new Mapper(configuration);
 }
Example #3
0
        /// <summary>
        /// Forces the weather system to recalculate weather ranges, get the current season, etc.
        /// </summary>
        public void ResetWeather()
        {
            // Determine the active weather profile based on the new season
            switch (GameClock.Instance.GetSeason)
            {
            case Seasons.Spring:     // Spring
                activeProfile = springWeatherProfile;
                break;

            case Seasons.Summer:     // Summer
                activeProfile = summerWeatherProfile;
                break;

            case Seasons.Fall:     // Fall
                activeProfile = fallWeatherProfile;
                break;

            case Seasons.Winter:     // Winter
                activeProfile = winterWeatherProfile;
                break;
            }

            // Recalculate the weather weighting ranges for randomizing weather
            CalculateRanges();
        }
Example #4
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            WeatherProfile profile = GetProfile(row);

            if (profile == null)
            {
                return;
            }

            profile.ParseTemperature(row);
        }
Example #5
0
        /// <summary>
        /// Gets the weather profile
        /// </summary>
        /// <returns></returns>
        private WeatherProfile GetWeatherProfile()
        {
            WeatherProfile _profile = new WeatherProfile();

            _profile.CityName          = this.CityName;
            _profile.isCondition       = this.Condition;
            _profile.isConditionImage  = this.ConditionImage;
            _profile.isHighTemperature = this.High;
            _profile.isHumidity        = this.Humidity;
            _profile.isLowTemprature   = this.Low;
            _profile.UnitTemperature   = this.UnitTemperature;
            _profile.isUpdateInfo      = this.UpdateInfo;
            _profile.isWind            = this.Wind;
            return(_profile);
        }
Example #6
0
        public void OnWorldLoadFinished()
        {
            kDebugging = Settings.Debugging;

            if (sDefaultProfiles == null)
            {
                sDefaultProfiles = new Dictionary <Season, WeatherProfile>();

                foreach (Season season in Enum.GetValues(typeof(Season)))
                {
                    WeatherProfile profile = new WeatherProfile(Common.Localize("DefaultProfile:Name"));
                    profile.ReadDefaults(season);

                    sDefaultProfiles.Add(season, profile);
                }
            }

            new Common.AlarmTask(0.05f, DaysOfTheWeek.All, OnNewDay);
        }
Example #7
0
        protected override void CreateChildControls()
        {
            try
            {
                LogError         = new DisplayError();
                LogError.isError = false;

                if (this.AutoLoc)
                {
                    //Save the City Value to SP DB
                    SaveAutoLoc();
                }

                //Get the weather profile from the properties entered
                WeatherProfile _profile = GetWeatherProfile();

                Control control = Page.LoadControl(_ascxPath);
                ((WeatherUserControl)control)._weatherProfile = _profile;
                ((WeatherUserControl)control)._displayError   = LogError;
                Controls.Add(control);

                //If any error occurs
                if (LogError.isError && !string.IsNullOrEmpty(LogError.ErrorMessage))
                {
                    Label Errorlbl = new Label();
                    Errorlbl.Text     = LogError.ErrorMessage;
                    Errorlbl.CssClass = "colr";
                    this.Controls.Add(Errorlbl);
                    LogError.isError      = false;
                    LogError.ErrorMessage = string.Empty;
                }
            }
            catch (Exception ex)
            {
                throw (new SPException(ex.Message));
            }
        }
Example #8
0
 public EveningTemperature(WeatherProfile profile)
     : base(profile)
 {
 }
Example #9
0
	void SetCurrentWeather( WeatherProfile nextProfile , int stepsToTransition){
		
		//  Don't waste time if the current profile is requested
		//if (nextProfile.Equals (currentWeather)) { return; }

		WeatherProfile oldProf = currentWeather;
		skyMat.SetTexture("_FrontTex", oldProf.front);
		skyMat.SetTexture("_BackTex", oldProf.back);
		skyMat.SetTexture("_DownTex", oldProf.bottom);
		skyMat.SetTexture("_LeftTex", oldProf.left);
		skyMat.SetTexture("_RightTex", oldProf.right);
		skyMat.SetTexture("_UpTex", oldProf.top);
		currentWeather = nextProfile;
		skyMat.SetTexture("_FrontTex2", currentWeather.front);
		skyMat.SetTexture("_BackTex2", currentWeather.back);
		skyMat.SetTexture("_DownTex2", currentWeather.bottom);
		skyMat.SetTexture("_LeftTex2", currentWeather.left);
		skyMat.SetTexture("_RightTex2", currentWeather.right);
		skyMat.SetTexture("_UpTex2", currentWeather.top);
		transitionTimer = stepsToTransition;  //  Transition timer decrements every step.
		originalTimeSet = stepsToTransition;  //  Keeps track of the original time to animate the skybox
	}
Example #10
0
	// Use this for initialization
	void Start () {
		storming = false;
		skyMat = RenderSettings.skybox;
		//  Create the weather profiles
		cloudynight = new WeatherProfile ("cloudy", cloudynight_top,
			cloudynight_front, cloudynight_bottom,
			cloudynight_left, cloudynight_right,
			cloudynight_back, cloudynight_dayNightColor, cloudynight_maxIntensity, cloudynight_minIntensity, cloudynight_maxAmbient, cloudynight_minAmbient,
			cloudynight_nightDayFogColor, cloudynight_fogDensityCurve, cloudynight_fogScale, cloudynight_dayAtmosphereThickness,
			cloudynight_nightAtmosphereThickness 
		);
		overcast = new WeatherProfile ("overcast", overcast_top,
			overcast_front, overcast_bottom,
			overcast_left, overcast_right,
			overcast_back, overcast_dayNightColor, overcast_maxIntensity, overcast_minIntensity, overcast_maxAmbient, overcast_minAmbient,
			overcast_nightDayFogColor, overcast_fogDensityCurve, overcast_fogScale, overcast_dayAtmosphereThickness,
			overcast_nightAtmosphereThickness 
		);
		sunny = new WeatherProfile ("sunny", sunny_top,
			sunny_front, sunny_bottom,
			sunny_left, sunny_right,
			sunny_back, sunny_dayNightColor, sunny_maxIntensity, sunny_minIntensity, sunny_maxAmbient, sunny_minAmbient,
			sunny_nightDayFogColor, sunny_fogDensityCurve, sunny_fogScale, sunny_dayAtmosphereThickness,
			sunny_nightAtmosphereThickness 
		);
		sunset = new WeatherProfile ("sunset", sunset_top,
			sunset_front, sunset_bottom,
			sunset_left, sunset_right,
			sunset_back, sunset_dayNightColor, sunset_maxIntensity, sunset_minIntensity, sunset_maxAmbient, sunset_minAmbient,
			sunset_nightDayFogColor, sunset_fogDensityCurve, sunset_fogScale, sunset_dayAtmosphereThickness,
			sunset_nightAtmosphereThickness 
		);
		sunrise = new WeatherProfile ("sunrise", sunrise_top,
			sunrise_front, sunrise_bottom,
			sunrise_left, sunrise_right,
			sunrise_back, sunrise_dayNightColor, sunrise_maxIntensity, sunrise_minIntensity, sunrise_maxAmbient, sunrise_minAmbient,
			sunrise_nightDayFogColor, sunrise_fogDensityCurve, sunrise_fogScale, sunrise_dayAtmosphereThickness,
			sunrise_nightAtmosphereThickness 
		);

		currentWeather = cloudynight;
		SetCurrentWeather (cloudynight, 1);
	}
Example #11
0
 public TemperatureOption(WeatherProfile profile)
 {
     mProfile = profile;
 }
Example #12
0
 public NightTemperature(WeatherProfile profile)
     : base(profile)
 {
 }
Example #13
0
 public NoonTemperature(WeatherProfile profile)
     : base(profile)
 {
 }
Example #14
0
 public Range(Season season, WeatherProfile data)
 {
     mSeason  = season;
     mProfile = data;
 }
Example #15
0
 public Rename(WeatherProfile profile)
 {
     mProfile = profile;
 }
        public ViewResult Weather(WeatherProfile profile)
        {
            ViewBag.Title = "Report";

            return(View("Report", profile));
        }
Example #17
0
 public Enabled(WeatherProfile profile)
 {
     mProfile = profile;
 }
Example #18
0
 public Remove(Season season, WeatherProfile profile)
 {
     mSeason  = season;
     mProfile = profile;
 }
Example #19
0
 public ListingOption(Season season, WeatherProfile profile)
     : base(profile.Name)
 {
     mSeason  = season;
     mProfile = profile;
 }
Example #20
0
        // IMPORTANT
        protected override async Task OnMessageActivityAsync(ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken)
        {
            if (turnContext.Activity.Type == ActivityTypes.Message)
            {
                // Get the user state from the turn context.
                user = await _accessors.UserProfile.GetAsync(turnContext, () => new WeatherProfile());

                // Get the conversation state from the turn context.
                var state = await _accessors.CounterState.GetAsync(turnContext, () => new CounterState());

                // Bump the turn count for this conversation.
                state.TurnCount++;

                Newtonsoft.Json.Linq.JToken location = null, time = null;

                // Check LUIS model
                var recognizerResult = await this.Recognizer.RecognizeAsync(turnContext, cancellationToken);

                var topIntent = recognizerResult?.GetTopScoringIntent();

                // Get the Intent as a string
                string strIntent = (topIntent != null) ? topIntent.Value.intent : "";

                // Get the IntentScore as a double
                double dblIntentScore = (topIntent != null) ? topIntent.Value.score : 0.0;

                // Only proceed with LUIS if there is an Intent
                // and the score for the Intent is greater than 95
                if (strIntent == "Weather" && (dblIntentScore > 0.95))
                {
                    weatherIntent = true;

                    if (recognizerResult.Entities.TryGetValue("Location", out location))
                    {
                        user.Location = rx.Match(location.ToString()).Value.TrimStart('"');
                    }

                    // Show Location
                    //await turnContext.SendActivityAsync(MessageFactory.Text(user.Location), cancellationToken);


                    if (recognizerResult.Entities.TryGetValue("Time", out time))
                    {
                        user.Time = rx.Match(time.ToString()).Value.TrimStart('"');
                    }

                    // Show Time
                    //await turnContext.SendActivityAsync(MessageFactory.Text(user.Time), cancellationToken);

                    if ((user.Location != null) && (user.Time != null))
                    {
                        // Api connection here <------------------------------------
                        var responseMessage = $"The weather in {user.Location} for {user.Time} is " + GetWeather(user.Location, user.Time);
                        await turnContext.SendActivityAsync(responseMessage);
                    }
                }
                else if (!flag1)
                {
                    await turnContext.SendActivityAsync(MessageFactory.Text("Sorry, please try again."), cancellationToken);
                }


                if ((user.Location == null) || (user.Time == null) || flag1)
                {
                    if (acceptLocation)
                    {
                        acceptLocation = false;
                        user.Location  = turnContext.Activity.Text;
                    }
                    if (acceptTime)
                    {
                        acceptTime = false;
                        user.Time  = turnContext.Activity.Text;
                    }

                    if (weatherIntent)
                    {
                        if (user.Location == null)
                        {
                            acceptLocation = true;
                            flag1          = true;

                            var dialogContext = await _dialogs.CreateContextAsync(turnContext, cancellationToken);

                            var results = await dialogContext.ContinueDialogAsync(cancellationToken);

                            var responseMessage = "Give me your city.";
                            await turnContext.SendActivityAsync(responseMessage);
                        }
                        else if (user.Time == null)
                        {
                            acceptTime = true;
                            flag1      = true;

                            var dialogContext = await _dialogs.CreateContextAsync(turnContext, cancellationToken);

                            var results = await dialogContext.ContinueDialogAsync(cancellationToken);

                            var responseMessage = "Give me when do you want to learn the weather.";
                            await turnContext.SendActivityAsync(responseMessage);
                        }
                        else if ((user.Location != null) && (user.Time != null) && flag1)
                        {
                            weatherIntent = false;
                            flag1         = false;

                            // Api connection here <------------------------------------
                            await turnContext.SendActivityAsync(MessageFactory.Text($"The weather in {user.Location} for {user.Time} is " + GetWeather(user.Location, user.Time)), cancellationToken);
                        }
                    }
                }

                // Set the property using the accessor.
                await _accessors.CounterState.SetAsync(turnContext, state);

                // Save the new turn count into the conversation state.
                await _accessors.ConversationState.SaveChangesAsync(turnContext);

                // Save the user profile updates into the user state.
                await _accessors.UserState.SaveChangesAsync(turnContext, false, cancellationToken);
            }
        }