Powershell GUI fronted (WPF) to run categorized console scripts

βŒˆβŒ‹ βŽ‡ branch:  ClickyColoury


Artifact [635749d69c]

Artifact 635749d69c900bd6d66b1284fc9b5e3b33f8095f:

  • File modules/kbt5.xaml — part of check-in [e114cf1bc5] at 2018-04-08 09:47:38 on branch trunk — Migration to PS5 file renaming. Remove function copying in New-GuiThread; (user: mario size: 18425) [more...]
  • File modules/wpf.xaml — part of check-in [15d9b1576a] at 2017-09-22 23:40:36 on branch trunk — Minor text fixes. (user: mario size: 18425)

<!--
# api: wpf
# type: gui
# title: MultiTool window
# version: 1.0.8
-->
<Window
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:r="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon"   
  x:Name="Window" Title="➱ ClickyColoury" WindowStartupLocation="CenterScreen" 
  Width="980" Height="720"
  ShowInTaskbar="True">

  <!-- Styles -->
  <Window.Resources>
    <Style x:Key="RibbonGradient" TargetType="DockPanel">
      <Setter Property="Background"><Setter.Value>
      <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFd1ddeb" Offset="0.00" />
        <GradientStop Color="#ffc9d9ed" Offset="0.30" />
        <GradientStop Color="#ffcdddef" Offset="0.70" />
        <GradientStop Color="#ffd7e6f6" Offset="1.00" />
      </LinearGradientBrush>
      </Setter.Value></Setter>
    </Style>

    <Style x:Key="RibbonBorder" TargetType="Border">
      <Setter Property="BorderBrush" Value="#FF556699" />
      <Setter Property="BorderThickness" Value="1" />
      <Setter Property="CornerRadius" Value="8" />
      <Setter Property="Margin" Value="3" />
      <Setter Property="Padding" Value="4,3,4,0" />
      <Setter Property="Background"><Setter.Value>
      <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#00d5e3f2" Offset="0.00" />
        <GradientStop Color="#ffc9d9ed" Offset="0.20" />
        <GradientStop Color="#ffcdddef" Offset="0.50" />
        <GradientStop Color="#ffcdddef" Offset="0.51" />
        <GradientStop Color="#ffd7e6f6" Offset="0.70" />
        <GradientStop Color="#ffc2d9f1" Offset="0.71" />
        <GradientStop Color="#ffa2c9e1" Offset="1.00" />
      </LinearGradientBrush>
      </Setter.Value></Setter>
    </Style>

    <Style x:Key="RibbonBorderGreen" TargetType="Border" BasedOn="{StaticResource RibbonBorder}">
      <Setter Property="Background"><Setter.Value>
      <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#00d5f2e3" Offset="0.00" />
        <GradientStop Color="#ffc9edd9" Offset="0.20" />
        <GradientStop Color="#ffb9e7d7" Offset="0.70" />
        <GradientStop Color="#ffa0e4c5" Offset="0.71" />
        <GradientStop Color="#ffa2e1c9" Offset="1.00" />
      </LinearGradientBrush>
      </Setter.Value></Setter>
    </Style>

    <Style x:Key="ActionButton" TargetType="Button">
      <Setter Property="TabIndex" Value="0" />
      <Setter Property="FontSize" Value="18" />
      <Setter Property="Foreground" Value="#ff333366" />
      <Setter Property="Template">
       <Setter.Value>
        <ControlTemplate TargetType="Button">
         <Border>
          <Border.Style>
           <Style TargetType="{x:Type Border}">
            <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" Value="#ffeeddaa"/>
              <Setter Property="Opacity" Value="1.0"/>
            </Trigger>
            <!--Trigger Property="IsPressed" Value="True">
              <Setter Property="Background" Value="#ffffcc99"/>
              <Setter Property="Opacity" Value="0.6"/></Trigger-->
            </Style.Triggers>
           </Style>
          </Border.Style>
          <Border Opacity="0.9"> <ContentPresenter/> </Border>
         </Border>
        </ControlTemplate>
       </Setter.Value>
      </Setter>
    </Style>

    <Style x:Key="ToolBlock" TargetType="Border">
      <Setter Property="BorderBrush" Value="#ff707280" />
      <Setter Property="BorderThickness" Value="2" />
      <Setter Property="CornerRadius" Value="5" />
      <Setter Property="Width" Value="350" />
      <!--Setter Property="Height" Value="65" /-->
      <Setter Property="Margin" Value="5" />
      <Setter Property="Padding" Value="4" />
      <Setter Property="Background"><Setter.Value>
      <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="#ffeeeeff" Offset="0.00" />
        <GradientStop Color="#fff7f7f7" Offset="1.00" />
      </LinearGradientBrush>
      </Setter.Value></Setter>
    </Style>

    <Style x:Key="ToolButton" TargetType="Button">
      <Setter Property="FontSize" Value="15" />
      <Setter Property="FontWeight" Value="Bold" />
      <Setter Property="BorderThickness" Value="3" />
    </Style>

    <Style x:Key="MainTab" TargetType="TabItem">
      <Setter Property="HeaderTemplate">
        <Setter.Value>
          <DataTemplate>
            <ContentPresenter Content="{TemplateBinding Content}">
              <ContentPresenter.LayoutTransform>
                <RotateTransform Angle="270" />
              </ContentPresenter.LayoutTransform>
            </ContentPresenter>
          </DataTemplate>
        </Setter.Value>
      </Setter>
      <Setter Property="Padding" Value="0" />
      <Setter Property="Margin" Value="0" />
      <!--Setter Property="Width" Value="30" /-->
    </Style>
  </Window.Resources>

  <!-- Widgets --> 
  <DockPanel Background="#77797c">

  <Menu DockPanel.Dock="Top" Background="#ffc0d0ef">
     <MenuItem Header="CMD" x:Name="Menu_CMD" ToolTip="Computer/command-line tools">
       <MenuItem Header="OnBehalf" x:Name="Menu_ONBEHALF" ToolTip="OnBehalf remote execution" />
     </MenuItem>
     <MenuItem Header="User" x:Name="Menu_USER" ToolTip="User accounts" />
     <MenuItem Header="PowerShell" x:Name="Menu_POWERSHELL" ToolTip="Powershell scripts">
       <MenuItem Header="Bulk" x:Name="Menu_BULK"><MenuItem.Icon><Image Source="e:/img/csv.png" Width="18" Height="18"/></MenuItem.Icon></MenuItem>
     </MenuItem>
     <MenuItem Header="Exchange" x:Name="Menu_EXCHANGE" ToolTip="Exchange/Outlook" />
     <MenuItem Header="Network" x:Name="Menu_NETWORK" ToolTip="Network and server">
        <MenuItem Header="Server" x:Name="Menu_SERVER"><MenuItem.Icon><Image Source="e:/img/icon.server.png"/></MenuItem.Icon></MenuItem>
     </MenuItem>
     <MenuItem Header="Info" x:Name="Menu_INFO" ToolTip="Info (read-only) tools for users/machines" />
     <MenuItem Header="WMI" x:Name="Menu_WMI" ToolTip="Windows Management Interface" />
     <MenuItem Header="UserTools" x:Name="Menu_USERTOOLS" ToolTip="Shortcuts installed on \\$machine\c:\Users\$username\Desktop" />
     <MenuItem Header="Beta" x:Name="Menu_BETA" ToolTip="New/experimental scripts" />
     <MenuItem Header="_Extras" x:Name="Menu_EXTRAS" ToolTip="Config, Miscellaneous, Shortcuts">
        <MenuItem Header="Misc" x:Name="Menu_MISC"><MenuItem.Icon><Image Source="e:/img/icon.controller.png"/></MenuItem.Icon></MenuItem>
        <MenuItem Header="Config" x:Name="Menu_CONFIG"><MenuItem.Icon><Image Source="e:/img/icon.tools.png"/></MenuItem.Icon></MenuItem>
        <MenuItem Header="Update" x:Name="Menu_UPDATE"><MenuItem.Icon><Image Source="e:/img/icon.log.png"/></MenuItem.Icon></MenuItem>
        <!--MenuItem Header="TEST scripts" x:Name="Menu_TEST"><MenuItem.Icon><Image Source="e:/img/icon.godzilla.png"/></MenuItem.Icon></MenuItem-->
     </MenuItem>
     <MenuItem Header="✐" x:Name="Menu_EDIT" ToolTip="Script editing" />
     <!--MenuItem Header="δ·°"  HorizontalAlignment="Right" x:Name="Menu_DOCS" ToolTip="w/ blackjack" /-->
  </Menu>

  <DockPanel x:Name="Ribbon" DockPanel.Dock="Top" Height="80" Style="{StaticResource RibbonGradient}">

    <!-- Computer -->
    <Border Style="{StaticResource RibbonBorder}" Width="170" DockPanel.Dock="Left">
      <DockPanel>
        <!-- Btn -->
        <Label DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Bottom" FontWeight="Bold" Foreground="#ff223366" Content="Machine/Hostname"/>
        <Button DockPanel.Dock="Left" x:Name="BtnComputer" Width="64" Height="64" Style="{StaticResource ActionButton}" ToolTip="Computer (←clipbrd)"><Image Source="e:/img/computer.png" Width="64" Height="64" /></Button>
        <DockPanel>
          <!-- Clear/Copy/Ping/ToUser -->
          <WrapPanel DockPanel.Dock="Top">
            <Button x:Name="BtnComputerClr" Style="{StaticResource ActionButton}" ToolTip="Clear" Margin="0,0,5,0"><Image Source="e:/img/clear.png" Width="16" Height="16" Opacity="0.2"  /></Button>
            <Button x:Name="BtnComputerCpy" Style="{StaticResource ActionButton}" ToolTip="Copy" Margin="0,0,10,0"><Image Source="e:/img/copy.png" Width="16" Height="16" Opacity="0.5" /></Button>
            <Button x:Name="BtnComputerPng" Style="{StaticResource ActionButton}" ToolTip="ping" Margin="0,0,5,0"><Image Source="e:/img/ping.png" Width="16" Height="16" Opacity="0.4" /></Button>
            <Button x:Name="BtnComputerUsr" Style="{StaticResource ActionButton}" ToolTip="Get current user β†’"><Image Source="e:/img/to-user.png" Width="18" Height="16" Opacity="0.8" /></Button>
          </WrapPanel>
          <!-- Input -->
          <ComboBox x:Name="machine" IsEditable="True" Height="22" Width="90" FontSize="13" FontWeight="Bold" />
        </DockPanel>
      </DockPanel>
    </Border>

    <!-- User -->
    <Border Style="{StaticResource RibbonBorder}" Width="175" DockPanel.Dock="Left">
      <DockPanel>
        <Label DockPanel.Dock="Bottom" HorizontalAlignment="Center" FontWeight="Bold" Foreground="#ff223366" Content="User target"/>
        <Button DockPanel.Dock="Left" x:Name="BtnUsername" Style="{StaticResource ActionButton}" ToolTip="User (←clipbrd)"><Image Source="e:/img/user.png" /></Button>
        <DockPanel>
          <!-- Clear/Copy/ToComputer -->
          <WrapPanel DockPanel.Dock="Top">
            <Button x:Name="BtnUsernameClr" Style="{StaticResource ActionButton}" ToolTip="Clear" Margin="0,0,5,0"><Image Source="e:/img/clear.png" Width="16" Height="16" Opacity="0.2"  /></Button>
            <Button x:Name="BtnUsernameCpy" Style="{StaticResource ActionButton}" ToolTip="Copy" Margin="0,0,50,0"><Image Source="e:/img/copy.png" Width="16" Height="16" Opacity="0.5" /></Button>
            <Button x:Name="BtnUsernameCom" Style="{StaticResource ActionButton}" ToolTip="← To primary computer"><Image Source="e:/img/to-user.png" Width="18" Height="16" Opacity="0.2" /></Button>
          </WrapPanel>
          <!-- Input -->
          <ComboBox x:Name="username" IsEditable="True" Height="22" Width="120" FontSize="13" FontWeight="Bold" />
        </DockPanel>
      </DockPanel>
    </Border> 

    <!-- Bulk -->
    <Border Style="{StaticResource RibbonBorder}" Width="135" DockPanel.Dock="Left">
      <DockPanel>
        <DockPanel DockPanel.Dock="Left">
          <Label DockPanel.Dock="Bottom" HorizontalAlignment="Center" FontWeight="Bold" Foreground="#ff223366" Content="Bulk"/>
          <Button DockPanel.Dock="Top" x:Name="BtnBulkimport" Style="{StaticResource ActionButton}"><Image Source="e:/img/csv.png" /></Button>
        </DockPanel>
        <TextBox DockPanel.Dock="Right" x:Name="bulkcsv" AcceptsReturn="True" Height="64" Width="120" FontSize="10" />
      </DockPanel>
    </Border> 

    <!-- Shortcuts -->
    <Border Style="{StaticResource RibbonBorder}" Width="85" DockPanel.Dock="Left">
      <DockPanel>
        <Label DockPanel.Dock="Bottom" HorizontalAlignment="Center" FontWeight="Bold" Foreground="#ff223366" Content="Shortcuts"/>
        <WrapPanel DockPanel.Dock="Top" x:Name="Shortcuts" Width="82" Height="80" />
      </DockPanel>
    </Border> 

    <!-- Unicode -->
    <Border Style="{StaticResource RibbonBorderGreen}" Width="155" DockPanel.Dock="Left">
      <DockPanel>
        <Label DockPanel.Dock="Bottom" HorizontalAlignment="Center" FontWeight="Bold" Foreground="#ff223366" Content="Unicode"/>
        <ScrollViewer DockPanel.Dock="Top"> <WrapPanel x:Name="UnicodeClip" Width="140" Height="66">
          <Button Style="{StaticResource ActionButton}" Content="❏" />
          <Button Style="{StaticResource ActionButton}" Content="βœ”" />
          <Button Style="{StaticResource ActionButton}" Content="✘" />
          <Button Style="{StaticResource ActionButton}" Content="➜" />
          <Button Style="{StaticResource ActionButton}" Content="➩" />
          <Button Style="{StaticResource ActionButton}" Content="β–Ά" />
          <Button Style="{StaticResource ActionButton}" Content="⏩" />
          <Button Style="{StaticResource ActionButton}" Content="✎" />

          <Button Style="{StaticResource ActionButton}" Content="❍"  />
          <Button Style="{StaticResource ActionButton}" Content="β˜‘" />
          <Button Style="{StaticResource ActionButton}" Content="β˜’" />
          <Button Style="{StaticResource ActionButton}" Content="⟳" />
          <Button Style="{StaticResource ActionButton}" Content="❎" />
          <Button Style="{StaticResource ActionButton}" Content="β˜›" />
          <Button Style="{StaticResource ActionButton}" Content="β™»" />
          <Button Style="{StaticResource ActionButton}" Content="βš™" />

          <Button Style="{StaticResource ActionButton}" Content="✰" />
          <Button Style="{StaticResource ActionButton}" Content="✱" />
          <Button Style="{StaticResource ActionButton}" Content="☎" />
          <Button Style="{StaticResource ActionButton}" Content="➟" />
          <Button Style="{StaticResource ActionButton}" Content="⚑" />
          <Button Style="{StaticResource ActionButton}" Content="β€·" />
          <Button Style="{StaticResource ActionButton}" Content="❚" />
          <Button Style="{StaticResource ActionButton}" Content="〓" />
          <Button Style="{StaticResource ActionButton}" Content="❯" />
        </WrapPanel> </ScrollViewer>
      </DockPanel>
    </Border> 

    <!-- Clipboard -->
    <Border Style="{StaticResource RibbonBorderGreen}" Width="125" DockPanel.Dock="Right">
      <DockPanel>
        <Label DockPanel.Dock="Bottom" HorizontalAlignment="Center" FontWeight="Bold" Foreground="#ff223366" Content="Clipboard"/>
        <Button DockPanel.Dock="Left" x:Name="BtnClipText" ToolTip="Copy (text)" Width="48" Height="48" Style="{StaticResource ActionButton}"><Image Source="e:/img/clipboard.png" /></Button>
        <Button DockPanel.Dock="Left" x:Name="BtnClipHtml" ToolTip="Copy (colored)" Width="48" Height="48" Style="{StaticResource ActionButton}"><Image Source="e:/img/html.png" /></Button>
        <Button DockPanel.Dock="Top" x:Name="BtnClipFree" ToolTip="Clear" Width="24" Height="20" Style="{StaticResource ActionButton}"><Image Source="e:/img/sweep.png" /></Button>
        <Button DockPanel.Dock="Bottom" x:Name="BtnClipSwap" ToolTip="Last buffer" Width="24" Height="20" Style="{StaticResource ActionButton}"><Image Source="e:/img/back.png" /></Button>
      </DockPanel>
    </Border> 
  </DockPanel>

  <!-- Main -->
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="2" />
      <ColumnDefinition Width="5" />
      <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>

    <TabControl TabStripPlacement="Left" Background="White">
      <TabItem Style="{StaticResource MainTab}">
        <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="e:/img/icon.cmd.png" Width="20" Height="20" /> <Label Content="CMD" FontSize="14" FontWeight="Bold" /> </StackPanel> </TabItem.Header>
        <ScrollViewer> <WrapPanel x:Name="Grid_CMD" Background="#ff777a87" /> </ScrollViewer>
      </TabItem>
      <TabItem Style="{StaticResource MainTab}">
        <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="e:/img/icon.users.png" Width="20" Height="20" /> <Label Content="User" FontSize="14" FontWeight="Bold" /> </StackPanel> </TabItem.Header>
        <ScrollViewer> <WrapPanel x:Name="Grid_USER" Background="#ff777a87" /> </ScrollViewer>
      </TabItem>
      <TabItem Style="{StaticResource MainTab}">
        <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="e:/img/icon.powershell.png" Width="20" Height="20" /> <Label Content="Power" FontSize="14" FontWeight="Bold" /> </StackPanel> </TabItem.Header>
        <ScrollViewer> <WrapPanel x:Name="Grid_POWERSHELL" Background="#ff777a87" /> </ScrollViewer>
      </TabItem>
      <TabItem Style="{StaticResource MainTab}">
        <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="e:/img/icon.exchange.png" Width="20" Height="20" /> <Label Content="Exchange" FontSize="14" FontWeight="Bold" /> </StackPanel> </TabItem.Header>
        <ScrollViewer> <WrapPanel x:Name="Grid_EXCHANGE" Background="#ff777a87" /> </ScrollViewer>
      </TabItem>
      <TabItem Style="{StaticResource MainTab}">
        <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="e:/img/icon.info.png" Width="20" Height="20" /> <Label Content="Info" FontSize="14" /> </StackPanel> </TabItem.Header>
        <ScrollViewer> <WrapPanel x:Name="Grid_INFO" Background="#ff777a87" /> </ScrollViewer>
      </TabItem>
      <TabItem Style="{StaticResource MainTab}">
        <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="e:/img/icon.beta.png" Width="20" Height="20" /> <Label Content="Beta" FontSize="14" FontWeight="Bold" /> </StackPanel> </TabItem.Header>
        <ScrollViewer> <WrapPanel x:Name="Grid_BETA" Background="#ff777a87" /> </ScrollViewer>
      </TabItem>
      <TabItem Style="{StaticResource MainTab}">
        <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="e:/img/icon.tools.png" Width="20" Height="20" /> <Label Content="Extras" FontSize="14" /> </StackPanel> </TabItem.Header>
        <ScrollViewer> <WrapPanel x:Name="Grid_EXTRAS" Background="#ff777a87" /> </ScrollViewer>
      </TabItem>
    </TabControl>

    <Grid Grid.Column="2" Width="1" HorizontalAlignment="Stretch" Background="#ff444444" />
    <GridSplitter Grid.Column="3" Width="7" HorizontalAlignment="Stretch" Background="#ff444444" />

    <ScrollViewer Grid.Column="4">
       <TextBlock x:Name="Output" Padding="2"
       FontSize="12" FontFamily="Consolas,Mono" FontWeight="Normal" TextWrapping="Wrap"
       HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
       Foreground="White" Background="#012356"></TextBlock>
    </ScrollViewer>
  </Grid>

  </DockPanel>
</Window>