Skip to content

Commit

Permalink
EasyJob 1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
akshinmustafayev authored Oct 10, 2021
1 parent d48e966 commit f5169dd
Show file tree
Hide file tree
Showing 13 changed files with 242 additions and 46 deletions.
8 changes: 7 additions & 1 deletion EasyJob.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<ApplicationIcon>Images\icon.ico</ApplicationIcon>
<Version>1.0.8</Version>
<Version>1.0.9</Version>
<Authors>Akshin Mustafayev</Authors>
<Description>Keep and execute your PowerShell scripts from one interface</Description>
<Copyright>Akshin Mustafayev</Copyright>
Expand All @@ -19,6 +19,7 @@
<None Remove="Images\add.png" />
<None Remove="Images\addbutton.png" />
<None Remove="Images\addtab.png" />
<None Remove="Images\clear.png" />
<None Remove="Images\close.png" />
<None Remove="Images\convert.png" />
<None Remove="Images\down.png" />
Expand All @@ -27,6 +28,8 @@
<None Remove="Images\github.png" />
<None Remove="Images\icon.ico" />
<None Remove="Images\reload.png" />
<None Remove="Images\removetab.png" />
<None Remove="Images\renametab.png" />
<None Remove="Images\reorder.png" />
<None Remove="Images\troubleshoot.png" />
<None Remove="Images\up.png" />
Expand All @@ -43,6 +46,7 @@
<Resource Include="Images\add.png" />
<Resource Include="Images\addbutton.png" />
<Resource Include="Images\addtab.png" />
<Resource Include="Images\clear.png" />
<Resource Include="Images\close.png" />
<Resource Include="Images\convert.png" />
<Resource Include="Images\down.png" />
Expand All @@ -51,6 +55,8 @@
<Resource Include="Images\github.png" />
<Resource Include="Images\icon.ico" />
<Resource Include="Images\reload.png" />
<Resource Include="Images\removetab.png" />
<Resource Include="Images\renametab.png" />
<Resource Include="Images\reorder.png" />
<Resource Include="Images\troubleshoot.png" />
<Resource Include="Images\up.png" />
Expand Down
6 changes: 6 additions & 0 deletions EasyJob.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<Compile Update="Windows\NewTabDialog.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\RenameTabDialog.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\ReorderTabsDialog.xaml.cs">
<SubType>Code</SubType>
</Compile>
Expand All @@ -39,6 +42,9 @@
<Page Update="Windows\NewTabDialog.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\RenameTabDialog.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\ReorderTabsDialog.xaml">
<SubType>Designer</SubType>
</Page>
Expand Down
Binary file added Images/clear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/removetab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/renametab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 24 additions & 2 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,22 @@
mc:Ignorable="d" Icon="pack://application:,,,/Images/icon.ico"
Title="EasyJob Executor" Height="450" Width="800" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ContextMenu x:Key="AddTabContextMenu">
<MenuItem Header="Add tab" Click="ContextMenuAddTab_Click"/>
</ContextMenu>
<ContextMenu x:Key="RemoveTabContextMenu">
<MenuItem Header="Remove tab" Click="ContextMenuRemoveTab_Click"/>
</ContextMenu>
<ContextMenu x:Key="RemoveActionButtonContextMenu">
<MenuItem Header="Remove button" Click="ContextMenuRemoveActionButton_Click"/>
<ContextMenu x:Key="RemoveAddTabContextMenu">
<MenuItem Header="Add tab" Click="ContextMenuAddTab_Click"/>
<MenuItem Header="Remove tab" Click="ContextMenuRemoveTab_Click"/>
</ContextMenu>
<ContextMenu x:Key="AddActionButtonContextMenu">
<MenuItem Header="Add button" Click="ContextMenuAddActionButton_Click"/>
</ContextMenu>
<ContextMenu x:Key="RemoveActionButtonContextMenu">
<MenuItem Header="Remove button" Click="ContextMenuRemoveActionButton_Click"/>
</ContextMenu>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
Expand All @@ -40,6 +47,11 @@
<Image Source="pack://application:,,,/Images/folder.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Clear events list" Click="ClearEventsLogListMenuItem_Click">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Images/clear.png"/>
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Exit" Click="MenuItemExit_Click">
<MenuItem.Icon>
Expand All @@ -62,6 +74,16 @@
<Image Source="pack://application:,,,/Images/addtab.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Remove current tab" Click="RemoveCurrentTabMenuItem_Click">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Images/removetab.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Rename current tab" Click="RenameCurrentTabMenuItem_Click">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Images/renametab.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Add button to current tab" Click="AddButtonToCurrentTabMenuItem_Click">
<MenuItem.Icon>
<Image Source="pack://application:,,,/Images/addbutton.png"/>
Expand Down
113 changes: 99 additions & 14 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,17 @@ private void ShowAddButtonDialog()
}
}

