Skip to content

Commit

Permalink
Changes by oleitao
Browse files Browse the repository at this point in the history
Messed up when approving pull requests by oleitao. Sorry
Uploading all changes.
  • Loading branch information
akshinmustafayev authored Oct 4, 2021
1 parent f374bae commit 03b2925
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
11 changes: 7 additions & 4 deletions EasyJob.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
<ApplicationIcon>Images\icon.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Utils\**" />
<EmbeddedResource Remove="Utils\**" />
<None Remove="Utils\**" />
<Page Remove="Utils\**" />
</ItemGroup>

<ItemGroup>
<None Remove="Images\convert.png" />
<None Remove="Images\down.png" />
Expand Down Expand Up @@ -37,8 +44,4 @@
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="Utils\" />
</ItemGroup>

</Project>
5 changes: 4 additions & 1 deletion MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<ContextMenu x:Key="cmTabButton">
<MenuItem Name="cmdRemoveTab" Header="Remove Tab" Click="cmdRemoveTab_Click"/>
</ContextMenu>
<ContextMenu x:Key="cmButton">
<MenuItem Name="cmdRemove" Header="Remove" Click="cmdRemove_Click"/>
</ContextMenu>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
Expand Down Expand Up @@ -40,7 +43,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Margin="0,5,5,0" Padding="5" Content="{Binding ButtonText}" Style="{StaticResource EJButtonStyle}" Click="ActionButton_Click">
<Button Margin="0,5,5,0" Padding="5" Content="{Binding ButtonText}" Style="{StaticResource EJButtonStyle}" Click="ActionButton_Click" PreviewMouseDown="ActionButton_PreviewMouseDown">
<Button.ToolTip>
<ToolTip Style="{StaticResource EJToolTipStyle}" Content="{Binding ButtonDescription}" />
</Button.ToolTip>
Expand Down
33 changes: 33 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
Expand All @@ -20,6 +21,7 @@ namespace EasyJob
public partial class MainWindow : Window
{
string selectedTabButton = "";
string selectedButton = "";
public string configJson = "";
public Config config;
ObservableCollection<TaskListTask> tasksList = new ObservableCollection<TaskListTask>();
Expand Down Expand Up @@ -197,6 +199,17 @@ public void ClearOutputButton_Click(object sender, RoutedEventArgs e)
AddTextToEventsList("Output has been cleared!", false);
}

public async void ActionButton_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.RightButton == MouseButtonState.Pressed)
{
selectedButton = ((Button)e.Source).Content.ToString();
ContextMenu cm = this.FindResource("cmButton") as ContextMenu;
cm.PlacementTarget = sender as Button;
cm.IsOpen = true;
}
}

public AnswerData ConvertArgumentsToAnswers(List<Answer> Answers)
{
AnswerData answerData = new AnswerData();
Expand Down Expand Up @@ -546,6 +559,26 @@ private void cmdRemoveTab_Click(object sender, RoutedEventArgs e)
this.UpdateLayout();
}
}
private void cmdRemove_Click(object sender, RoutedEventArgs e)
{
for (int i = 0; i < MainTab.Items.Count; i++)
{
if (MainTab.Items[i] is TabData button)
{
var item = button.TabActionButtons.Where(x => x.ButtonText.Equals(selectedButton)).FirstOrDefault();
if (item != null)
{
button.TabActionButtons.Remove(item);
}
}
}

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

private void TabHeaderSelector_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
Expand Down

0 comments on commit 03b2925

Please sign in to comment.