private void Items_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!FormReady) { return; } ComboBox Box = sender as ComboBox; if (Box.SelectedIndex != -1) { ViewRPC View = ViewDefaultRPC.Content as ViewRPC; if (Box.Tag.ToString() == "large") { if (Box.SelectedIndex == 0) { View.LargeImage.Visibility = Visibility.Hidden; } else { BitmapImage Large = new BitmapImage(new Uri(Data.MultiRPC_Images[(Box.SelectedItem as ComboBoxItem).Content.ToString()])); Large.DownloadFailed += ViewRPC.Image_FailedLoading; View.LargeImage.Visibility = Visibility.Visible; View.LargeImage.Source = Large; } } else { if (Box.SelectedIndex == 0) { View.SmallBack.Visibility = Visibility.Hidden; View.SmallImage.Visibility = Visibility.Hidden; } else { BitmapImage Small = new BitmapImage(new Uri(Data.MultiRPC_Images[(Box.SelectedItem as ComboBoxItem).Content.ToString()])); Small.DownloadFailed += ViewRPC.Image_FailedLoading; View.SmallBack.Visibility = Visibility.Visible; View.SmallImage.Visibility = Visibility.Visible; View.SmallImage.Fill = new ImageBrush(Small); } } } }
private void Default_TextChanged(object sender, TextChangedEventArgs e) { if (!FormReady) { return; } TextBox Box = sender as TextBox; ViewRPC View = ViewDefaultRPC.Content as ViewRPC; switch (Box.Name) { case "TextDefaultText1": View.Text1.Content = Box.Text; break; case "TextDefaultText2": View.Text2.Content = Box.Text; break; case "TextDefaultLarge": if (string.IsNullOrEmpty(Box.Text)) { View.LargeImage.ToolTip = null; } else { View.LargeImage.ToolTip = new Button().Content = Box.Text; } break; case "TextDefaultSmall": if (string.IsNullOrEmpty(Box.Text)) { View.SmallImage.ToolTip = null; } else { View.SmallImage.ToolTip = new Button().Content = Box.Text; } break; } }