Example #1
0
    protected void VersionsChanged(object sender, EventArgs e)
    {
        if (versions.Count == 0)
            return;
        for (int i = 0; i < _Versions.Count; i++)
        {
            ListViewItem item = _Versions[i];
            Mod mod = ((ModVersionViewModel)item.DataContext).mod;
            if (!versions.Values.Contains(mod))
            {
                _Versions.RemoveAt(i);
                i--;
            }
        }

        List<int> versionKeys = versions.Keys.ToList();
        versionKeys.Sort();
        versionKeys.Reverse();
        ListViewItem[] old = _Versions.ToArray();
        _Versions = new ObservableCollection<ListViewItem>();

        foreach (int n in versionKeys)
        {
            Mod mod = versions[n];
            bool add = true;
            /*foreach (ListViewItem item in _Versions)
            {
                if (item.DataContext == mod)
                {
                    add = false;
                    break;
                }
            }*/
            if (add)
            {
                ListViewItem newItem = new ListViewItem();
                StackPanel panel = new StackPanel();
                panel.Orientation = Orientation.Vertical;
                newItem.DataContext = new ModVersionViewModel(mod);

                TextBlock label = new TextBlock();
                label.SetBinding(TextBlock.TextProperty, "Version");

                StackPanel panel2 = new StackPanel();
                panel2.Orientation = Orientation.Horizontal;
                TextBlock compatibleLabel = new TextBlock();
                compatibleLabel.SetResourceReference(TextBlock.TextProperty, "Lang.Mods.Labels.Compatible");
                compatibleLabel.FontSize = 14;

                compatibleLabel.Margin = new Thickness(0, 0, 5, 0);
                TextBlock label2 = new TextBlock();
                label2.SetBinding(TextBlock.TextProperty, "Compatible");
                label2.FontSize = 14;

                panel2.Children.Add(compatibleLabel);
                panel2.Children.Add(label2);

                panel.Children.Add(label);
                panel.Children.Add(panel2);

                newItem.Content = panel;
                _Versions.Add(newItem);
            }
        }

        OnPropertyChanged("Versions");

        if (_Initialized)
        {
            DontSaveVersion = true;
                int versionToPrefer = Configuration.GetInt("Mods." + versions[versions.Keys.ToArray()[0]].Game.GameConfiguration.ID + "." + versions[versions.Keys.ToArray()[0]].ID + ".Version");
                bool found = false;
                foreach (ListViewItem item in _Versions)
                {
                    Mod mod = ((ModVersionViewModel)item.DataContext).mod;
                    int build = Mod.Header.ParseModVersion(mod.header.GetVersion());
                    if (build == versionToPrefer)
                    {
                        SelectedVersion = item;
                        found = true;
                    }
                }
                if (!found)
                {
                    if (_Versions.Count > 0)
                        SelectedVersion = _Versions[0];
                    else
                        SelectedVersion = null;
                }
                DontSaveVersion = false;
                OnPropertyChanged("SelectedVersion");
                OnPropertyChanged("Name");
                OnPropertyChanged("Description");
                OnPropertyChanged("Version");
            }
    }
