Ejemplo n.º 1
0
    public ModProjectViewModel(ModProject project)
    {
        this.Project = project;
        if (this.Project.Name == null)
            this.Project.Name = new MultilingualValue();
        this.Project.Name.OnChange += NameChanged;
        this.Project.Description.OnChange += NameChanged;
        foreach (string LangCode in this.Project.Languages)
        {
            AddLanguageButton(LangCode);
            /*<Button Style="{StaticResource NormalButton}">
                                                    <StackPanel Orientation="Horizontal" Margin="-10,-17,-10,-16">
                                                        <TextBlock Text="Englisch" VerticalAlignment="Center" Margin="10,0,10,0" />
                                                        <Image Source="/resources/textures/Icons/Icon_Delete.png" Height="20" Margin="0,0,5,0" />
                                                    </StackPanel>
                                                </Button>*/
        }

        foreach (ModProject.Button button in project.Buttons)
        {
            ModProjectButton _button = new ModProjectButton();
            _button.DataContext = new ModProjectButtonViewModel(this, button);
            _Buttons.Add(_button);
        }

        CheckForErrors();
    }
Ejemplo n.º 2
0
 public void AddButton()
 {
     try
     {
         ModProject.Button button = new ModProject.Button();
         button.project = Project;
         Project.Buttons.Add(button);
         ModProjectButton _button = new ModProjectButton();
         _button.DataContext = new ModProjectButtonViewModel(this, button);
         _Buttons.Add(_button);
     }
     catch (Exception e)
     {
         System.Console.WriteLine(e.ToString());
     }
 }