public ActionResult Index() { var first = new FirstModel(); var second = new SecondModel(); return(View(Tuple.Create(first, second))); }
/// <summary> /// Sets the transparency for the model /// </summary> public void Transparency() { if (SecondModelMaterial.DiffuseColor.Alpha == 1) { SecondModelMaterial.DiffuseColor = PhongMaterials.ToColor(1, 1, 1, .4); SecondModel.UpdateVertices(); if (ThirdModel != null) { ThirdModelMaterial.DiffuseColor = PhongMaterials.ToColor(1, 1, 1, .4); ThirdModel.UpdateVertices(); } } else { SecondModelMaterial.DiffuseColor = PhongMaterials.ToColor(1, 1, 1, 1); SecondModel.UpdateVertices(); if (ThirdModel != null) { ThirdModelMaterial.DiffuseColor = PhongMaterials.ToColor(1, 1, 1, 1); ThirdModel.UpdateVertices(); } } }
//point_type 气泡 1 警告、2 提示、3 数据(折线图)、4 文件、5 打开 public void updataPointsData(FirstModel firstModel) { var firstDisplayImageName = ""; if (firstModel.point_type == 1) { firstDisplayImageName = "firstbtns/1"; } else if (firstModel.point_type == 2) { firstDisplayImageName = "firstbtns/2"; } else if (firstModel.point_type == 3) { firstDisplayImageName = "firstbtns/3"; } else if (firstModel.point_type == 4) { firstDisplayImageName = "firstbtns/4"; } else if (firstModel.point_type == 5) { firstDisplayImageName = "firstbtns/5"; } GetComponent <Image>().sprite = Resources.Load <Sprite>(firstDisplayImageName); for (int j = 0; j < firstModel.point_info.Count; j++) { var btn_2 = transform.Find("sbtn_0_" + j); // pointSp psp = (pointSp)btn_2.GetComponent(typeof(pointSp)); SecondModel secondModel = firstModel.point_info[j]; // psp.set_secondModel(secondModel, j); } }
/// <summary> /// Changes the Specular Shininess of the model /// </summary> /// <param name="itemName">The currently selected items name</param> public void Reflections(string itemName) { if (itemName.Equals(Strings.Face) || itemName.Equals(Strings.Face)) { if (ModelMaterial.SpecularShininess < 10) { ModelMaterial.SpecularShininess += 1; Model.UpdateVertices(); } else if (ModelMaterial.SpecularShininess < 50) { ModelMaterial.SpecularShininess += 10; Model.UpdateVertices(); } else { ModelMaterial.SpecularShininess = 1; Model.UpdateVertices(); } } else { if (SecondModelMaterial.SpecularShininess < 10) { SecondModelMaterial.SpecularShininess += 1; SecondModel.UpdateVertices(); if (ThirdModel != null) { ThirdModelMaterial.SpecularShininess += 1; ThirdModel.UpdateVertices(); } } else if (SecondModelMaterial.SpecularShininess < 50) { SecondModelMaterial.SpecularShininess += 10; SecondModel.UpdateVertices(); if (ThirdModel != null) { ThirdModelMaterial.SpecularShininess += 10; ThirdModel.UpdateVertices(); } } else { SecondModelMaterial.SpecularShininess = 1; SecondModel.UpdateVertices(); if (ThirdModel != null) { ThirdModelMaterial.SpecularShininess = 1; ThirdModel.UpdateVertices(); } } } }
public class ActionResult Save(MyViewModel vmData) { FirstModel firstModel = new FirstModel(); SecondModel secondModel = new SecondModel(); firstModel.MyDetails = vmData.MyDetails; secondModel.MyDetails = vmData.MyDetails2; secondModel.FirstModel = firstModel; db.SecondModel.Add(secondModel); db.SaveChanges(); }
//BSL1) Напишите атрибут, который можно применить только к классу. //Атрибут содержит информацию об авторе кода (имя, e-mail). //Напишите функционал, который позволит вывести эту информацию в консоль. static void Main(string[] args) { OtherModel model = new OtherModel(); SecondModel model2 = new SecondModel(); ThirdModel model3 = new ThirdModel(); Type modelType = model.GetType(); Type modelType2 = model2.GetType(); Console.WriteLine(model.AuthorsInfo); Console.WriteLine(model2.AuthorsInfo); Console.WriteLine(model3.AuthorsInfo); Console.ReadLine(); }
public virtual Response <SecondModel> OperationSecondModel(SecondModel body = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MainClient.OperationSecondModel"); scope.Start(); try { return(RestClient.OperationSecondModel(body, cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
static void Main(string[] args) { //var model = new FirstModel(); var model = new SecondModel(); var selection = new EliteSelection(); var crossover = new IntegerCrossover(); var mutation = new NewValueMutation(); var fitness = new ThermalFitness(model); var chromosome = model.Genome; var population = new Population(500, 5000, chromosome); var ga = new GeneticAlgorithm(population, fitness, selection, crossover, mutation); ga.Termination = new GenerationNumberTermination(100); ga.MutationProbability = 0.5f; //ga.CrossoverProbability = 0.9f; ga.GenerationRan += (sender, eventargs) => { var geneticAlgorithm = sender as GeneticAlgorithm; if (geneticAlgorithm.GenerationsNumber % 3 == 0) { return; } var genome = geneticAlgorithm.BestChromosome as ThermalGenome; Console.WriteLine(genome.Fitness); }; Console.WriteLine("GA running..."); ga.Start(); var gaBestChromosome = ga.BestChromosome as ThermalGenome; Console.WriteLine("Best solution found has {0} fitness.", gaBestChromosome.Fitness); Console.WriteLine("Values:"); Console.WriteLine(string.Join(",", gaBestChromosome.Select(t => t.U.ToString()))); Console.WriteLine(model.Output(gaBestChromosome.Select(t => t.U).ToArray())); }
public static async Task Main(string[] args) { IHost host = CreateHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var myDbContext = services.GetService <MyDbContext>(); await myDbContext.Database.MigrateAsync(); if (!await myDbContext.MyCoolModels.AnyAsync()) { var first = new FirstModel(); var second = new SecondModel(); myDbContext.Firsts.Add(first); myDbContext.Seconds.Add(second); await myDbContext.SaveChangesAsync(); myDbContext.MyCoolModels.Add(new MyCoolModel() { SomeText = "Hello World", First = first, Second = second }); await myDbContext.SaveChangesAsync(); } } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred migrating the DB."); } } await host.RunAsync(); }
private void Awake() { _secondModel = GetComponent <SecondModel>(); _secondView = GetComponent <SecondView>(); }
private void Awake() { _secondModel = GameObject.FindGameObjectWithTag("MiniGame Controller").GetComponent <SecondModel>(); groupPoints = GameObject.Find("PointsToJoin"); }
public virtual async Task <Response <SecondModel> > OperationSecondModelAsync(SecondModel body = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("MainClient.OperationSecondModel"); scope.Start(); try { return(await RestClient.OperationSecondModelAsync(body, cancellationToken).ConfigureAwait(false)); } catch (Exception e) { scope.Failed(e); throw; } }
public SecondViewModel() { Model = new SecondModel(); Model.SelectionRectangle = new Models.Selection(); PreviousFrameIsEnabled = false; NextFrameIsEnabled = false; BrowseFile = new RelayCommand(() => { try { BrowseFileTryContent(); } catch (Exception ex) { Logger.Log(string.Concat(ex.Message, "\r\n", ex.StackTrace)); BrowseFileCatchContent(ex); } }); SelectPreviousFrame = new RelayCommand(() => { try { NextFrameIsEnabled = true; if (FrameIndex > 0) { ImageSource = Model.Vid.ImageSourceList[--FrameIndex].bitmapImage; } } catch (Exception ex) { Logger.Log(string.Concat(ex.Message, "\r\n", ex.StackTrace)); MessageBox.Show(ex.Message); } }); SelectNextFrame = new RelayCommand(() => { try { if (FrameIndex == Model.Vid.ImageSourceList.Count - 1) { ImageSource = ReadNextFrame(); } else { ImageSource = Model.Vid.ImageSourceList[++FrameIndex].bitmapImage; } if (FrameIndex == Model.Vid.VideoReader.FrameCount - 1) { NextFrameIsEnabled = false; } } catch (Exception) { NextFrameIsEnabled = false; } }); PreviousVideo = new RelayCommand(() => { try { ShowMainPageEvent?.Invoke(this, new MyArguments { MainPage = this.MainPage }); } catch (Exception ex) { Logger.Log(string.Concat(ex.Message, "\r\n", ex.StackTrace)); MessageBox.Show(ex.Message); } }); OpenProceedWindow = new RelayCommand(() => { try { Model.Vid.ScaleHeight = BaseSelection.Rect.Height / Model.SelectionRectangle.Rect.Height; Model.Vid.ScaleWidth = BaseSelection.Rect.Width / Model.SelectionRectangle.Rect.Width; Model.Vid.BaseCenter = BaseSelection.GetCenter(); Model.Vid.SecondCenter = Model.SelectionRectangle.GetCenter(); Model.Vid.SecondSelection = Model.SelectionRectangle; ShowWaitingPageEvent?.Invoke(this, new MyArguments { VidInfo = Model.Vid, MainPage = this.MainPage }); } catch (Exception ex) { Logger.Log(string.Concat(ex.Message, "\r\n", ex.StackTrace)); MessageBox.Show(ex.Message); } }); }
void Awake() { Instance = this; }