public WindEl GetLessonType() { WindType type = (WindType)cbInstrument.SelectedIndex; WindEl level = new WindEl(type); return(level); }
void WindSetup(int type) { print("WindBarReceived" + type); switch (type) { case 1: wind = WindType.none; break; case 2: wind = WindType.left; break; case 3: wind = WindType.right; break; } switch (wind) { case WindType.none: EnergyBarRenderer.windBar = windtextures[0]; EnergyBarRenderer.direction = 0; break; case WindType.left: EnergyBarRenderer.windBar = windtextures[1]; EnergyBarRenderer.direction = 1; break; case WindType.right: EnergyBarRenderer.windBar = windtextures[2]; EnergyBarRenderer.direction = 2; break; } }
public string Get(string id, string temp, string wind) { new ApplicationAction("Starting Weather Api Calls", "user", "WeatherTest for " + id).Save(); new ApplicationAction("Using AutoFac", "user", "DI using a Framework").Save(); //Dependency Injection with framework Autofac var builder = new ContainerBuilder(); builder.RegisterType <ProcessApi>().As <IProcessApi>(); builder.RegisterType <Config>().As <IConfig>(); IContainer Container = builder.Build(); TempType UserSelectTemp = (TempType)Enum.Parse(typeof(TempType), temp.ToUpper()); WindType UserSelectWind = (WindType)Enum.Parse(typeof(WindType), wind.ToUpper()); //List of Apis to call all based on the Strategy pattern var WeatherApis = new List <IWeatherStrategy>(); // add new API which would have been created - TODO make this a dynaimc process so this file does not need to be edited WeatherApis.Add(new WeatherDataCollectorBbc()); WeatherApis.Add(new WeatherDataCollectorAccu()); new ApplicationAction("Added Apis", "user", "Two Apis").Save(); //List to hold API call data var LocationDataSets = new List <string>(); using (var scope = Container.BeginLifetimeScope()) { foreach (IWeatherStrategy api in WeatherApis) { // call each of the APIs and store the result LocationDataSets.Add(api.gatherData(id, scope.Resolve <IProcessApi>(), scope.Resolve <IConfig>())); } } new ApplicationAction("Creating objects", "user", "Using factory pattern").Save(); ITemperatureFactory tempFactory = new TemperatureFactory(); ITemperature selectedTemp = tempFactory.CreateTemperature(UserSelectTemp); IWindFactory windFactory = new WindFactory(); IWind selectedWind = windFactory.CreateWind(UserSelectWind); new ApplicationAction("Calcuating results", "user", "Aggregated result data").Save(); //call the aggregator to work out the results var calculatedLocationWeather = new Aggregator(selectedTemp, selectedWind).AggregateData(LocationDataSets); calculatedLocationWeather.Location = id; new ApplicationAction("Completed prcoessing", "user", "TReturn data to client").Save(); //return to client final result return(JsonConvert.SerializeObject(calculatedLocationWeather)); }
/// <summary> /// Setup current wind tipe visual /// </summary> /// <param name="sender">Appropriate menu item</param> /// <param name="windType">Type of wind</param> private void SetMenuWind(MenuItem sender, WindType windType) { foreach (var item in WindMenuItem.Items) { (item as MenuItem).IsChecked = false; } sender.IsChecked = true; windController.WindType = windType; }
public IWind CreateWind(WindType type) { if (type == WindType.KPH) { return(new WindKph()); } else { return(new WindMph()); } }
void OnGUI() { if (settingsData == null) { return; } if (windType == WindType.Packages) { EditorGUI.DrawRect(new Rect(0, 10, 120, 20), Color.white); EditorGUI.DrawRect(new Rect(120, 10, 120, 20), Color.grey); } else if (windType == WindType.Support) { EditorGUI.DrawRect(new Rect(0, 10, 120, 20), Color.grey); EditorGUI.DrawRect(new Rect(120, 10, 120, 20), Color.white); } if (GUI.Button(new Rect(120, 10, 120, 20), "Contact & support", GUIStyle.none)) { windType = WindType.Support; } if (GUI.Button(new Rect(0, 10, 100, 20), "Packages", GUIStyle.none)) { windType = WindType.Packages; } EditorGUI.DrawRect(new Rect(0, 30, this.position.width, 2), Color.gray); GUI.Label(new Rect(this.position.width - 100, this.position.height - 20, 100, 20), "By Else forty", EditorStyles.boldLabel); EditorGUI.DrawRect(new Rect(152, 30, 1, this.position.height), Color.gray); if (windType == WindType.Packages) { Packages(); } else { SupportAndContact(); } }
//========================================================================================= public int CreateWind(WindType windType, float main, float turbulence) { var data = new WindData(); uint flag = Flag_Enable; data.flag = flag; data.windType = windType; data.transformIndex = -1; data.main = main; data.turbulence = turbulence; int windId = windDataList.Add(data); if (windType == WindType.Direction) { directionalWindList.Add(windId); } return(windId); }
void WindSetup(int type) { print ("WindBarReceived" + type); switch(type){ case 1: wind = WindType.none; break; case 2: wind = WindType.left; break; case 3: wind = WindType.right; break; } switch(wind){ case WindType.none: EnergyBarRenderer.windBar=windtextures[0]; EnergyBarRenderer.direction=0; break; case WindType.left: EnergyBarRenderer.windBar=windtextures[1]; EnergyBarRenderer.direction=1; break; case WindType.right: EnergyBarRenderer.windBar=windtextures[2]; EnergyBarRenderer.direction=2; break; } }
private void InitializeType() { if (Knots < 1) Type = WindType.Calm; else if (Knots < 4) Type = WindType.LightAir; else if (Knots < 7) Type = WindType.LightBreeze; else if (Knots < 11) Type = WindType.GentleBreeze; else if (Knots < 17) Type = WindType.ModerateBreeze; else if (Knots < 22) Type = WindType.FreshBreeze; else if (Knots < 28) Type = WindType.StrongBreeze; else if (Knots < 34) Type = WindType.ModerateGale; else if (Knots < 41) Type = WindType.FreshGale; else if (Knots < 48) Type = WindType.StrongGale; else if (Knots < 56) Type = WindType.WholeGale; else if (Knots < 64) Type = WindType.Storm; else Type = WindType.Hurricane; }
public Wind(DateTime windDate, string windType) { WindDate = windDate; WindType = windType.MapToWind(); }
public WindType GetLessonType() { WindType level = (WindType)cbInstrument.SelectedIndex; return(level); }
//веселуха с соответствием индекс списка - имя индекса public void SetLessonType(WindType level) { cbInstrument.SelectedIndex = (int)level; }
public WindEl(WindType type) { Wind = type; }