Example #2
0
 private static System.Collections.ObjectModel.ObservableCollection<object> Get_e_24_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // e_25 element
     TabItem e_25 = new TabItem();
     e_25.Name = "e_25";
     e_25.HorizontalContentAlignment = HorizontalAlignment.Stretch;
     e_25.SetResourceReference(TabItem.HeaderProperty, "GameText");
     // e_26 element
     Grid e_26 = new Grid();
     e_25.Content = e_26;
     e_26.Name = "e_26";
     e_26.Margin = new Thickness(10F, 10F, 10F, 10F);
     RowDefinition row_e_26_0 = new RowDefinition();
     row_e_26_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_0);
     RowDefinition row_e_26_1 = new RowDefinition();
     row_e_26_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_1);
     RowDefinition row_e_26_2 = new RowDefinition();
     row_e_26_2.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_2);
     RowDefinition row_e_26_3 = new RowDefinition();
     row_e_26_3.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_3);
     RowDefinition row_e_26_4 = new RowDefinition();
     row_e_26_4.Height = new GridLength(1F, GridUnitType.Auto);
     e_26.RowDefinitions.Add(row_e_26_4);
     ColumnDefinition col_e_26_0 = new ColumnDefinition();
     col_e_26_0.Width = new GridLength(58F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_0);
     ColumnDefinition col_e_26_1 = new ColumnDefinition();
     col_e_26_1.Width = new GridLength(134F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_1);
     ColumnDefinition col_e_26_2 = new ColumnDefinition();
     col_e_26_2.Width = new GridLength(193F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_2);
     ColumnDefinition col_e_26_3 = new ColumnDefinition();
     col_e_26_3.Width = new GridLength(192F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_3);
     ColumnDefinition col_e_26_4 = new ColumnDefinition();
     col_e_26_4.Width = new GridLength(193F, GridUnitType.Star);
     e_26.ColumnDefinitions.Add(col_e_26_4);
     // e_27 element
     TextBlock e_27 = new TextBlock();
     e_26.Children.Add(e_27);
     e_27.Name = "e_27";
     e_27.Margin = new Thickness(0F, 6F, 0F, 5F);
     e_27.VerticalAlignment = VerticalAlignment.Center;
     e_27.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetColumnSpan(e_27, 2);
     e_27.SetResourceReference(TextBlock.TextProperty, "DifficultyText");
     // cbDifficulty element
     ComboBox cbDifficulty = new ComboBox();
     e_26.Children.Add(cbDifficulty);
     cbDifficulty.Name = "cbDifficulty";
     cbDifficulty.Margin = new Thickness(2F, 2F, 2F, 3F);
     cbDifficulty.VerticalAlignment = VerticalAlignment.Center;
     cbDifficulty.ItemsSource = Get_cbDifficulty_Items();
     Grid.SetColumn(cbDifficulty, 2);
     Binding binding_cbDifficulty_SelectedIndex = new Binding("Difficulty");
     cbDifficulty.SetBinding(ComboBox.SelectedIndexProperty, binding_cbDifficulty_SelectedIndex);
     // e_31 element
     TextBlock e_31 = new TextBlock();
     e_26.Children.Add(e_31);
     e_31.Name = "e_31";
     e_31.Margin = new Thickness(0F, 6F, 0F, 5F);
     e_31.VerticalAlignment = VerticalAlignment.Center;
     e_31.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetRow(e_31, 1);
     Grid.SetColumnSpan(e_31, 2);
     e_31.SetResourceReference(TextBlock.TextProperty, "LanguageText");
     // cbLanguage element
     ComboBox cbLanguage = new ComboBox();
     e_26.Children.Add(cbLanguage);
     cbLanguage.Name = "cbLanguage";
     cbLanguage.Margin = new Thickness(2F, 3F, 2F, 2F);
     cbLanguage.VerticalAlignment = VerticalAlignment.Center;
     cbLanguage.ItemsSource = Get_cbLanguage_Items();
     Grid.SetColumn(cbLanguage, 2);
     Grid.SetRow(cbLanguage, 1);
     Binding binding_cbLanguage_SelectedIndex = new Binding("Language");
     cbLanguage.SetBinding(ComboBox.SelectedIndexProperty, binding_cbLanguage_SelectedIndex);
     items.Add(e_25);
     // e_36 element
     TabItem e_36 = new TabItem();
     e_36.Name = "e_36";
     e_36.SetResourceReference(TabItem.HeaderProperty, "VideoText");
     // e_37 element
     Grid e_37 = new Grid();
     e_36.Content = e_37;
     e_37.Name = "e_37";
     e_37.Margin = new Thickness(10F, 10F, 10F, 10F);
     RowDefinition row_e_37_0 = new RowDefinition();
     row_e_37_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_37.RowDefinitions.Add(row_e_37_0);
     RowDefinition row_e_37_1 = new RowDefinition();
     row_e_37_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_37.RowDefinitions.Add(row_e_37_1);
     RowDefinition row_e_37_2 = new RowDefinition();
     row_e_37_2.Height = new GridLength(1F, GridUnitType.Auto);
     e_37.RowDefinitions.Add(row_e_37_2);
     RowDefinition row_e_37_3 = new RowDefinition();
     row_e_37_3.Height = new GridLength(1F, GridUnitType.Auto);
     e_37.RowDefinitions.Add(row_e_37_3);
     RowDefinition row_e_37_4 = new RowDefinition();
     row_e_37_4.Height = new GridLength(1F, GridUnitType.Auto);
     e_37.RowDefinitions.Add(row_e_37_4);
     ColumnDefinition col_e_37_0 = new ColumnDefinition();
     e_37.ColumnDefinitions.Add(col_e_37_0);
     ColumnDefinition col_e_37_1 = new ColumnDefinition();
     e_37.ColumnDefinitions.Add(col_e_37_1);
     ColumnDefinition col_e_37_2 = new ColumnDefinition();
     e_37.ColumnDefinitions.Add(col_e_37_2);
     ColumnDefinition col_e_37_3 = new ColumnDefinition();
     e_37.ColumnDefinitions.Add(col_e_37_3);
     // e_38 element
     TextBlock e_38 = new TextBlock();
     e_37.Children.Add(e_38);
     e_38.Name = "e_38";
     e_38.VerticalAlignment = VerticalAlignment.Center;
     e_38.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     e_38.SetResourceReference(TextBlock.TextProperty, "ResolutionText");
     // cbResolution element
     ComboBox cbResolution = new ComboBox();
     e_37.Children.Add(cbResolution);
     cbResolution.Name = "cbResolution";
     cbResolution.Margin = new Thickness(2F, 2F, 2F, 2F);
     cbResolution.VerticalAlignment = VerticalAlignment.Center;
     Grid.SetColumn(cbResolution, 1);
     Binding binding_cbResolution_ItemsSource = new Binding("AvailableResolutions");
     cbResolution.SetBinding(ComboBox.ItemsSourceProperty, binding_cbResolution_ItemsSource);
     Binding binding_cbResolution_SelectedIndex = new Binding("ResolutionSelectedIndex");
     cbResolution.SetBinding(ComboBox.SelectedIndexProperty, binding_cbResolution_SelectedIndex);
     // e_39 element
     TextBlock e_39 = new TextBlock();
     e_37.Children.Add(e_39);
     e_39.Name = "e_39";
     e_39.VerticalAlignment = VerticalAlignment.Center;
     e_39.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetRow(e_39, 1);
     e_39.SetResourceReference(TextBlock.TextProperty, "DisplayModeText");
     // cbDisplayMode element
     ComboBox cbDisplayMode = new ComboBox();
     e_37.Children.Add(cbDisplayMode);
     cbDisplayMode.Name = "cbDisplayMode";
     cbDisplayMode.Margin = new Thickness(2F, 2F, 2F, 2F);
     cbDisplayMode.VerticalAlignment = VerticalAlignment.Center;
     cbDisplayMode.ItemsSource = Get_cbDisplayMode_Items();
     Grid.SetColumn(cbDisplayMode, 1);
     Grid.SetRow(cbDisplayMode, 1);
     Binding binding_cbDisplayMode_SelectedIndex = new Binding("DisplayModeSelectedIndex");
     cbDisplayMode.SetBinding(ComboBox.SelectedIndexProperty, binding_cbDisplayMode_SelectedIndex);
     // e_43 element
     TextBlock e_43 = new TextBlock();
     e_37.Children.Add(e_43);
     e_43.Name = "e_43";
     e_43.VerticalAlignment = VerticalAlignment.Center;
     e_43.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetRow(e_43, 2);
     e_43.SetResourceReference(TextBlock.TextProperty, "VerticalSyncText");
     // chkVerticalSync element
     CheckBox chkVerticalSync = new CheckBox();
     e_37.Children.Add(chkVerticalSync);
     chkVerticalSync.Name = "chkVerticalSync";
     chkVerticalSync.Margin = new Thickness(5F, 5F, 5F, 5F);
     chkVerticalSync.HorizontalAlignment = HorizontalAlignment.Center;
     chkVerticalSync.VerticalAlignment = VerticalAlignment.Center;
     Grid.SetColumn(chkVerticalSync, 1);
     Grid.SetRow(chkVerticalSync, 2);
     Binding binding_chkVerticalSync_IsChecked = new Binding("VerticalSyncEnabled");
     chkVerticalSync.SetBinding(CheckBox.IsCheckedProperty, binding_chkVerticalSync_IsChecked);
     // e_44 element
     TextBlock e_44 = new TextBlock();
     e_37.Children.Add(e_44);
     e_44.Name = "e_44";
     e_44.Margin = new Thickness(10F, 0F, 0F, 0F);
     e_44.VerticalAlignment = VerticalAlignment.Center;
     e_44.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetColumn(e_44, 2);
     e_44.SetResourceReference(TextBlock.TextProperty, "GammaText");
     // slGamma element
     Slider slGamma = new Slider();
     e_37.Children.Add(slGamma);
     slGamma.Name = "slGamma";
     slGamma.VerticalAlignment = VerticalAlignment.Center;
     slGamma.Minimum = 0F;
     slGamma.Maximum = 1F;
     Grid.SetColumn(slGamma, 3);
     Binding binding_slGamma_Value = new Binding("Gamma");
     slGamma.SetBinding(Slider.ValueProperty, binding_slGamma_Value);
     // e_45 element
     TextBlock e_45 = new TextBlock();
     e_37.Children.Add(e_45);
     e_45.Name = "e_45";
     e_45.Margin = new Thickness(10F, 0F, 0F, 0F);
     e_45.VerticalAlignment = VerticalAlignment.Center;
     e_45.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetColumn(e_45, 2);
     Grid.SetRow(e_45, 1);
     e_45.SetResourceReference(TextBlock.TextProperty, "AntialiasingText");
     // chAntialiasing element
     CheckBox chAntialiasing = new CheckBox();
     e_37.Children.Add(chAntialiasing);
     chAntialiasing.Name = "chAntialiasing";
     chAntialiasing.Margin = new Thickness(5F, 5F, 5F, 5F);
     chAntialiasing.HorizontalAlignment = HorizontalAlignment.Center;
     chAntialiasing.VerticalAlignment = VerticalAlignment.Center;
     Grid.SetColumn(chAntialiasing, 3);
     Grid.SetRow(chAntialiasing, 1);
     Binding binding_chAntialiasing_IsChecked = new Binding("AntialiasingEnabled");
     chAntialiasing.SetBinding(CheckBox.IsCheckedProperty, binding_chAntialiasing_IsChecked);
     items.Add(e_36);
     // e_46 element
     TabItem e_46 = new TabItem();
     e_46.Name = "e_46";
     e_46.SetResourceReference(TabItem.HeaderProperty, "AudioText");
     // e_47 element
     Grid e_47 = new Grid();
     e_46.Content = e_47;
     e_47.Name = "e_47";
     e_47.Margin = new Thickness(10F, 10F, 10F, 10F);
     RowDefinition row_e_47_0 = new RowDefinition();
     row_e_47_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_47.RowDefinitions.Add(row_e_47_0);
     RowDefinition row_e_47_1 = new RowDefinition();
     row_e_47_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_47.RowDefinitions.Add(row_e_47_1);
     RowDefinition row_e_47_2 = new RowDefinition();
     row_e_47_2.Height = new GridLength(1F, GridUnitType.Auto);
     e_47.RowDefinitions.Add(row_e_47_2);
     RowDefinition row_e_47_3 = new RowDefinition();
     row_e_47_3.Height = new GridLength(1F, GridUnitType.Auto);
     e_47.RowDefinitions.Add(row_e_47_3);
     RowDefinition row_e_47_4 = new RowDefinition();
     row_e_47_4.Height = new GridLength(1F, GridUnitType.Auto);
     e_47.RowDefinitions.Add(row_e_47_4);
     ColumnDefinition col_e_47_0 = new ColumnDefinition();
     e_47.ColumnDefinitions.Add(col_e_47_0);
     ColumnDefinition col_e_47_1 = new ColumnDefinition();
     e_47.ColumnDefinitions.Add(col_e_47_1);
     ColumnDefinition col_e_47_2 = new ColumnDefinition();
     e_47.ColumnDefinitions.Add(col_e_47_2);
     ColumnDefinition col_e_47_3 = new ColumnDefinition();
     e_47.ColumnDefinitions.Add(col_e_47_3);
     // e_48 element
     TextBlock e_48 = new TextBlock();
     e_47.Children.Add(e_48);
     e_48.Name = "e_48";
     e_48.VerticalAlignment = VerticalAlignment.Center;
     e_48.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     e_48.SetResourceReference(TextBlock.TextProperty, "MasterVolumeText");
     // masterVolume element
     Slider masterVolume = new Slider();
     e_47.Children.Add(masterVolume);
     masterVolume.Name = "masterVolume";
     masterVolume.Margin = new Thickness(5F, 5F, 5F, 5F);
     masterVolume.VerticalAlignment = VerticalAlignment.Center;
     masterVolume.Minimum = 0F;
     masterVolume.Maximum = 100F;
     Grid.SetColumn(masterVolume, 1);
     Binding binding_masterVolume_Value = new Binding("MasterVolume");
     masterVolume.SetBinding(Slider.ValueProperty, binding_masterVolume_Value);
     // e_49 element
     TextBlock e_49 = new TextBlock();
     e_47.Children.Add(e_49);
     e_49.Name = "e_49";
     e_49.VerticalAlignment = VerticalAlignment.Center;
     e_49.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetRow(e_49, 1);
     e_49.SetResourceReference(TextBlock.TextProperty, "MusicVolumeText");
     // musicVolume element
     Slider musicVolume = new Slider();
     e_47.Children.Add(musicVolume);
     musicVolume.Name = "musicVolume";
     musicVolume.Margin = new Thickness(5F, 5F, 5F, 5F);
     musicVolume.VerticalAlignment = VerticalAlignment.Center;
     musicVolume.Minimum = 0F;
     musicVolume.Maximum = 100F;
     Grid.SetColumn(musicVolume, 1);
     Grid.SetRow(musicVolume, 1);
     Binding binding_musicVolume_Value = new Binding("MusicVolume");
     musicVolume.SetBinding(Slider.ValueProperty, binding_musicVolume_Value);
     // e_50 element
     TextBlock e_50 = new TextBlock();
     e_47.Children.Add(e_50);
     e_50.Name = "e_50";
     e_50.VerticalAlignment = VerticalAlignment.Center;
     e_50.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetRow(e_50, 2);
     e_50.SetResourceReference(TextBlock.TextProperty, "SoundsVolumeText");
     // soundsVolume element
     Slider soundsVolume = new Slider();
     e_47.Children.Add(soundsVolume);
     soundsVolume.Name = "soundsVolume";
     soundsVolume.Margin = new Thickness(5F, 5F, 5F, 5F);
     soundsVolume.VerticalAlignment = VerticalAlignment.Center;
     soundsVolume.Minimum = 0F;
     soundsVolume.Maximum = 100F;
     Grid.SetColumn(soundsVolume, 1);
     Grid.SetRow(soundsVolume, 2);
     Binding binding_soundsVolume_Value = new Binding("SoundsVolume");
     soundsVolume.SetBinding(Slider.ValueProperty, binding_soundsVolume_Value);
     items.Add(e_46);
     // e_51 element
     TabItem e_51 = new TabItem();
     e_51.Name = "e_51";
     e_51.SetResourceReference(TabItem.HeaderProperty, "ControlsText");
     // e_52 element
     Grid e_52 = new Grid();
     e_51.Content = e_52;
     e_52.Name = "e_52";
     e_52.Margin = new Thickness(10F, 10F, 10F, 10F);
     RowDefinition row_e_52_0 = new RowDefinition();
     row_e_52_0.Height = new GridLength(1F, GridUnitType.Auto);
     e_52.RowDefinitions.Add(row_e_52_0);
     RowDefinition row_e_52_1 = new RowDefinition();
     row_e_52_1.Height = new GridLength(1F, GridUnitType.Auto);
     e_52.RowDefinitions.Add(row_e_52_1);
     RowDefinition row_e_52_2 = new RowDefinition();
     row_e_52_2.Height = new GridLength(1F, GridUnitType.Auto);
     e_52.RowDefinitions.Add(row_e_52_2);
     RowDefinition row_e_52_3 = new RowDefinition();
     row_e_52_3.Height = new GridLength(1F, GridUnitType.Auto);
     e_52.RowDefinitions.Add(row_e_52_3);
     RowDefinition row_e_52_4 = new RowDefinition();
     row_e_52_4.Height = new GridLength(1F, GridUnitType.Auto);
     e_52.RowDefinitions.Add(row_e_52_4);
     ColumnDefinition col_e_52_0 = new ColumnDefinition();
     e_52.ColumnDefinitions.Add(col_e_52_0);
     ColumnDefinition col_e_52_1 = new ColumnDefinition();
     e_52.ColumnDefinitions.Add(col_e_52_1);
     ColumnDefinition col_e_52_2 = new ColumnDefinition();
     e_52.ColumnDefinitions.Add(col_e_52_2);
     ColumnDefinition col_e_52_3 = new ColumnDefinition();
     e_52.ColumnDefinitions.Add(col_e_52_3);
     // e_53 element
     TextBlock e_53 = new TextBlock();
     e_52.Children.Add(e_53);
     e_53.Name = "e_53";
     e_53.VerticalAlignment = VerticalAlignment.Center;
     e_53.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     e_53.SetResourceReference(TextBlock.TextProperty, "SensitivityText");
     // sensitivity element
     Slider sensitivity = new Slider();
     e_52.Children.Add(sensitivity);
     sensitivity.Name = "sensitivity";
     sensitivity.Margin = new Thickness(5F, 5F, 5F, 5F);
     sensitivity.VerticalAlignment = VerticalAlignment.Center;
     sensitivity.Minimum = 0F;
     sensitivity.Maximum = 100F;
     Grid.SetColumn(sensitivity, 1);
     Binding binding_sensitivity_Value = new Binding("Sensitivity");
     sensitivity.SetBinding(Slider.ValueProperty, binding_sensitivity_Value);
     // e_54 element
     TextBlock e_54 = new TextBlock();
     e_52.Children.Add(e_54);
     e_54.Name = "e_54";
     e_54.VerticalAlignment = VerticalAlignment.Center;
     e_54.Foreground = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     Grid.SetRow(e_54, 1);
     e_54.SetResourceReference(TextBlock.TextProperty, "InvertVerticalText");
     // chkInvert element
     CheckBox chkInvert = new CheckBox();
     e_52.Children.Add(chkInvert);
     chkInvert.Name = "chkInvert";
     chkInvert.Margin = new Thickness(5F, 5F, 5F, 5F);
     chkInvert.HorizontalAlignment = HorizontalAlignment.Center;
     chkInvert.VerticalAlignment = VerticalAlignment.Center;
     Grid.SetColumn(chkInvert, 1);
     Grid.SetRow(chkInvert, 1);
     Binding binding_chkInvert_IsChecked = new Binding("InvertVertical");
     chkInvert.SetBinding(CheckBox.IsCheckedProperty, binding_chkInvert_IsChecked);
     items.Add(e_51);
     return items;
 }