private void ShowAddNewTabDialog()
{
NewTabDialog ntd = new NewTabDialog();
ntd.ShowDialog();

LoadConfig();

MainTab.Items.Refresh();
this.UpdateLayout();
}

public void ClearOutputButton_Click(object sender, RoutedEventArgs e)
{
TabData td = (TabData)MainTab.SelectedItem;
Expand Down Expand Up @@ -573,6 +584,11 @@ private void OpenAppFolderMenuItem_Click(object sender, RoutedEventArgs e)
}
}

private void ClearEventsLogListMenuItem_Click(object sender, RoutedEventArgs e)
{
EventsList.Items.Clear();
}

private void ReorderTabsMenuItem_Click(object sender, RoutedEventArgs e)
{
ReorderTabsDialog rtd = new ReorderTabsDialog();
Expand All @@ -586,13 +602,59 @@ private void ReorderTabsMenuItem_Click(object sender, RoutedEventArgs e)

private void AddTabMenuItem_Click(object sender, RoutedEventArgs e)
{
NewTabDialog ntd = new NewTabDialog();
ntd.ShowDialog();
ShowAddNewTabDialog();
}

LoadConfig();
private void RemoveCurrentTabMenuItem_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show("Do you want to delete current tab?", "Please confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
List<TabData> newSourceTabs = new List<TabData>();
foreach (TabData tab in MainTab.Items)
{
TabData currentTab = MainTab.Items[MainTab.SelectedIndex] as TabData;
if (tab != currentTab)
{
newSourceTabs.Add(tab);
}
}

MainTab.Items.Refresh();
this.UpdateLayout();
MainTab.ItemsSource = null;
MainTab.ItemsSource = newSourceTabs;

if (SaveConfig())
{
MainTab.Items.Refresh();
this.UpdateLayout();
}
}
}

private void RenameCurrentTabMenuItem_Click(object sender, RoutedEventArgs e)
{
RenameTabDialog rtd = new RenameTabDialog();
if(rtd.ShowDialog() == true)
{
List<TabData> newSourceTabs = new List<TabData>();
foreach (TabData tab in MainTab.Items)
{
TabData currentTab = MainTab.Items[MainTab.SelectedIndex] as TabData;
if (tab == currentTab)
{
tab.TabHeader = rtd.NewTabName;
}
newSourceTabs.Add(tab);
}

MainTab.ItemsSource = null;
MainTab.ItemsSource = newSourceTabs;

if (SaveConfig())
{
MainTab.Items.Refresh();
this.UpdateLayout();
}
}
}

private void AddButtonToCurrentTabMenuItem_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -671,17 +733,35 @@ public void ActionButtonAdd_PreviewMouseDown(object sender, MouseButtonEventArgs

private void TabHeaderSelector_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (config.restrictions.block_tabs_remove == true)
{
return;
}

if (e.RightButton == MouseButtonState.Pressed)
{
selectedTabItem = ((Label)e.Source).DataContext as TabData;
ContextMenu cm = this.FindResource("RemoveTabContextMenu") as ContextMenu;
cm.PlacementTarget = sender as Label;
cm.IsOpen = true;
if (config.restrictions.block_tabs_remove == true && config.restrictions.block_tabs_add == true)
{
return;
}
else if (config.restrictions.block_tabs_remove == false && config.restrictions.block_tabs_add == true)
{
selectedTabItem = ((Label)e.Source).DataContext as TabData;
ContextMenu cm = this.FindResource("RemoveTabContextMenu") as ContextMenu;
cm.PlacementTarget = sender as Label;
cm.IsOpen = true;
return;
}
else if (config.restrictions.block_tabs_remove == true && config.restrictions.block_tabs_add == false)
{
selectedTabItem = ((Label)e.Source).DataContext as TabData;
ContextMenu cm = this.FindResource("AddTabContextMenu") as ContextMenu;
cm.PlacementTarget = sender as Label;
cm.IsOpen = true;
return;
}
else if (config.restrictions.block_tabs_remove == false && config.restrictions.block_tabs_add == false)
{
selectedTabItem = ((Label)e.Source).DataContext as TabData;
ContextMenu cm = this.FindResource("RemoveAddTabContextMenu") as ContextMenu;
cm.PlacementTarget = sender as Label;
cm.IsOpen = true;
}
}
}

