MainWindow geändert, dynamische Menu erzeugt
This commit is contained in:
@@ -4,9 +4,14 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:self="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
||||
xmlns:iself ="clr-namespace:KanSan.Base.Interfaces.UI;assembly=KanSan.Base"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
xmlns:sd="clr-namespace:KanSan.SampleData"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800" Background="LightGray">
|
||||
<d:UserControl.DataContext>
|
||||
<sd:ObjekteEditViewModelSampleData GenehmigungErforderlich="True" />
|
||||
</d:UserControl.DataContext>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -23,12 +28,13 @@
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Content="Speichern" Name="Speichern" Click="Speichern_Click"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<CheckBox Content="Rohrleitung in Betrieb" IsChecked="True" Style="{StaticResource checkBoxCircle}"/>
|
||||
<CheckBox Content="Wasserhaltung durchgeführt" IsChecked="True" Style="{StaticResource checkBoxCircle}" />
|
||||
<CheckBox Content="Haltung gespült" IsChecked="True" Style="{StaticResource checkBoxCircle}" />
|
||||
<CheckBox Content="Genehmigung Erforderlich" IsChecked="True" Style="{StaticResource checkBoxCircle}" />
|
||||
<CheckBox Content="Baustellen sicherung erforderlich" IsChecked="False" Style="{StaticResource checkBoxCircle}" />
|
||||
<CheckBox Content="Rohrleitung in Betrieb" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.RohrleitungInBetrieb)}" Style="{StaticResource checkBoxCircle}"/>
|
||||
<CheckBox Content="Wasserhaltung durchgeführt" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.WasserHaltungDurchgefuehrt)}" Style="{StaticResource checkBoxCircle}" />
|
||||
<CheckBox Content="Haltung gespült" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.HaltungGespuelt)}" Style="{StaticResource checkBoxCircle}" />
|
||||
<CheckBox Content="Genehmigung Erforderlich" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.GenehmigungErforderlich)}" Style="{StaticResource checkBoxCircle}" />
|
||||
<CheckBox Content="Baustellen sicherung erforderlich" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.BaustellenAbsicherung)}" Style="{StaticResource checkBoxCircle}" />
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -50,11 +56,11 @@
|
||||
<Label Grid.Row="4" Grid.Column="0" Content="Durchmesser" />
|
||||
<Label Grid.Row="5" Grid.Column="0" Content="Material" />
|
||||
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Strassename}" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding OberePunkt}" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding UnterePunkt}" />
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Objektnummer}" />
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding DN}" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=(iself:IObjekteEditViewModel.StrasseName)}" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=(iself:IObjekteEditViewModel.PunktOben)}" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=(iself:IObjekteEditViewModel.PunktUnten)}" />
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=(iself:IObjekteEditViewModel.Objektnummer)}" />
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Path=(iself:IObjekteEditViewModel.Durchmesser)}" />
|
||||
<ComboBox Grid.Row="5" Grid.Column="1">
|
||||
<ComboBoxItem Content="Lala" />
|
||||
<ComboBoxItem Content="Haha" />
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
@@ -18,9 +20,15 @@ namespace KanSan.UI
|
||||
/// </summary>
|
||||
public partial class UCObjektEdit : UserControl
|
||||
{
|
||||
public UCObjektEdit()
|
||||
public UCObjektEdit(Sewer objekt)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new ObjekteEditViewModel(objekt);
|
||||
}
|
||||
|
||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(DataContext as ObjekteEditViewModel).Speichern();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
28
KanSan/UI/UCSewerMainMenu.xaml
Normal file
28
KanSan/UI/UCSewerMainMenu.xaml
Normal file
@@ -0,0 +1,28 @@
|
||||
<UserControl x:Class="KanSan.UI.UCSewerMainMenu"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:self="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="./../my_controls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
|
||||
<StackPanel Name="MenuItems">
|
||||
<TextBlock Text="{Binding Path=(self:SewerMainMenuViewModel.ObjektBezeichnung)}" />
|
||||
<RadioButton Name="rbStammdaten" Checked="rbSewerMenuItem_Checked" Style="{StaticResource ToggelButtonList}" Content="Stammdaten" />
|
||||
<RadioButton Name="rbSchaeden" Checked="rbSewerMenuItem_Checked" Style="{StaticResource ToggelButtonList}" Content="Schäden" />
|
||||
<RadioButton Name="rbSchlauch1" Checked="rbSewerMenuItem_Checked" Style="{StaticResource ToggelButtonList}" Content="Schlauchliner" />
|
||||
<RadioButton Name="rbSchachtAnb1" Checked="rbSewerMenuItem_Checked" Style="{StaticResource ToggelButtonList}" Content="Schachtanbindung 1" />
|
||||
<RadioButton Name="Kurzliner1" Checked="rbSewerMenuItem_Checked" Style="{StaticResource ToggelButtonList}" Content="Kurzliner" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
76
KanSan/UI/UCSewerMainMenu.xaml.cs
Normal file
76
KanSan/UI/UCSewerMainMenu.xaml.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using KanSan.Base.Models;
|
||||
using KanSan.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace KanSan.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für UCSewerMainMenu.xaml
|
||||
/// </summary>
|
||||
public partial class UCSewerMainMenu : UserControl
|
||||
{
|
||||
public event EventHandler<SewerMainMenuItemSelectedEventArgs> SewerMainMenuSelected;
|
||||
|
||||
protected virtual void OnSewerMenuSelected(SewerMainMenuItemSelectedEventArgs e)
|
||||
{
|
||||
EventHandler<SewerMainMenuItemSelectedEventArgs> handler = SewerMainMenuSelected;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
|
||||
public UCSewerMainMenu(Sewer objekt)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new SewerMainMenuViewModel(objekt);
|
||||
Style style = this.FindResource("ToggelButtonList") as Style;
|
||||
|
||||
RadioButton radioButton = new RadioButton();
|
||||
radioButton.Name = "Schlauch122123";
|
||||
radioButton.Content = "Schlauchliner";
|
||||
radioButton.Style = style;
|
||||
radioButton.Checked += rbSewerMenuItem_Checked;
|
||||
|
||||
MenuItems.Children.Add(radioButton);
|
||||
}
|
||||
|
||||
private void rbSewerMenuItem_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RadioButton radioButton = (RadioButton)sender;
|
||||
if (radioButton == null) return;
|
||||
//Debugger.Break();
|
||||
ESewerMainMenuCommand command = ESewerMainMenuCommand.NONE;
|
||||
if (radioButton.Name.Equals("rbStammdaten")) command = ESewerMainMenuCommand.STAMMDATEN;
|
||||
else if (radioButton.Name.Equals("rbSchaeden")) command = ESewerMainMenuCommand.SCHAEDEN;
|
||||
|
||||
OnSewerMenuSelected(new SewerMainMenuItemSelectedEventArgs()
|
||||
{
|
||||
Command = command
|
||||
}) ;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ESewerMainMenuCommand
|
||||
{
|
||||
NONE,
|
||||
STAMMDATEN,
|
||||
SCHAEDEN,
|
||||
SANIERUNG
|
||||
}
|
||||
public class SewerMainMenuItemSelectedEventArgs : EventArgs
|
||||
{
|
||||
public ESewerMainMenuCommand Command { get; set; }
|
||||
public int Parameter { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user