private void SnapshotDropDown_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (SnapshotDropDown.Items.Count <= 0) { Mapping = null; } else { try { Mapping = new MCMapping((string)MCVersionDropDown.SelectedValue, (MappingType)TypeDropDown.SelectedValue, (int)SnapshotDropDown.SelectedValue); } catch (Exception) { Mapping = null; } } }
private int OpenCustomMapping() { if (OpenFileDialog.ShowDialog() ?? false) { if (MCMapping.SetCustomZip(OpenFileDialog.FileName)) { return(1); } else { return(-1); } } return(0); }
private void MCVersionDropDown_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (MCVersionDropDown.Items.Count <= 0) { Mapping = null; } else if (MCVersionDropDown.SelectedIndex == 0) { Mapping = MCMapping.SemiLive; } else if (MCVersionDropDown.SelectedIndex == MCVersionDropDown.Items.Count - 1) { Mapping = null; int result = OpenCustomMapping(); if (result != 1) { MCVersionDropDown.SelectedIndex = -1; if (result == -1) { MappingName = "Invalid Custom"; } } else { Mapping = MCMapping.Custom; MappingName = OpenFileDialog.SafeFileName; OnCustomZipLoaded?.Invoke(); } } else { Mapping = null; if (TypeDropDown.SelectedIndex < 0) { TypeDropDown.SelectedIndex = 0; } else { try { SnapshotDropDown.ItemsSource = MappingData[(string)MCVersionDropDown.SelectedValue][(MappingType)TypeDropDown.SelectedValue].Reverse(); SnapshotDropDown.SelectedIndex = 0; Mapping = new MCMapping((string)MCVersionDropDown.SelectedValue, (MappingType)TypeDropDown.SelectedValue, (int)SnapshotDropDown.SelectedValue); } catch (Exception) { SnapshotDropDown.ItemsSource = null; } } } }
private void TypeDropDown_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Mapping == MCMapping.SemiLive || Mapping == MCMapping.Custom) { SnapshotDropDown.ItemsSource = null; return; } if (TypeDropDown.Items.Count > 0 && TypeDropDown.SelectedIndex >= 0) { try { SnapshotDropDown.ItemsSource = MappingData[(string)MCVersionDropDown.SelectedValue][(MappingType)TypeDropDown.SelectedValue].Reverse(); SnapshotDropDown.SelectedIndex = 0; Mapping = new MCMapping((string)MCVersionDropDown.SelectedValue, (MappingType)TypeDropDown.SelectedValue, (int)SnapshotDropDown.SelectedValue); } catch (Exception) { SnapshotDropDown.ItemsSource = null; } } else { SnapshotDropDown.ItemsSource = null; } }