Expand Down Expand Up @@ -712,6 +792,11 @@ private void ContextMenuRemoveTab_Click(object sender, RoutedEventArgs e)
}
}

private void ContextMenuAddTab_Click(object sender, RoutedEventArgs e)
{
ShowAddNewTabDialog();
}

private void ContextMenuRemoveActionButton_Click(object sender, RoutedEventArgs e)
{
if (selectedActionButton == null)
Expand Down
1 change: 1 addition & 0 deletions Windows/AboutDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<TextBlock Padding="12" Grid.Column="0" Text="About" Style="{StaticResource HeaderTextBlockStyle}" Background="#E2E2E2"/>
<Image Grid.Column="1" Source="pack://application:,,,/Images/github.png" Height="Auto" Width="Auto" MouseLeftButtonDown="GithubImage_MouseLeftButtonDown" Cursor="Hand" Stretch="Fill"/>
</Grid>

<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
Expand Down
2 changes: 1 addition & 1 deletion Windows/AnswerDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class AnswerDialog : Window
public AnswerDialog(AnswerData _answerData)
{
InitializeComponent();
this.answerData = _answerData;
answerData = _answerData;
if (_answerData != null)
{
foreach (Answer answer in _answerData.Answers)
Expand Down
14 changes: 8 additions & 6 deletions Windows/NewTabDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
ui:WindowHelper.UseModernWindowStyle="True"
xmlns:local="clr-namespace:EasyJob.Windows"
mc:Ignorable="d" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
Title="Create new Tab" Height="200" Width="400">
Title="Create new Tab" Height="260" Width="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="42"/>
<RowDefinition Height="90"/>
<RowDefinition Height="36"/>
<RowDefinition Height="*"/>
<RowDefinition Height="48"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>

<Label Content="Please specify new tab name" Margin="10" Grid.Row="0"/>
<TextBox x:Name="CreateNewTabTextBox" Grid.Row="1" Margin="10,15,10,15" Height="16"/>
<Button Grid.Row="2" Content="Add" Margin="0,0,10,0" HorizontalAlignment="Right" Click="CreateNewTabButton_Click"/>
<TextBlock Padding="12" Grid.Row="0" Text="Crate new tab" Style="{StaticResource HeaderTextBlockStyle}" Background="#E2E2E2"/>
<Label Content="Please specify new tab name" Margin="8" Grid.Row="1"/>
<TextBox x:Name="CreateNewTabTextBox" Grid.Row="2" Margin="10,10,10,10" Height="16"/>
<Button Grid.Row="3" Content="Add" Margin="0,0,10,0" HorizontalAlignment="Right" Click="CreateNewTabButton_Click"/>
</Grid>
</Window>
25 changes: 25 additions & 0 deletions Windows/RenameTabDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Window x:Class="EasyJob.Windows.RenameTabDialog"
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.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True"
xmlns:local="clr-namespace:EasyJob.Windows"
mc:Ignorable="d" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
Title="Rename tab" Height="260" Width="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="90"/>
<RowDefinition Height="36"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>

<TextBlock Padding="12" Grid.Row="0" Text="Rename current tab" Style="{StaticResource HeaderTextBlockStyle}" Background="#E2E2E2"/>
<Label Content="Please specify new tab name" Margin="8" Grid.Row="1"/>
<TextBox x:Name="RenameTabTextBox" Grid.Row="2" Margin="10,10,10,10" Height="16"/>
<Button Grid.Row="3" Content="Rename" Margin="0,0,10,0" HorizontalAlignment="Right" Click="RenameTabButton_Click"/>
<Button Grid.Row="3" Content="Cancel" Margin="0,0,85,0" HorizontalAlignment="Right" Click="CancelRenameButton_Click"/>
</Grid>
</Window>
47 changes: 47 additions & 0 deletions Windows/RenameTabDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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.Shapes;

namespace EasyJob.Windows
{
/// <summary>
/// Interaction logic for RenameTabDialog.xaml
/// </summary>
public partial class RenameTabDialog : Window
{
public string NewTabName = "";

public RenameTabDialog()
{
InitializeComponent();
}

private void CancelRenameButton_Click(object sender, RoutedEventArgs e)
{
DialogResult = false;
}

private void RenameTabButton_Click(object sender, RoutedEventArgs e)
{
if(RenameTabTextBox.Text.Length > 0)
{
NewTabName = RenameTabTextBox.Text;
DialogResult = true;
}
else
{
MessageBox.Show("Please specify new name for the tab");
}
}
}
}
Loading

0 comments on commit f5169dd

Please sign in to comment.