Ejemplo n.º 1
0
 /// <summary>
 /// Occurs when the data context changes.
 /// </summary>
 /// <param name="sender">This control</param>
 /// <param name="e">DependencyPropertyChangedEventArgs</param>
 private void OnViewModelChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     this.m_ViewModel = this.DataContext as LoveViewModel;
     if (this.m_ViewModel != null)
     {
         this.DataContextChanged -= this.OnViewModelChanged;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new truth model.
 /// </summary>
 /// <param name="parent">The parent view model.</param>
 /// <param name="id">The id of the trut.</param>
 public Truth(LoveViewModel parent, int id = 0)
 {
     if (parent == null)
     {
         throw new ArgumentNullException(nameof(parent), @"Parent of a truth cannot be null.");
     }
     this.Id     = id;
     this.Parent = parent;
     this.Bodies = new ObservableCollection <Body> ();
 }
Ejemplo n.º 3
0
 public async Task <IActionResult> Calculator(LoveViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var result_1 = _helper.CalculateLove(viewModel.Lover1, viewModel.Lover2);
         var result   = new LoveResult(viewModel);
         result.LovePercentage = result_1;
         return(View("LoveResult", result));
     }
     ModelState.AddModelError("Server Error", "Internal Server Error Occcured");
     return(View(viewModel));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new saved love.
 /// </summary>
 /// <param name="love">Love to save.</param>
 public SaveLove(LoveViewModel love)
 {
     this.Init();
     foreach (var light in love.Light)
     {
         this.Light.Add(new SaveLight(light));
     }
     foreach (var light in love.EditLight)
     {
         this.EditLight.Add(new SaveLight(light));
     }
     this.CurrentRegex = love.CurrentRegex;
     this.AddText      = love.TextToFormat;
     this.IsExpanded   = love.IsExpanded;
 }