Erstes Commit
This commit is contained in:
commit
fafa24932d
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,173 @@
|
||||||
|
<Window x:Class="System.Windows.Window"
|
||||||
|
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:local="clr-namespace:errordialogXaML"
|
||||||
|
Name="MainWindow"
|
||||||
|
Title="__DIALOGTITLE__"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterOwner"
|
||||||
|
SizeToContent="WidthAndHeight"
|
||||||
|
Width="420"
|
||||||
|
MinWidth="420"
|
||||||
|
MaxWidth="700"
|
||||||
|
Height="212"
|
||||||
|
MinHeight="212"
|
||||||
|
WindowStyle="None"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Transparent"
|
||||||
|
Padding="20"
|
||||||
|
Margin="0"
|
||||||
|
ShowInTaskbar="False">
|
||||||
|
<Window.Resources>
|
||||||
|
|
||||||
|
<!-- Button Template. This duplicates the one from ControlTemplates.XaML It's here to make sure this dialog is self contained -->
|
||||||
|
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFC2C2C2" />
|
||||||
|
<SolidColorBrush x:Key="Button.Static.Border" Color="#FFC2C2C2" />
|
||||||
|
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFC2C2C2" />
|
||||||
|
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FFC2C2C2" />
|
||||||
|
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FF606060" />
|
||||||
|
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF606060" />
|
||||||
|
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF0F0F0" />
|
||||||
|
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5" />
|
||||||
|
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383" />
|
||||||
|
<SolidColorBrush x:Key="Button.Default.Foreground" Color="White" />
|
||||||
|
<SolidColorBrush x:Key="Button.Default.Background" Color="#FF005FB8" />
|
||||||
|
<SolidColorBrush x:Key="Button.Default.Border" Color="#FF005FB8" />
|
||||||
|
<Style TargetType="{x:Type Button}">
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}" />
|
||||||
|
<Setter Property="Background" Value="{StaticResource Button.Static.Border}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Padding" Value="8,0,8,4" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type Button}">
|
||||||
|
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true" CornerRadius="4" Padding="0" Margin="0">
|
||||||
|
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsDefault" Value="true">
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource Button.Default.Border}" />
|
||||||
|
<Setter Property="Background" Value="{StaticResource Button.Default.Background}" />
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource Button.Default.Foreground}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true">
|
||||||
|
<Setter Property="Background" Value="{StaticResource Button.MouseOver.Background}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource Button.MouseOver.Border}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsPressed" Value="true">
|
||||||
|
<Setter Property="Background" Value="{StaticResource Button.Pressed.Background}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource Button.Pressed.Border}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Background" Value="{StaticResource Button.Disabled.Background}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource Button.Disabled.Background}" />
|
||||||
|
<Setter Property="TextElement.Foreground" Value="{StaticResource Button.Disabled.Foreground}" />
|
||||||
|
</Trigger>
|
||||||
|
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- TextBox Template. Also a duplicate from ControlTemplates.XaML and included to keep this self-contained. -->
|
||||||
|
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#7F7A7A7A" />
|
||||||
|
<SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF005FB8" />
|
||||||
|
<SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF005FB8" />
|
||||||
|
<Style TargetType="{x:Type TextBox}">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
|
||||||
|
<Setter Property="BorderThickness" Value="0,0,0,1" />
|
||||||
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
||||||
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
|
<Setter Property="AllowDrop" Value="true" />
|
||||||
|
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
|
||||||
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||||
|
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" CornerRadius="4">
|
||||||
|
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" />
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Opacity" TargetName="border" Value="0.56" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="true">
|
||||||
|
<Setter Property="Opacity" TargetName="border" Value="1" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true">
|
||||||
|
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.MouseOver.Border}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsKeyboardFocused" Value="true">
|
||||||
|
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.Focus.Border}" />
|
||||||
|
<Setter Property="BorderThickness" TargetName="border" Value="0,0,0,2" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
|
||||||
|
<Condition Property="IsSelectionActive" Value="false" />
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
|
||||||
|
</MultiTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- A small styler to make the window border respond to being focused or unfocused -->
|
||||||
|
<Style TargetType="Window">
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsActive" Value="False">
|
||||||
|
<Setter Property="BorderBrush" Value="#FFAAAAAA" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsActive" Value="True">
|
||||||
|
<Setter Property="BorderBrush" Value="#FF005FB8" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
<WindowChrome.WindowChrome>
|
||||||
|
<WindowChrome CaptionHeight="0" ResizeBorderThickness="2" CornerRadius="8" />
|
||||||
|
</WindowChrome.WindowChrome>
|
||||||
|
|
||||||
|
<Border BorderThickness="1" BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Background="White" CornerRadius="8" Margin="10,10,10,10">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect BlurRadius="10" ShadowDepth="5" Color="#FF959595" Opacity="0.7" />
|
||||||
|
</Border.Effect>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Name="DialogTitle" Text="__DIALOGTITLE__" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="8,6,0,0" />
|
||||||
|
<DockPanel Margin="22,48,24,24">
|
||||||
|
<TextBlock DockPanel.Dock="Top" Name="H1" Text="__H1__" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0" FontSize="27" />
|
||||||
|
<DockPanel DockPanel.Dock="Top">
|
||||||
|
<Viewbox Name="ErrorIcon" DockPanel.Dock="Left" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Width="32" Stretch="Uniform" HorizontalAlignment="Center" Margin="0" Visibility="Collapsed">
|
||||||
|
<Canvas Name="svg8" Width="8.4666665" Height="8.466677">
|
||||||
|
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4530" Fill="#FFDA4453" StrokeThickness="0.38186711" Stroke="#FFDA4453" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat">
|
||||||
|
<Path.Data>
|
||||||
|
<PathGeometry Figures="m 4.233334 0.19093356 c -2.2325595 0 -4.04240044 1.80984004 -4.04240044 4.04240004 0 2.23257 1.80984094 4.04241 4.04240044 4.04241 2.2325597 0 4.0423991 -1.80984 4.0423991 -4.04241 0 -2.23256 -1.8098394 -4.04240004 -4.0423991 -4.04240004 z m -1.9241831 1.15498004 1.9241831 1.92418 1.9241815 -1.92418 0.963223 0.96322 -1.9241829 1.92419 1.9241829 1.92418 -0.963223 0.96321 -1.9241815 -1.92417 -1.9241831 1.92417 -0.9632231 -0.96321 1.9241831 -1.92418 -1.9241831 -1.92419 z" FillRule="NonZero" />
|
||||||
|
</Path.Data>
|
||||||
|
</Path>
|
||||||
|
</Canvas>
|
||||||
|
</Viewbox>
|
||||||
|
<TextBlock DockPanel.Dock="Left" Name="DialogText" Text="__DIALOGTEXT__" TextWrapping="Wrap" TextAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,8,0,0" FontSize="15" />
|
||||||
|
</DockPanel>
|
||||||
|
<TextBox DockPanel.Dock="Top" Name="Input" Visibility="Hidden" Margin="0,10" FontSize="15" />
|
||||||
|
<StackPanel DockPanel.Dock="Bottom" Margin="0" HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal">
|
||||||
|
<Button Name="CancelButton" Content="__CANCELTEXT__" HorizontalAlignment="Right" Margin="0,0,24,0" VerticalAlignment="Bottom" FontSize="15" FontFamily="Segoe UI Semibold" />
|
||||||
|
<Button Name="ConfirmButton" Content="__CONFIRMTEXT__" HorizontalAlignment="Right" Margin="0" VerticalAlignment="Bottom" IsDefault="True" FontSize="15" FontFamily="Segoe UI Semibold" />
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Window>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,583 @@
|
||||||
|
<!--
|
||||||
|
|
||||||
|
File: MainWindow.xaml
|
||||||
|
Modified Date: 2023-12-07
|
||||||
|
Author: Jeremy Crabtree <jcrabtree at nct911 org> / <jeremylc at gmail>
|
||||||
|
Purpose: Main Program window for the PoSH GUI Template
|
||||||
|
Copyright 2023 NCT 9-1-1
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<Window
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.ouwpgrouprg/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:PoSH_GUI_Template"
|
||||||
|
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
|
||||||
|
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
|
||||||
|
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
|
||||||
|
xmlns:col="clr-namespace:System.Collections;assembly=mscorlib"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
|
x:Class="System.Windows.Window"
|
||||||
|
Title="PI v7"
|
||||||
|
Width="800"
|
||||||
|
MinWidth="800"
|
||||||
|
Height="800"
|
||||||
|
MinHeight="800"
|
||||||
|
Name="DeploymentWindow"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
BorderThickness="0"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
ResizeMode="CanResize"
|
||||||
|
WindowStyle="None"
|
||||||
|
Background="Transparent">
|
||||||
|
<Window.Resources><!-- Empty Resources -->
|
||||||
|
</Window.Resources>
|
||||||
|
<WindowChrome.WindowChrome>
|
||||||
|
<WindowChrome CaptionHeight="{StaticResource TitleBarHeight}"
|
||||||
|
ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}"
|
||||||
|
CornerRadius="8" />
|
||||||
|
</WindowChrome.WindowChrome>
|
||||||
|
<Window.OpacityMask>
|
||||||
|
<VisualBrush Visual="{Binding ElementName=WinBorder}" />
|
||||||
|
</Window.OpacityMask>
|
||||||
|
<Border Name="WinBorder"
|
||||||
|
BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
|
||||||
|
BorderThickness="1" CornerRadius="8" Background="#FFF3F3F3">
|
||||||
|
<Border.Effect>
|
||||||
|
<BlurEffect Radius="0" />
|
||||||
|
</Border.Effect>
|
||||||
|
<Grid Name="MainGrid" Background="Transparent">
|
||||||
|
<Grid.Effect>
|
||||||
|
<BlurEffect Radius="0" />
|
||||||
|
</Grid.Effect>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" Name="MainRow" />
|
||||||
|
<RowDefinition Height="20" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" Name="MenuColumn" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<!-- Titlebar dock -->
|
||||||
|
<!--
|
||||||
|
This is also a grid inside a border to keep the rounded corners.
|
||||||
|
-->
|
||||||
|
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" CornerRadius="8,8,0,0"
|
||||||
|
BorderThickness="0">
|
||||||
|
<DockPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
|
||||||
|
Height="{StaticResource TitleBarHeight}">
|
||||||
|
<!--
|
||||||
|
This is the "hamburger" button that opens the menu. The open/close menu animation
|
||||||
|
is attached to the click event of this button as a trigger.
|
||||||
|
-->
|
||||||
|
<Button DockPanel.Dock="Left" Name="MenuButton"
|
||||||
|
Style="{StaticResource TitleBarButtonStyle}" Tag="Menu"
|
||||||
|
HorizontalContentAlignment="Left" Width="46" RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Button.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<RotateTransform x:Name="MenuButtonRotate" Angle="0" />
|
||||||
|
</TransformGroup>
|
||||||
|
</Button.RenderTransform>
|
||||||
|
<Button.Triggers>
|
||||||
|
<EventTrigger RoutedEvent="Button.Click">
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard Name="MenuOpen">
|
||||||
|
<ParallelTimeline>
|
||||||
|
<DoubleAnimation Name="MenuToggle"
|
||||||
|
Storyboard.TargetName="MenuBorder"
|
||||||
|
Storyboard.TargetProperty="Width" From="0" To="150"
|
||||||
|
Duration="0:0:0.25" AutoReverse="False">
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<QuinticEase EasingMode="EaseInOut" />
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
|
<DoubleAnimation Name="BurgerFlipper"
|
||||||
|
Storyboard.TargetName="MenuButtonRotate"
|
||||||
|
Storyboard.TargetProperty="Angle" From="0" To="90"
|
||||||
|
Duration="0:0:0.25" AutoReverse="False" />
|
||||||
|
<DoubleAnimation Name="BlurPanel"
|
||||||
|
Storyboard.TargetName="MainDockBlur"
|
||||||
|
Storyboard.TargetProperty="Radius" From="0" To="10"
|
||||||
|
Duration="0:0:0.25" AutoReverse="False" />
|
||||||
|
</ParallelTimeline>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</EventTrigger>
|
||||||
|
</Button.Triggers>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<!-- These are the standard Window control buttons -->
|
||||||
|
<Button DockPanel.Dock="Right" Name="CloseButton"
|
||||||
|
Style="{StaticResource TitleBarButtonStyle}" Tag="Close" />
|
||||||
|
<Button DockPanel.Dock="Right" Name="MaximizeButton"
|
||||||
|
Style="{StaticResource TitleBarButtonStyle}" Tag="Maximize" />
|
||||||
|
<Button DockPanel.Dock="Right" Name="RestoreButton"
|
||||||
|
Style="{StaticResource TitleBarButtonStyle}" Tag="Restore"
|
||||||
|
Visibility="Collapsed" />
|
||||||
|
<Button DockPanel.Dock="Right" Name="MinimizeButton"
|
||||||
|
Style="{StaticResource TitleBarButtonStyle}" Tag="Minimize" />
|
||||||
|
|
||||||
|
<!-- Window TitleBar text -->
|
||||||
|
<TextBlock DockPanel.Dock="Left" Margin="8,0" Padding="0"
|
||||||
|
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
|
TextAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||||
|
<TextBlock.Style>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger
|
||||||
|
Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
|
Value="False">
|
||||||
|
<Setter Property="Foreground" Value="#FFAAAAAA" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Style>
|
||||||
|
</TextBlock>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Lefthand menu dock -->
|
||||||
|
<Border Name="MenuBorder" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1"
|
||||||
|
Grid.RowSpan="1" Margin="0,0,0,0" Background="White" BorderThickness="0,1,1,1"
|
||||||
|
CornerRadius="0,4,4,0" BorderBrush="#FFC8C8C8" Panel.ZIndex="10"
|
||||||
|
HorizontalAlignment="Left" Width="0">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect Opacity="0.5" BlurRadius="20" />
|
||||||
|
</Border.Effect>
|
||||||
|
<DockPanel Name="MenuDock" Margin="0,0,0,0">
|
||||||
|
<StackPanel Margin="10,0,10,0" Orientation="Vertical">
|
||||||
|
<Button Name="SaveLogs" DockPanel.Dock="Top" Content="Save Logs"
|
||||||
|
Style="{StaticResource MenuBarButtonStyle}" />
|
||||||
|
<Rectangle Height="1" Margin="0,10,0,10" DockPanel.Dock="Top"
|
||||||
|
Stroke="#FFC8C8C8" />
|
||||||
|
<Button Name="MenuOptionen" DockPanel.Dock="Top" Content="Optionen"
|
||||||
|
Style="{StaticResource MenuBarButtonStyle}" />
|
||||||
|
<Rectangle Height="1" Margin="0,10,0,10" DockPanel.Dock="Top"
|
||||||
|
Stroke="#FFC8C8C8" />
|
||||||
|
<Button Name="MenuAllgemein" DockPanel.Dock="Top" Content="Allgemein"
|
||||||
|
Style="{StaticResource MenuBarButtonStyle}" />
|
||||||
|
<Button Name="MenuComputer" DockPanel.Dock="Top" Content="Computer"
|
||||||
|
Style="{StaticResource MenuBarButtonStyle}" />
|
||||||
|
<Button Name="MenuBenutzer" DockPanel.Dock="Top" Content="Benutzer"
|
||||||
|
Style="{StaticResource MenuBarButtonStyle}" />
|
||||||
|
<Button Name="MenuGruppen" DockPanel.Dock="Top" Content="Gruppen"
|
||||||
|
Style="{StaticResource MenuBarButtonStyle}" />
|
||||||
|
<Button Name="MenuServer" DockPanel.Dock="Top" Content="Server"
|
||||||
|
Style="{StaticResource MenuBarButtonStyle}" />
|
||||||
|
<Button Name="MenuDienststellen" DockPanel.Dock="Top"
|
||||||
|
Content="Dienststellen"
|
||||||
|
Style="{StaticResource MenuBarButtonStyle}" />
|
||||||
|
<Rectangle Height="1" Margin="0,10,0,10" DockPanel.Dock="Top"
|
||||||
|
Stroke="#FFC8C8C8" />
|
||||||
|
<Button Name="MenuExit" DockPanel.Dock="Top" Content="Exit"
|
||||||
|
Style="{StaticResource MenuBarButtonStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Main Tab Panel -->
|
||||||
|
|
||||||
|
<TabControl Name="TabControl" Margin="0" Grid.Row="1" Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="2">
|
||||||
|
<TabControl.ItemContainerStyle>
|
||||||
|
<Style TargetType="{x:Type TabItem}">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed" />
|
||||||
|
</Style>
|
||||||
|
</TabControl.ItemContainerStyle>
|
||||||
|
<TabControl.Effect>
|
||||||
|
<BlurEffect x:Name="MainDockBlur" Radius="0" />
|
||||||
|
</TabControl.Effect>
|
||||||
|
<TabItem Header="Allgemein">
|
||||||
|
<Border Margin="0" BorderThickness="0">
|
||||||
|
<DockPanel Margin="0">
|
||||||
|
<DockPanel Margin="10,0,10,0" DockPanel.Dock="Top">
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Right"
|
||||||
|
HorizontalAlignment="Stretch">
|
||||||
|
<GroupBox Margin="0" VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch">
|
||||||
|
<GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Label Content="Allgemein" FontSize="14"
|
||||||
|
FontWeight="Bold" Padding="4,4,0,0"
|
||||||
|
VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox.Header>
|
||||||
|
</GroupBox>
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Computer">
|
||||||
|
<Border Margin="0" BorderThickness="0">
|
||||||
|
<DockPanel Margin="0">
|
||||||
|
<DockPanel Margin="10,0,10,0" DockPanel.Dock="Top">
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Left"
|
||||||
|
HorizontalAlignment="Left" VerticalAlignment="Top" Height="500">
|
||||||
|
<GroupBox Margin="0" VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch">
|
||||||
|
<GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock TextAlignment="Center" Margin="0"
|
||||||
|
FontSize="14">
|
||||||
|
<Run Text="Suche" Foreground="Black" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Top">
|
||||||
|
<Label Content="ComboBox 1" Margin="0"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Top" />
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
<GroupBox Margin="0,5,0,0" VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch">
|
||||||
|
<!-- <GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock TextAlignment="Center" Margin="0"
|
||||||
|
FontSize="14">
|
||||||
|
<Run Text="Aktionen" Foreground="Black" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox.Header> -->
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="150" />
|
||||||
|
<ColumnDefinition Width="150" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Button Grid.Row="0" Grid.Column="0" Name="Ping"
|
||||||
|
Content="Ping"
|
||||||
|
HorizontalAlignment="Stretch" Height="30"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal" Margin="5,10,5,0"
|
||||||
|
IsEnabled="True" />
|
||||||
|
<Button Grid.Row="0" Grid.Column="1" Name="Aktion2"
|
||||||
|
Content="Aktion 2"
|
||||||
|
HorizontalAlignment="Stretch" Height="30"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal" Margin="5,10,5,0"
|
||||||
|
IsEnabled="True" />
|
||||||
|
<Button Grid.Row="1" Grid.Column="0" Name="Aktion3"
|
||||||
|
Content="Aktion 3"
|
||||||
|
HorizontalAlignment="Stretch" Height="30"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal" Margin="5,10,5,0"
|
||||||
|
IsEnabled="True" />
|
||||||
|
<Button Grid.Row="1" Grid.Column="1" Name="Aktion4"
|
||||||
|
Content="Aktion 4"
|
||||||
|
HorizontalAlignment="Stretch" Height="30"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal" Margin="5,10,5,0"
|
||||||
|
IsEnabled="True" />
|
||||||
|
<Button Grid.Row="2" Grid.Column="0" Name="Aktion5"
|
||||||
|
Content="Aktion 5"
|
||||||
|
HorizontalAlignment="Stretch" Height="30"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal" Margin="5,10,5,0"
|
||||||
|
IsEnabled="True" />
|
||||||
|
<Button Grid.Row="2" Grid.Column="1" Name="Aktion6"
|
||||||
|
Content="Aktion 6"
|
||||||
|
HorizontalAlignment="Stretch" Height="30"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal" Margin="5,10,5,0"
|
||||||
|
IsEnabled="True" />
|
||||||
|
<Button Grid.Row="3" Grid.Column="0" Name="Aktion7"
|
||||||
|
Content="Aktion 7"
|
||||||
|
HorizontalAlignment="Stretch" Height="30"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal" Margin="5,10,5,0"
|
||||||
|
IsEnabled="True" />
|
||||||
|
<Button Grid.Row="3" Grid.Column="1" Name="Aktion8"
|
||||||
|
Content="Aktion 8"
|
||||||
|
HorizontalAlignment="Stretch" Height="30"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal" Margin="5,10,5,0"
|
||||||
|
IsEnabled="True" />
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</StackPanel>
|
||||||
|
<GroupBox DockPanel.Dock="Right" HorizontalAlignment="Stretch"
|
||||||
|
Margin="5,0,0,0">
|
||||||
|
<!-- <GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock TextAlignment="Center" Margin="0"
|
||||||
|
FontSize="14">
|
||||||
|
<Run Text="Computeranzeige" Foreground="Black" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox.Header> -->
|
||||||
|
<DockPanel HorizontalAlignment="Stretch" Margin="0,0,8,0">
|
||||||
|
<ScrollViewer HorizontalScrollBarVisibility="Auto"
|
||||||
|
VerticalScrollBarVisibility="Auto">
|
||||||
|
<DataGrid
|
||||||
|
Name="ComputerGrid"
|
||||||
|
Margin="0,10,0,0"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
FrozenColumnCount="3"
|
||||||
|
AlternationCount="2"
|
||||||
|
GridLinesVisibility="None"
|
||||||
|
DockPanel.Dock="Top"
|
||||||
|
BorderBrush="{x:Null}"
|
||||||
|
BorderThickness="0"
|
||||||
|
Grid.Row="1"
|
||||||
|
RowHeaderWidth="0"
|
||||||
|
CanUserAddRows="True"
|
||||||
|
SelectionMode="Single"
|
||||||
|
IsReadOnly="True"
|
||||||
|
ScrollViewer.CanContentScroll="True"
|
||||||
|
ScrollViewer.VerticalScrollBarVisibility="Disabled"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Header="Ping"
|
||||||
|
Width="Auto">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<CheckBox Name="PingCheckBox"
|
||||||
|
IsChecked="{Binding Path=Ping, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Style="{DynamicResource ToggleSwitch}"
|
||||||
|
IsEnabled="{Binding Path=EnableCheckbox, Mode=OneWay}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTextColumn Header="Computername"
|
||||||
|
Width="Auto"
|
||||||
|
Binding="{Binding Path=Computername, Mode=TwoWay, NotifyOnSourceUpdated=True}" />
|
||||||
|
<DataGridTextColumn Header="Anwender"
|
||||||
|
Width="Auto"
|
||||||
|
Binding="{Binding Path=Anwender, Mode=TwoWay, NotifyOnSourceUpdated=True}">
|
||||||
|
</DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</ScrollViewer>
|
||||||
|
</DockPanel>
|
||||||
|
</GroupBox>
|
||||||
|
</DockPanel>
|
||||||
|
<GroupBox DockPanel.Dock="Top" Margin="10,10,10,0"
|
||||||
|
Padding="8,0,8,8">
|
||||||
|
<RichTextBox Name="OutputComputer" FontSize="12"
|
||||||
|
FontFamily="Consolas"
|
||||||
|
Background="{x:Null}" BorderBrush="{x:Null}" IsReadOnly="True"
|
||||||
|
BorderThickness="0" VerticalScrollBarVisibility="Auto"
|
||||||
|
Block.LineHeight="2">
|
||||||
|
</RichTextBox>
|
||||||
|
</GroupBox>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Benutzer">
|
||||||
|
<Border Margin="0" BorderThickness="0">
|
||||||
|
<DockPanel Margin="0">
|
||||||
|
<DockPanel Margin="10,0,10,0" DockPanel.Dock="Top">
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Left"
|
||||||
|
HorizontalAlignment="Left" VerticalAlignment="Top">
|
||||||
|
<GroupBox Margin="0" VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch">
|
||||||
|
<GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<CheckBox Name="Group1" Content="Enable This Group"
|
||||||
|
Padding="4,0,0,0"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Style="{DynamicResource ToggleSwitch}"
|
||||||
|
FontSize="14" />
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Top"
|
||||||
|
IsEnabled="{Binding ElementName=Group1, Path=IsChecked}">
|
||||||
|
<Label Content="ComboBox 1" Margin="0"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Top" />
|
||||||
|
<ComboBox Name="ComboBox1" HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Top" />
|
||||||
|
<Label Content="ComboxBox 2" Margin="0"
|
||||||
|
HorizontalAlignment="Left" VerticalAlignment="Top" />
|
||||||
|
<ComboBox Name="ComboBox2"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Top" />
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
<GroupBox Margin="0,5,0,0" VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch">
|
||||||
|
<GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<CheckBox Name="Group2"
|
||||||
|
Content="Group 2" Padding="4,0,0,0"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Style="{DynamicResource ToggleSwitch}"
|
||||||
|
FontSize="14" />
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Top"
|
||||||
|
IsEnabled="{Binding ElementName=Group2, Path=IsChecked}">
|
||||||
|
<Label Content="TextBox1" Margin="0"
|
||||||
|
HorizontalAlignment="Left" VerticalAlignment="Top" />
|
||||||
|
<TextBox Name="TextBox1" Margin="0,4,0,0" />
|
||||||
|
<CheckBox Name="CheckBox1" Content="Example CheckBox "
|
||||||
|
IsChecked="True" Margin="0,5,0,0" />
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
<GroupBox Margin="0,5,0,0" Name="CredentialsGroup"
|
||||||
|
IsEnabled="{Binding ElementName=Group1, Path=IsChecked}"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Stretch">
|
||||||
|
<GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="Center">
|
||||||
|
<TextBlock TextAlignment="Center" Margin="0"
|
||||||
|
FontSize="14">
|
||||||
|
<Run Text="Credentials (" Foreground="Black" />
|
||||||
|
<Run Text="REQUIRED" Foreground="Red" />
|
||||||
|
<Run Text=")" Foreground="Black" />
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox.Header>
|
||||||
|
<DockPanel Margin="0,4,0,0">
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Top">
|
||||||
|
<Label Content="Domain" />
|
||||||
|
<ComboBox Name="UserDomain" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Top">
|
||||||
|
<Label Content="Username" />
|
||||||
|
<TextBox Name="UserName" Text="" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Top">
|
||||||
|
<Label Content="Password" />
|
||||||
|
<PasswordBox Name="Password" />
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</GroupBox>
|
||||||
|
<Button Name="Execute" TabIndex="9" Content="Execute"
|
||||||
|
IsDefault="True"
|
||||||
|
HorizontalAlignment="Stretch" Height="30" FontSize="14"
|
||||||
|
FontWeight="Normal" Margin="0,10,0,0" IsEnabled="True" />
|
||||||
|
<CheckBox Name="RebootRequired" Visibility="Collapsed"
|
||||||
|
IsChecked="False" />
|
||||||
|
</StackPanel>
|
||||||
|
<GroupBox DockPanel.Dock="Right" HorizontalAlignment="Stretch"
|
||||||
|
Margin="5,0,0,0">
|
||||||
|
<GroupBox.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<CheckBox Name="Group3" Content="Group 3"
|
||||||
|
Padding="4,0,0,0" VerticalContentAlignment="Center"
|
||||||
|
Style="{DynamicResource ToggleSwitch}" FontSize="14" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</GroupBox.Header>
|
||||||
|
<DockPanel HorizontalAlignment="Stretch" Margin="0,0,8,0"
|
||||||
|
IsEnabled="{Binding ElementName=Group3, Path=IsChecked}">
|
||||||
|
<Button Name="SetPath" DockPanel.Dock="Top" TabIndex="1"
|
||||||
|
Content="Select Path" HorizontalAlignment="Left"
|
||||||
|
Margin="0,10,0,0" VerticalAlignment="Top" Width="137"
|
||||||
|
Height="30" FontSize="14" FontWeight="Normal" />
|
||||||
|
<TextBox Name="TextBox2" DockPanel.Dock="Top"
|
||||||
|
HorizontalAlignment="Stretch" Margin="0,5,0,0"
|
||||||
|
TextWrapping="Wrap" Text=" " VerticalAlignment="Top"
|
||||||
|
IsReadOnly="True" />
|
||||||
|
<ScrollViewer HorizontalScrollBarVisibility="Auto"
|
||||||
|
VerticalScrollBarVisibility="Auto">
|
||||||
|
<DataGrid
|
||||||
|
Name="ExampleGrid"
|
||||||
|
Margin="0,10,0,0"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
FrozenColumnCount="4"
|
||||||
|
AlternationCount="2"
|
||||||
|
GridLinesVisibility="None"
|
||||||
|
DockPanel.Dock="Top"
|
||||||
|
BorderBrush="{x:Null}"
|
||||||
|
BorderThickness="0"
|
||||||
|
Grid.Row="1"
|
||||||
|
RowHeaderWidth="0"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
SelectionMode="Single"
|
||||||
|
IsReadOnly="True"
|
||||||
|
ScrollViewer.CanContentScroll="True"
|
||||||
|
ScrollViewer.VerticalScrollBarVisibility="Disabled"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Header="ToggleSwitch">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<CheckBox Name="CheckBox"
|
||||||
|
IsChecked="{Binding Path=Checkbox, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Style="{DynamicResource ToggleSwitch}"
|
||||||
|
IsEnabled="{Binding Path=EnableCheckbox, Mode=OneWay}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTextColumn Header="Description"
|
||||||
|
Width="Auto"
|
||||||
|
Binding="{Binding Path=Description, Mode=TwoWay, NotifyOnSourceUpdated=True}" />
|
||||||
|
<DataGridTextColumn Header="Filename"
|
||||||
|
Width="Auto"
|
||||||
|
Binding="{Binding Path=Filename, Mode=TwoWay, NotifyOnSourceUpdated=True}">
|
||||||
|
<DataGridTextColumn.CellStyle>
|
||||||
|
<Style TargetType="DataGridCell">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger
|
||||||
|
Binding="{Binding Path=RowIsValid}"
|
||||||
|
Value="True">
|
||||||
|
<Setter
|
||||||
|
Property="Foreground"
|
||||||
|
Value="Black" />
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger
|
||||||
|
Binding="{Binding Path=RowIsValid}"
|
||||||
|
Value="False">
|
||||||
|
<Setter
|
||||||
|
Property="Foreground"
|
||||||
|
Value="Red" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.CellStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="Extra Info"
|
||||||
|
Width="Auto"
|
||||||
|
Binding="{Binding Path=ExtraInfo, Mode=TwoWay, NotifyOnSourceUpdated=True}" />
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</ScrollViewer>
|
||||||
|
</DockPanel>
|
||||||
|
</GroupBox>
|
||||||
|
</DockPanel>
|
||||||
|
<GroupBox DockPanel.Dock="Top" Margin="10,10,10,0" Padding="8,0,8,8">
|
||||||
|
<RichTextBox Name="Output" FontSize="12" FontFamily="Consolas"
|
||||||
|
Background="{x:Null}" BorderBrush="{x:Null}" IsReadOnly="True"
|
||||||
|
BorderThickness="0" VerticalScrollBarVisibility="Auto"
|
||||||
|
Block.LineHeight="2">
|
||||||
|
</RichTextBox>
|
||||||
|
</GroupBox>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
|
||||||
|
<!-- Status Area -->
|
||||||
|
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,10,0"
|
||||||
|
BorderThickness="0" CornerRadius="8" HorizontalAlignment="Stretch">
|
||||||
|
<StatusBar Name="StatusArea" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
|
||||||
|
Background="{x:Null}">
|
||||||
|
<StatusBarItem>
|
||||||
|
<ProgressBar Name="Progress" Value="0" />
|
||||||
|
</StatusBarItem>
|
||||||
|
<StatusBarItem>
|
||||||
|
<TextBlock Name="StatusText" Text="Ready." FontFamily="Verdana" />
|
||||||
|
</StatusBarItem>
|
||||||
|
</StatusBar>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Window>
|
|
@ -0,0 +1,141 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Performs a series of asynchronous pings against the target hosts.
|
||||||
|
|
||||||
|
.PARAMETER HostName
|
||||||
|
A string array of target hosts to ping.
|
||||||
|
|
||||||
|
.PARAMETER PingCount
|
||||||
|
The number of pings to send against each host.
|
||||||
|
#>
|
||||||
|
function Invoke-FastPing {
|
||||||
|
[alias('FastPing', 'fping', 'fp')]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[Alias('Computer', 'ComputerName', 'Host')]
|
||||||
|
[String[]] $HostName,
|
||||||
|
|
||||||
|
[Int] $PingCount = 4
|
||||||
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
|
# Objects to hold items as we process pings
|
||||||
|
$queue = [System.Collections.Queue]::new()
|
||||||
|
$pingHash = @{}
|
||||||
|
|
||||||
|
# Start an asynchronous ping against each computer
|
||||||
|
foreach ($hn in $HostName) {
|
||||||
|
if ($pingHash.Keys -notcontains $hn) {
|
||||||
|
$pingHash.Add($hn, [System.Collections.ArrayList]::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $PingCount; $i++) {
|
||||||
|
$ping = [System.Net.Networkinformation.Ping]::new()
|
||||||
|
$object = @{
|
||||||
|
Host = $hn
|
||||||
|
Ping = $ping
|
||||||
|
Async = $ping.SendPingAsync($hn)
|
||||||
|
}
|
||||||
|
$queue.Enqueue($object)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Process the asynchronous pings
|
||||||
|
while ($queue.Count -gt 0) {
|
||||||
|
$object = $queue.Dequeue()
|
||||||
|
if ($object.Async.IsCompleted -eq $true) {
|
||||||
|
$null = $pingHash[$object.Host].Add(@{
|
||||||
|
Host = $object.Host
|
||||||
|
RoundtripTime = $object.Async.Result.RoundtripTime
|
||||||
|
Status = $object.Async.Result.Status
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$queue.Enqueue($object)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Using the ping results in pingHash, calculate the average RoundtripTime
|
||||||
|
foreach ($key in $pingHash.Keys) {
|
||||||
|
if (($pingHash.$key.Status | Select-Object -Unique) -eq 'Success') {
|
||||||
|
$online = $true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$online = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($online -eq $true) {
|
||||||
|
$latency = [System.Collections.ArrayList]::new()
|
||||||
|
foreach ($value in $pingHash.$key) {
|
||||||
|
if ($value.RoundtripTime) {
|
||||||
|
$null = $latency.Add($value.RoundtripTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$average = $latency | Measure-Object -Average
|
||||||
|
if ($average.Average) {
|
||||||
|
$roundtripAverage = [Math]::Round($average.Average, 0)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$roundtripAverage = $null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$roundtripAverage = $null
|
||||||
|
}
|
||||||
|
|
||||||
|
[PSCustomObject]@{
|
||||||
|
ComputerName = $key
|
||||||
|
RoundtripAverage = $roundtripAverage
|
||||||
|
Online = $online
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} # End Process
|
||||||
|
}
|
||||||
|
|
||||||
|
# Invoke-FastPing @("ME0001", "ME0025", "ME-Linux-CP") -PingCount 1
|
||||||
|
# Invoke-FastPing @("ME-Linux-CP") -PingCount 1
|
||||||
|
# write-host "test1"
|
||||||
|
# Invoke-FastPing @("ME0025") -PingCount 1
|
||||||
|
# write-host "test2"
|
||||||
|
# Invoke-FastPing @("ME0001") -PingCount 1
|
||||||
|
# write-host "test3"
|
||||||
|
|
||||||
|
|
||||||
|
function blub($status) {
|
||||||
|
$status
|
||||||
|
# $s = $false
|
||||||
|
# if ($status.Status -eq "RanToCompletion") {
|
||||||
|
# $s = $true
|
||||||
|
# }
|
||||||
|
|
||||||
|
# $s
|
||||||
|
}
|
||||||
|
|
||||||
|
# $ping = [System.Net.Networkinformation.Ping]::new()
|
||||||
|
# $ping2 = [System.Net.Networkinformation.Ping]::new()
|
||||||
|
# $ping3 = [System.Net.Networkinformation.Ping]::new()
|
||||||
|
# #$run = $ping.SendPingAsync("ME0025", 20000)
|
||||||
|
# $run2 = $ping2.SendPingAsync("ME-Linux-CP")
|
||||||
|
# # $run3 = $ping3.SendPingAsync("ME0001")
|
||||||
|
|
||||||
|
# # blub -status $run
|
||||||
|
# blub -status $run2
|
||||||
|
# # blub -status $run3
|
||||||
|
|
||||||
|
|
||||||
|
$RemoteHosts = @('ME0025', 'ME0001')
|
||||||
|
|
||||||
|
# Initiate a Ping asynchronously per remote host, pick up the result task objects
|
||||||
|
$Tasks = foreach ($ComputerName in $RemoteHosts) {
|
||||||
|
(New-Object System.Net.NetworkInformation.Ping).SendPingAsync($ComputerName)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait for all tasks to finish
|
||||||
|
[System.Threading.Tasks.Task]::WaitAll($Tasks)
|
||||||
|
|
||||||
|
# Output results
|
||||||
|
$Tasks | Select-Object -Expand Result
|
|
@ -0,0 +1,107 @@
|
||||||
|
$ui.BTN_Ping.Add_Click({
|
||||||
|
|
||||||
|
$ui.Grid_Output_Computer.Columns | ForEach { $_.CanUserSort = $True }
|
||||||
|
|
||||||
|
$ui.Grid_Output_Computer.Dispatcher.Invoke('Normal', [action] {
|
||||||
|
[void]$collection.observableCollection.clear()
|
||||||
|
})
|
||||||
|
|
||||||
|
$ui.PB_Computers.Value = [int] "0"
|
||||||
|
|
||||||
|
$ps = [powershell]::Create().AddScript({
|
||||||
|
Param ($Collection, $ui, $jobs)
|
||||||
|
$RunspacePool = [runspacefactory]::CreateRunspacePool(1, 5)
|
||||||
|
|
||||||
|
$ScriptBlock = {
|
||||||
|
Param ($ui, $Collection, $server)
|
||||||
|
|
||||||
|
$status = "" ;
|
||||||
|
$t = "" ;
|
||||||
|
$IP = "" ;
|
||||||
|
|
||||||
|
$t = Test-Connection $server -count 1
|
||||||
|
|
||||||
|
$status = "OFFline"
|
||||||
|
if ($t2) { $status = "ONline" }
|
||||||
|
|
||||||
|
$IP = "N/A"
|
||||||
|
if ($t) { $IP = $t.IPV4Address.ToString() }
|
||||||
|
|
||||||
|
$Object = [pscustomobject][ordered]@{
|
||||||
|
Date = (Get-Date).ToString() ;
|
||||||
|
Computername = $server ;
|
||||||
|
IP = $IP ;
|
||||||
|
Status = $status ;
|
||||||
|
}
|
||||||
|
|
||||||
|
Start-Sleep -Seconds 1
|
||||||
|
|
||||||
|
$ui.Grid_Output_Computer.Dispatcher.Invoke('Normal', [action] {
|
||||||
|
[void]$collection.observableCollection.Add($Object)
|
||||||
|
#$ui.Grid_Output_Computer.Columns | ForEach-Object { $_.CanUserSort = $True }
|
||||||
|
$ui.PB_Computers.Value++
|
||||||
|
})
|
||||||
|
|
||||||
|
# <# ok only for 1 offline
|
||||||
|
$ui.Grid_Output_Computer.Dispatcher.Invoke('Normal', [action] {
|
||||||
|
$myRow = $ui.Grid_Output_Computer.ItemContainerGenerator.ContainerFromIndex( $ui.Grid_Output_Computer.Items.status.IndexOf("OFFline") )
|
||||||
|
$myRow.Background = ([System.Windows.Media.Brushes]::Red)
|
||||||
|
})
|
||||||
|
##>
|
||||||
|
|
||||||
|
|
||||||
|
$ui.Grid_Output_Computer.Columns | ForEach-Object { $_.CanUserSort = $True }
|
||||||
|
|
||||||
|
<# ok if 1 offline
|
||||||
|
|
||||||
|
if ($ui.Grid_Output_Computer.Items.status.Contains("OFFline")) {
|
||||||
|
$index = $ui.Grid_Output_Computer.Items.status.IndexOf("OFFline")
|
||||||
|
$myRow = $ui.Grid_Output_Computer.ItemContainerGenerator.ContainerFromIndex($index)
|
||||||
|
}
|
||||||
|
$ui.Grid_Output_Computer.Dispatcher.Invoke('Normal',[action]{
|
||||||
|
$myRow.Background = ([System.Windows.Media.Brushes]::Red)
|
||||||
|
})
|
||||||
|
#>
|
||||||
|
|
||||||
|
<# ok only for 1 offline
|
||||||
|
|
||||||
|
$off = @($ui.Grid_Output_Computer.Items.status.Contains("OFFline"))
|
||||||
|
if ($off) {
|
||||||
|
$ui.Grid_Output_Computer.Items.status.ForEach("OFFline")
|
||||||
|
$index = $ui.Grid_Output_Computer.Items.status.IndexOf("OFFline")
|
||||||
|
$myRow = $ui.Grid_Output_Computer.ItemContainerGenerator.ContainerFromIndex($index)
|
||||||
|
$ui.Grid_Output_Computer.Dispatcher.Invoke('Normal',[action]{
|
||||||
|
$myRow.Background = ([System.Windows.Media.Brushes]::Red)
|
||||||
|
#$myRow.Background = ([System.Windows.Media.Brushes]::Green)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$servers = ($ui.LV_Selected_Computers.Items).name
|
||||||
|
ForEach ($server in $servers) {
|
||||||
|
#$throttle = [int] "3"
|
||||||
|
# 1..$throttle | foreach {
|
||||||
|
|
||||||
|
$ps = [powershell]::Create()
|
||||||
|
$ps.RunspacePool = $RunspacePool
|
||||||
|
$RunspacePool.Open()
|
||||||
|
[void]$ps.AddScript($ScriptBlock).AddArgument($ui).AddArgument($Collection).AddArgument($server)
|
||||||
|
[void]$jobs.Add([pscustomobject]@{
|
||||||
|
PowerShell = $Ps
|
||||||
|
Handle = $PS.BeginInvoke()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).AddArgument($Collection).AddArgument($ui).AddArgument($jobs).AddArgument($server)
|
||||||
|
|
||||||
|
[System.Threading.Monitor]::Enter($Jobs.syncroot)
|
||||||
|
$jobs.Add([pscustomobject]@{
|
||||||
|
PowerShell = $ps
|
||||||
|
Handle = $Ps.BeginInvoke()
|
||||||
|
})
|
||||||
|
[System.Threading.Monitor]::Exit($Jobs.syncroot)
|
||||||
|
})
|
|
@ -0,0 +1,222 @@
|
||||||
|
function Show-XAMLWindow{
|
||||||
|
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $false,
|
||||||
|
ConfirmImpact = "none",
|
||||||
|
DefaultParameterSetName = ""
|
||||||
|
)]
|
||||||
|
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(
|
||||||
|
HelpMessage = "Enter tbind xaml @`...`@ to load.",
|
||||||
|
Position = 0,
|
||||||
|
Mandatory = $true,
|
||||||
|
ValueFromPipeline = $true,
|
||||||
|
ValueFromPipelineByPropertyName = $true
|
||||||
|
)]
|
||||||
|
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[string]
|
||||||
|
$xaml,
|
||||||
|
|
||||||
|
[Alias("PassThru")]
|
||||||
|
[switch]
|
||||||
|
$PassThrough
|
||||||
|
)
|
||||||
|
|
||||||
|
begin
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Add-Type -AssemblyName presentationframework
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
[xml]$xaml = $xaml
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
|
||||||
|
$Form=[Windows.Markup.XamlReader]::Load( $reader )
|
||||||
|
|
||||||
|
#Setting al the fields to varialbe
|
||||||
|
$cbCompanys = $Form.FindName("cbCompanys")
|
||||||
|
$chkbMultiSelect = $Form.FindName("chkbMultiSelect")
|
||||||
|
$dgUsers = $Form.FindName("dgUsers")
|
||||||
|
$chkbBackupFiles = $Form.FindName("chkbBackupFiles")
|
||||||
|
$chkbBackupMail = $Form.FindName("chkbBackupMail")
|
||||||
|
$chkblocation = $Form.FindName("chkblocation")
|
||||||
|
$btnSend = $Form.FindName("btnSend")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process
|
||||||
|
{
|
||||||
|
# Form setup
|
||||||
|
#$Form.Background = $Global:BackColor
|
||||||
|
|
||||||
|
# for now disable the multiselect button
|
||||||
|
$chkbMultiSelect.IsEnabled = $false
|
||||||
|
|
||||||
|
# Add scripts to Company Combobox
|
||||||
|
#foreach ($Company in ($Global:Companys | sort Name)) {
|
||||||
|
# [void] $cbCompanys.Items.Add($Company.Name)
|
||||||
|
#}
|
||||||
|
|
||||||
|
[void] $cbCompanys.Items.Add("A")
|
||||||
|
[void] $cbCompanys.Items.Add("B")
|
||||||
|
|
||||||
|
|
||||||
|
# Add on checked to CheckBox Multiselect
|
||||||
|
$chkbMultiSelect.Add_Checked({
|
||||||
|
$dgUsers.SelectionMode = "Extended"
|
||||||
|
})
|
||||||
|
|
||||||
|
# Add on UnChecked to CheckBox Multiselect
|
||||||
|
$chkbMultiSelect.Add_UnChecked({
|
||||||
|
$dgUsers.SelectionMode = "Single"
|
||||||
|
})
|
||||||
|
|
||||||
|
# Add onchange to Company Combobox
|
||||||
|
$cbCompanys_Add_SelectionChanged = {
|
||||||
|
# Disable User Combobox
|
||||||
|
$cbCompanys.IsEnabled = $False
|
||||||
|
|
||||||
|
# Clear the Users Combobox
|
||||||
|
$dgUsers.Clear()
|
||||||
|
|
||||||
|
# Get all users of company
|
||||||
|
#$CompUsers = Get-CompanyUser -Company $cbCompanys.SelectedItem | select DisplayName, UserPrincipalName, SamAccountName | sort DisplayName
|
||||||
|
$CompUsers =
|
||||||
|
@(
|
||||||
|
[pscustomobject]@{ DisplayName="Andy"; UserPrincipalName="Andy P"; SamAccountName="Andy S";}
|
||||||
|
[pscustomobject]@{ DisplayName="Bob"; UserPrincipalName="Bob P"; SamAccountName="Bob S"; }
|
||||||
|
[pscustomobject]@{ DisplayName="Casey"; UserPrincipalName="Casey P"; SamAccountName="Casey S"; }
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add property for checkbox
|
||||||
|
$CompUsers | ForEach-Object {
|
||||||
|
$_ | Add-Member -MemberType NoteProperty -Name IsChecked -Value $False -TypeName System.Boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Add users to DataGrid
|
||||||
|
$dgUsers.ItemsSource = $CompUsers
|
||||||
|
|
||||||
|
# Allow sorting on all columns
|
||||||
|
$dgUsers.Columns | ForEach-Object {
|
||||||
|
$_.CanUserSort = $True
|
||||||
|
$_.IsReadOnly = $True
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set Columns ReadOnly of not
|
||||||
|
$dgUsers.Columns[0].IsReadOnly = $False
|
||||||
|
|
||||||
|
# Enable User Combobox
|
||||||
|
$cbCompanys.IsEnabled = $True
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add selectionchanged function to Combobox
|
||||||
|
$cbCompanys.Add_SelectionChanged($cbCompanys_Add_SelectionChanged)
|
||||||
|
$cbCompanys.SelectedValue = "A"
|
||||||
|
|
||||||
|
# Set action to button
|
||||||
|
$btnSend.Add_Click({
|
||||||
|
# Get selected items
|
||||||
|
$SelCompany = $cbCompanys.SelectedItem ### @{DisplayName=Andy; UserPrincipalName=Andy P; SamAccountName=Andy S; IsChecked=False}
|
||||||
|
### @{DisplayName=Bob; UserPrincipalName=BobP; SamAccountName=Bob S; IsChecked=True}
|
||||||
|
### @{DisplayName=Casey; UserPrincipalNam=Casey P; SamAccountName=Casey S; IsChecked=False}
|
||||||
|
$iRow = 0
|
||||||
|
# Checking if all fiels contain value
|
||||||
|
if (!($SelCompany)) {
|
||||||
|
EmptyFormField -Field "Company"
|
||||||
|
} else {
|
||||||
|
# write-host "----"
|
||||||
|
# write-host $dgUsers ### System.Windows.Controls.DataGrid Items.Count:3
|
||||||
|
# write-host "----"
|
||||||
|
# write-host $dgUsers.ItemsSource
|
||||||
|
# write-host "----"
|
||||||
|
$dgUsers.ItemsSource | ForEach-Object {
|
||||||
|
$myRow = $dgUsers.ItemContainerGenerator.ContainerFromItem($_)
|
||||||
|
|
||||||
|
if($_.IsChecked -eq $True ){
|
||||||
|
$myRow.Background = ([System.Windows.Media.Brushes]::Green)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$myRow.Background = ([System.Windows.Media.Brushes]::White)
|
||||||
|
}
|
||||||
|
#$myRow.Background = ([System.Windows.Media.Brushes]::Green)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
### LOOK AT HERE ### - start
|
||||||
|
$dgUsers.Add_LoadingRow({
|
||||||
|
param($Sender,$EventArgs)
|
||||||
|
#write-host "########### LOADED!!!!##########"
|
||||||
|
#write-host $EventArgs.Row.Item.IsChecked
|
||||||
|
if($EventArgs.Row.Item.IsChecked -eq $True ){
|
||||||
|
$EventArgs.Row.Background = ([System.Windows.Media.Brushes]::Green)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$EventArgs.Row.Background = ([System.Windows.Media.Brushes]::White)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
### LOOK AT HERE ### - stop
|
||||||
|
|
||||||
|
$Form.ShowDialog() | out-null
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
{
|
||||||
|
return $dgUsers.ItemsSource | Where-Object {$_.IsChecked -eq $True}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$xaml =@'
|
||||||
|
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
x:Name="Window_GuiManagement" Title="Remove Company User" WindowStartupLocation = "CenterScreen"
|
||||||
|
Width = "587.307" Height = "540.023" Visibility="Visible" WindowStyle="ToolWindow" ResizeMode="NoResize" Topmost="True">
|
||||||
|
<Grid>
|
||||||
|
<Label x:Name="lblCompany" Content="Company:" HorizontalAlignment="Left" Margin="11,10,0,0" Height="26" VerticalAlignment="Top"/>
|
||||||
|
<ComboBox x:Name="cbCompanys" Margin="10,36,10,0" VerticalAlignment="Top"/>
|
||||||
|
<Label x:Name="lbluser" Content="User:" HorizontalAlignment="Left" Margin="11,63,0,0" VerticalAlignment="Top"/>
|
||||||
|
<CheckBox x:Name="chkbMultiSelect" Content="MultiSelect" Margin="481,69,10,0" VerticalAlignment="Top" Width="90"/>
|
||||||
|
<DataGrid x:Name="dgUsers" Margin="11,94,10,0" VerticalAlignment="Top" Height="299" SelectionMode="Single" AlternationCount="1"
|
||||||
|
AutoGenerateColumns="false">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridCheckBoxColumn Binding="{Binding Path=IsChecked,UpdateSourceTrigger=PropertyChanged}" ClipboardContentBinding="{x:Null}" CanUserSort="False" CanUserResize="False" IsReadOnly="False"
|
||||||
|
Header="Check" >
|
||||||
|
<DataGridCheckBoxColumn.ElementStyle>
|
||||||
|
<Style TargetType="CheckBox"/>
|
||||||
|
</DataGridCheckBoxColumn.ElementStyle>
|
||||||
|
</DataGridCheckBoxColumn>
|
||||||
|
|
||||||
|
<DataGridTextColumn Binding="{Binding Path=DisplayName}" ClipboardContentBinding="{x:Null}" CanUserSort="False" CanUserResize="False" IsReadOnly="True"
|
||||||
|
Header="DisplayName"/>
|
||||||
|
|
||||||
|
<DataGridTextColumn Binding="{Binding Path=UserPrincipalName}" ClipboardContentBinding="{x:Null}" CanUserSort="False" CanUserResize="False" IsReadOnly="True"
|
||||||
|
Header="UserPrincipalName"/>
|
||||||
|
<DataGridTextColumn Binding="{Binding Path=SamAccountName}" ClipboardContentBinding="{x:Null}" CanUserSort="False" CanUserResize="False" IsReadOnly="True"
|
||||||
|
Header="SamAccountName"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<CheckBox x:Name="chkbBackupFiles" Content="Backup Files" HorizontalAlignment="Left" Margin="11,398,0,0" VerticalAlignment="Top" IsChecked="True"/>
|
||||||
|
<CheckBox x:Name="chkbmail" Content="Backup Mail" HorizontalAlignment="Left" Margin="11,418,0,0" VerticalAlignment="Top" IsChecked="True"/>
|
||||||
|
<CheckBox x:Name="chkblocation" Content="Open backup location" HorizontalAlignment="Left" Margin="11,438,0,0" VerticalAlignment="Top" IsChecked="True"/>
|
||||||
|
<Button x:Name="btnSend" Content="Color Cecked rows" Margin="441,459,10,0" VerticalAlignment="Top"/>
|
||||||
|
<CheckBox x:Name="chkblocation_Copy" Content="Open backup location" HorizontalAlignment="Left" Margin="11,438,0,0" VerticalAlignment="Top" IsChecked="True"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
'@
|
||||||
|
|
||||||
|
$WPFresult = Show-XAMLWindow -xaml $xaml
|
||||||
|
$WPFresult
|
|
@ -0,0 +1,142 @@
|
||||||
|
# Importieren der notwendigen .NET-Namespaces
|
||||||
|
Add-Type -AssemblyName PresentationFramework, PresentationCore, WindowsBase, System.Windows.Forms
|
||||||
|
|
||||||
|
# Erstellen des Hauptfensters
|
||||||
|
$window = New-Object System.Windows.Window
|
||||||
|
$window.Title = "Ping Monitor"
|
||||||
|
$window.Width = 600
|
||||||
|
$window.Height = 400
|
||||||
|
|
||||||
|
# Erstellen des DataGrid
|
||||||
|
$dataGrid = New-Object System.Windows.Controls.DataGrid
|
||||||
|
$dataGrid.Margin = "10"
|
||||||
|
$dataGrid.AutoGenerateColumns = $false
|
||||||
|
$dataGrid.IsReadOnly = $true
|
||||||
|
|
||||||
|
# Definieren der Spalten für das DataGrid
|
||||||
|
$hostColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$hostColumn.Header = "Host"
|
||||||
|
$hostColumn.Binding = New-Object System.Windows.Data.Binding "TargetHost"
|
||||||
|
$dataGrid.Columns.Add($hostColumn)
|
||||||
|
|
||||||
|
$statusColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$statusColumn.Header = "Status"
|
||||||
|
$statusColumn.Binding = New-Object System.Windows.Data.Binding "Status"
|
||||||
|
$dataGrid.Columns.Add($statusColumn)
|
||||||
|
|
||||||
|
$roundtripColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$roundtripColumn.Header = "Roundtrip Time"
|
||||||
|
$roundtripColumn.Binding = New-Object System.Windows.Data.Binding "RoundtripTime"
|
||||||
|
$dataGrid.Columns.Add($roundtripColumn)
|
||||||
|
|
||||||
|
$timestampColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$timestampColumn.Header = "Timestamp"
|
||||||
|
$timestampColumn.Binding = New-Object System.Windows.Data.Binding "Timestamp"
|
||||||
|
$dataGrid.Columns.Add($timestampColumn)
|
||||||
|
|
||||||
|
# Hosts, die gepingt werden sollen
|
||||||
|
$hosts = @("ME0001", "ME0002", "8.8.8.8", "1.1.1.1")
|
||||||
|
|
||||||
|
# Freigegebene ObservableCollection für die Ping-Ergebnisse
|
||||||
|
$pingResults = New-Object System.Collections.ObjectModel.ObservableCollection[PSCustomObject]
|
||||||
|
|
||||||
|
# Funktion zum Durchführen des Pings
|
||||||
|
# Importieren der notwendigen .NET-Namespaces
|
||||||
|
Add-Type -AssemblyName PresentationFramework, PresentationCore, WindowsBase, System.Windows.Forms
|
||||||
|
|
||||||
|
# Erstellen des Hauptfensters
|
||||||
|
$window = New-Object System.Windows.Window
|
||||||
|
$window.Title = "Ping Monitor"
|
||||||
|
$window.Width = 600
|
||||||
|
$window.Height = 400
|
||||||
|
|
||||||
|
# Erstellen des DataGrid
|
||||||
|
$dataGrid = New-Object System.Windows.Controls.DataGrid
|
||||||
|
$dataGrid.Margin = "10"
|
||||||
|
$dataGrid.AutoGenerateColumns = $false
|
||||||
|
$dataGrid.IsReadOnly = $true
|
||||||
|
|
||||||
|
# Definieren der Spalten für das DataGrid
|
||||||
|
$hostColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$hostColumn.Header = "Host"
|
||||||
|
$hostColumn.Binding = New-Object System.Windows.Data.Binding "TargetHost"
|
||||||
|
$dataGrid.Columns.Add($hostColumn)
|
||||||
|
|
||||||
|
$statusColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$statusColumn.Header = "Status"
|
||||||
|
$statusColumn.Binding = New-Object System.Windows.Data.Binding "Status"
|
||||||
|
$dataGrid.Columns.Add($statusColumn)
|
||||||
|
|
||||||
|
$roundtripColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$roundtripColumn.Header = "Roundtrip Time"
|
||||||
|
$roundtripColumn.Binding = New-Object System.Windows.Data.Binding "RoundtripTime"
|
||||||
|
$dataGrid.Columns.Add($roundtripColumn)
|
||||||
|
|
||||||
|
$timestampColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$timestampColumn.Header = "Timestamp"
|
||||||
|
$timestampColumn.Binding = New-Object System.Windows.Data.Binding "Timestamp"
|
||||||
|
$dataGrid.Columns.Add($timestampColumn)
|
||||||
|
|
||||||
|
# Hosts, die gepingt werden sollen
|
||||||
|
$hosts = @("ME0002", "ME0001", "8.8.8.8", "1.1.1.1")
|
||||||
|
|
||||||
|
# Freigegebene ObservableCollection für die Ping-Ergebnisse
|
||||||
|
$pingResults = New-Object System.Collections.ObjectModel.ObservableCollection[PSCustomObject]
|
||||||
|
|
||||||
|
# Funktion zum Durchführen des Pings
|
||||||
|
function Start-PingMonitor {
|
||||||
|
param (
|
||||||
|
[string[]]$hosts,
|
||||||
|
[System.Collections.ObjectModel.ObservableCollection[PSCustomObject]]$results
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($targetHost in $hosts) {
|
||||||
|
try {
|
||||||
|
$ping = New-Object System.Net.NetworkInformation.Ping
|
||||||
|
$reply = $ping.Send($targetHost)
|
||||||
|
|
||||||
|
$pingResult = [PSCustomObject]@{
|
||||||
|
TargetHost = $targetHost
|
||||||
|
Status = if ($reply.Status -eq "Success") { "Success" } else { "Failed" }
|
||||||
|
RoundtripTime = $reply.RoundtripTime
|
||||||
|
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hinzufügen des Ergebnisses zur freigegebenen ObservableCollection
|
||||||
|
$results.Add($pingResult)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$pingResult = [PSCustomObject]@{
|
||||||
|
TargetHost = $targetHost
|
||||||
|
Status = "Error"
|
||||||
|
RoundtripTime = "N/A"
|
||||||
|
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hinzufügen des Fehler-Ergebnisses zur freigegebenen ObservableCollection
|
||||||
|
$results.Add($pingResult)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Erstellen des DispatcherTimer
|
||||||
|
$timer = New-Object System.Windows.Threading.DispatcherTimer
|
||||||
|
$timer.Interval = [System.TimeSpan]::FromSeconds(1)
|
||||||
|
$timer.Add_Tick({
|
||||||
|
Start-PingMonitor -hosts $hosts -results $pingResults
|
||||||
|
})
|
||||||
|
|
||||||
|
# Hinzufügen des DataGrid zum Fenster
|
||||||
|
$window.Content = $dataGrid
|
||||||
|
|
||||||
|
# Setzen der ItemsSource des DataGrid auf die ObservableCollection
|
||||||
|
$dataGrid.ItemsSource = $pingResults
|
||||||
|
|
||||||
|
# Starten des Timers
|
||||||
|
$timer.Start()
|
||||||
|
|
||||||
|
# Anzeigen des Fensters
|
||||||
|
$window.ShowDialog() | Out-Null
|
||||||
|
|
||||||
|
# Beenden des Timers, wenn das Fenster geschlossen wird
|
||||||
|
$timer.Stop()
|
|
@ -0,0 +1,176 @@
|
||||||
|
# Importieren der notwendigen .NET-Namespaces
|
||||||
|
Add-Type -AssemblyName PresentationFramework, PresentationCore, WindowsBase, System.Windows.Forms
|
||||||
|
Add-Type -AssemblyName System.Net.NetworkInformation
|
||||||
|
|
||||||
|
# Erstellen des Hauptfensters
|
||||||
|
$window = New-Object System.Windows.Window
|
||||||
|
$window.Title = "Ping Monitor"
|
||||||
|
$window.Width = 600
|
||||||
|
$window.Height = 400
|
||||||
|
|
||||||
|
# Erstellen des DataGrid
|
||||||
|
$dataGrid = New-Object System.Windows.Controls.DataGrid
|
||||||
|
$dataGrid.Margin = "10"
|
||||||
|
$dataGrid.AutoGenerateColumns = $false
|
||||||
|
$dataGrid.IsReadOnly = $true
|
||||||
|
|
||||||
|
# Definieren der Spalten für das DataGrid
|
||||||
|
$hostColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$hostColumn.Header = "Host"
|
||||||
|
$hostColumn.Binding = New-Object System.Windows.Data.Binding "TargetHost"
|
||||||
|
$dataGrid.Columns.Add($hostColumn)
|
||||||
|
|
||||||
|
$statusColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$statusColumn.Header = "Status"
|
||||||
|
$statusColumn.Binding = New-Object System.Windows.Data.Binding "Status"
|
||||||
|
$dataGrid.Columns.Add($statusColumn)
|
||||||
|
|
||||||
|
$roundtripColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$roundtripColumn.Header = "Roundtrip Time"
|
||||||
|
$roundtripColumn.Binding = New-Object System.Windows.Data.Binding "RoundtripTime"
|
||||||
|
$dataGrid.Columns.Add($roundtripColumn)
|
||||||
|
|
||||||
|
$timestampColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$timestampColumn.Header = "Timestamp"
|
||||||
|
$timestampColumn.Binding = New-Object System.Windows.Data.Binding "Timestamp"
|
||||||
|
$dataGrid.Columns.Add($timestampColumn)
|
||||||
|
|
||||||
|
# Hosts, die gepingt werden sollen
|
||||||
|
$hosts = @("ME0001", "ME0002", "8.8.8.8", "1.1.1.1")
|
||||||
|
|
||||||
|
# Freigegebene ObservableCollection für die Ping-Ergebnisse
|
||||||
|
$pingResults = New-Object System.Collections.ObjectModel.ObservableCollection[PSCustomObject]
|
||||||
|
|
||||||
|
# Funktion zum Durchführen des Pings
|
||||||
|
# Importieren der notwendigen .NET-Namespaces
|
||||||
|
Add-Type -AssemblyName PresentationFramework, PresentationCore, WindowsBase, System.Windows.Forms
|
||||||
|
|
||||||
|
# Erstellen des Hauptfensters
|
||||||
|
$window = New-Object System.Windows.Window
|
||||||
|
$window.Title = "Ping Monitor"
|
||||||
|
$window.Width = 600
|
||||||
|
$window.Height = 400
|
||||||
|
|
||||||
|
# Erstellen des DataGrid
|
||||||
|
$dataGrid = New-Object System.Windows.Controls.DataGrid
|
||||||
|
$dataGrid.Margin = "10"
|
||||||
|
$dataGrid.AutoGenerateColumns = $false
|
||||||
|
$dataGrid.IsReadOnly = $true
|
||||||
|
|
||||||
|
# Definieren der Spalten für das DataGrid
|
||||||
|
$hostColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$hostColumn.Header = "Host"
|
||||||
|
$hostColumn.Binding = New-Object System.Windows.Data.Binding "TargetHost"
|
||||||
|
$dataGrid.Columns.Add($hostColumn)
|
||||||
|
|
||||||
|
$statusColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$statusColumn.Header = "Status"
|
||||||
|
$statusColumn.Binding = New-Object System.Windows.Data.Binding "Status"
|
||||||
|
$dataGrid.Columns.Add($statusColumn)
|
||||||
|
|
||||||
|
$roundtripColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$roundtripColumn.Header = "Roundtrip Time"
|
||||||
|
$roundtripColumn.Binding = New-Object System.Windows.Data.Binding "RoundtripTime"
|
||||||
|
$dataGrid.Columns.Add($roundtripColumn)
|
||||||
|
|
||||||
|
$timestampColumn = New-Object System.Windows.Controls.DataGridTextColumn
|
||||||
|
$timestampColumn.Header = "Timestamp"
|
||||||
|
$timestampColumn.Binding = New-Object System.Windows.Data.Binding "Timestamp"
|
||||||
|
$dataGrid.Columns.Add($timestampColumn)
|
||||||
|
|
||||||
|
# Hosts, die gepingt werden sollen
|
||||||
|
$hosts = @("ME0002", "ME0001", "8.8.8.8", "1.1.1.1")
|
||||||
|
|
||||||
|
# Freigegebene ObservableCollection für die Ping-Ergebnisse
|
||||||
|
$pingResults = New-Object System.Collections.ObjectModel.ObservableCollection[PSCustomObject]
|
||||||
|
|
||||||
|
# Funktion zum Durchführen des Pings
|
||||||
|
function Start-PingMonitor {
|
||||||
|
param (
|
||||||
|
[string[]]$hosts,
|
||||||
|
[System.Collections.ObjectModel.ObservableCollection[PSCustomObject]]$results
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($targetHost in $hosts) {
|
||||||
|
try {
|
||||||
|
$ping = New-Object System.Net.NetworkInformation.Ping
|
||||||
|
if ($ping) {
|
||||||
|
$reply = $ping.SendAsync($targetHost, 1000)
|
||||||
|
$reply.Wait()
|
||||||
|
|
||||||
|
write-host $reply
|
||||||
|
|
||||||
|
if ($reply.Status -eq "Success") {
|
||||||
|
$pingResult = [PSCustomObject]@{
|
||||||
|
TargetHost = $targetHost
|
||||||
|
Status = "Success"
|
||||||
|
RoundtripTime = $reply.Result.RoundtripTime
|
||||||
|
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$pingResult = [PSCustomObject]@{
|
||||||
|
TargetHost = $targetHost
|
||||||
|
Status = "Failed"
|
||||||
|
RoundtripTime = "N/A"
|
||||||
|
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hinzufügen des Ergebnisses zur freigegebenen ObservableCollection
|
||||||
|
$results.Add($pingResult)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Failed to create Ping object"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch [System.TimeoutException] {
|
||||||
|
$pingResult = [PSCustomObject]@{
|
||||||
|
TargetHost = $targetHost
|
||||||
|
Status = "Timeout"
|
||||||
|
RoundtripTime = "N/A"
|
||||||
|
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hinzufügen des Timeout-Ergebnisses zur freigegebenen ObservableCollection
|
||||||
|
$results.Add($pingResult)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$errorMessage = "Fehler bei der Ping-Anfrage: $($Error[0])"
|
||||||
|
Write-Host $errorMessage
|
||||||
|
$pingResult = [PSCustomObject]@{
|
||||||
|
TargetHost = $targetHost
|
||||||
|
Status = "Error"
|
||||||
|
RoundtripTime = "N/A"
|
||||||
|
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hinzufügen des Fehler-Ergebnisses zur freigegebenen ObservableCollection
|
||||||
|
$results.Add($pingResult)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Erstellen des DispatcherTimer
|
||||||
|
$timer = New-Object System.Windows.Threading.DispatcherTimer
|
||||||
|
$timer.Interval = [System.TimeSpan]::FromSeconds(1)
|
||||||
|
$timer.Add_Tick({
|
||||||
|
Start-PingMonitor -hosts $hosts -results $pingResults
|
||||||
|
})
|
||||||
|
|
||||||
|
# Hinzufügen des DataGrid zum Fenster
|
||||||
|
$window.Content = $dataGrid
|
||||||
|
|
||||||
|
# Setzen der ItemsSource des DataGrid auf die ObservableCollection
|
||||||
|
$dataGrid.ItemsSource = $pingResults
|
||||||
|
|
||||||
|
# Starten des Timers
|
||||||
|
$timer.Start()
|
||||||
|
|
||||||
|
# Anzeigen des Fensters
|
||||||
|
$window.ShowDialog() | Out-Null
|
||||||
|
|
||||||
|
# Beenden des Timers, wenn das Fenster geschlossen wird
|
||||||
|
$timer.Stop()
|
Loading…
Reference in New Issue