Example #3
0
    protected void AddLanguageButton(string LangCode)
    {
        Button newButton = new Button();
        newButton.Style = Application.Current.FindResource("NormalButton") as Style;
        newButton.DataContext = LangCode;
        newButton.Click += RemoveLanguage;
        newButton.Margin = new Thickness(0, 0, 10, 0);

        StackPanel panel = new StackPanel();
        panel.Orientation = Orientation.Horizontal;
        Image image = new Image();
        image.Height = 20;
        BitmapImage source = new BitmapImage();
        source.BeginInit();
        source.UriSource = new Uri("pack://application:,,,/ModAPI;component/resources/textures/Icons/Lang_" + LangCode + ".png");
        source.EndInit();
        image.Source = source;
        image.Margin = new Thickness(0, 0, 5, 0);
        panel.Children.Add(image);

        Image image2 = new Image();
        image2.Height = 24;
        BitmapImage source2 = new BitmapImage();
        source2.BeginInit();
        source2.UriSource = new Uri("pack://application:,,,/ModAPI;component/resources/textures/Icons/Icon_Delete.png");
        source2.EndInit();
        image2.Source = source2;
        image2.Margin = new Thickness(5, 0, 0, 0);

        TextBlock label = new TextBlock();
        label.SetResourceReference(TextBlock.TextProperty, "Lang.Languages." + LangCode);
        panel.Children.Add(label);
        panel.Children.Add(image2);

        newButton.Content = panel;
        _LanguageButtons.Add(newButton);
        _Languages.Add(LangCode);
    }