Skip to content

Commit

Permalink
Event window now works better (again...)
Browse files Browse the repository at this point in the history
  • Loading branch information
vchelaru committed Jan 17, 2024
1 parent 0072383 commit c927705
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions FRBDK/Glue/Glue/Controls/AddEventWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using GlueFormsCore.ViewModels;
using System.Windows.Controls;
using System.Collections.Generic;
using GlueFormsCore.Extensions;

namespace FlatRedBall.Glue.Controls;
/// <summary>
Expand Down Expand Up @@ -36,10 +37,7 @@ public AddEventWindow()
{
InitializeComponent();

FillAvailableDelegateTypes();
FillTunnelingObjects();
FillTypeConverters();
UpdateGenericTypeElementsVisibility();
this.Loaded += (_,_) => this.MoveToCursor();
}

/// <summary>
Expand Down Expand Up @@ -182,8 +180,16 @@ private void UpdateGenericTypeElementsVisibility(string value = null)

private void SetFrom(AddEventViewModel viewModel)
{

FillAvailableDelegateTypes();
FillTunnelingObjects();
FillTypeConverters();
UpdateGenericTypeElementsVisibility();

if (viewModel.TunnelingObject != null)
{
this.TunnelingObjectComboBox.SelectedItem = viewModel.TunnelingObject;

foreach (var item in this.TunnelingEventComboBox.Items)
{
if (String.Equals(item.ToString(), viewModel.TunnelingEvent, StringComparison.OrdinalIgnoreCase))
Expand All @@ -207,6 +213,16 @@ private void SetFrom(AddEventViewModel viewModel)
{
AvailableEventsComboBox.SelectedIndex = 0;
}

if(viewModel.TunnelingObject != null)
{
this.EventTypeTunnel.IsChecked = true;

if(this.TunnelingEventComboBox.SelectedItem == null && this.TunnelingEventComboBox.Items.Count > 0)
{
this.TunnelingEventComboBox.SelectedItem = this.TunnelingEventComboBox.Items[0];
}
}
}

/// <summary>
Expand Down

0 comments on commit c927705

Please sign in to comment.