Fixed many tiny bugs with the process manager (stopping, starting, closing, etc.)

Added so it always remembers the current queue.
Updated UI to a more dark mode UI.
This commit is contained in:
Jonatan Nilsson 2020-04-13 03:53:39 +00:00
parent d846f94cd7
commit d0d06f9880
34 changed files with 4228 additions and 124 deletions

1
.gitignore vendored
View file

@ -106,3 +106,4 @@ Generated_Code #added for RIA/Silverlight projects
_UpgradeReport_Files/ _UpgradeReport_Files/
Backup*/ Backup*/
UpgradeLog*.XML UpgradeLog*.XML
.vs

View file

@ -1,8 +1,20 @@
<Application x:Class="ProgramQueuer.App" <Application x:Class="ProgramQueuer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:ProgramQueuer.Helpers"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml">
<Application.Resources> <Application.Resources>
<ResourceDictionary>
<FontFamily x:Key="FontAwesome">/Resources/fontawesome.otf#Font Awesome 5 Free</FontFamily>
<FontFamily x:Key="FontAwesomeSolid">/Resources/fontawesome-solid.otf#Font Awesome 5 Free</FontFamily>
<FontFamily x:Key="FixedSys">/Resources/fixedsys.ttf#Fixedsys Excelsior</FontFamily>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Monotone.Colors.xaml" />
<ResourceDictionary Source="Monotone.Brushes.xaml" />
<!--<ResourceDictionary Source="Monotone.MahApps.xaml" />-->
<ResourceDictionary Source="Monotone.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>

View file

@ -4,6 +4,7 @@ using System.Configuration;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls;
namespace ProgramQueuer namespace ProgramQueuer
{ {

View file

@ -9,7 +9,7 @@
DragEnter="ListView_DragEnter" Drop="ListView_Drop" DragEnter="ListView_DragEnter" Drop="ListView_Drop"
Loaded="Window_Loaded" Loaded="Window_Loaded"
Width="{Binding Path=width, Source={x:Static properties:Settings.Default}, Mode=TwoWay}" Width="{Binding Path=width, Source={x:Static properties:Settings.Default}, Mode=TwoWay}"
Height="{Binding Path=height, Source={x:Static properties:Settings.Default}, Mode=TwoWay}" Icon="/ProgramQueuer;component/program.ico" StateChanged="Window_StateChanged"> Height="{Binding Path=height, Source={x:Static properties:Settings.Default}, Mode=TwoWay}" Icon="logo.ico" StateChanged="Window_StateChanged">
<Window.Resources> <Window.Resources>
<converters:BoolToVisibility x:Key="boolToVisible" /> <converters:BoolToVisibility x:Key="boolToVisible" />
<converters:BooleanInverter x:Key="BooleanInverter" /> <converters:BooleanInverter x:Key="BooleanInverter" />
@ -18,11 +18,14 @@
<converters:BoolToVisibility /> <converters:BoolToVisibility />
</converters:ValueConverterGroup> </converters:ValueConverterGroup>
</Window.Resources> </Window.Resources>
<Grid> <Grid x:Name="mainGrid">
<Grid.Background>
<SolidColorBrush Color="{DynamicResource BaseM2Color}" />
</Grid.Background>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="9" /> <RowDefinition Height="9" />
<RowDefinition Height="Auto" /> <RowDefinition Height="200" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid> <Grid>
@ -30,20 +33,9 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ListView x:Name="listPrograms" Margin="6 6 6 0" AllowDrop="True" ItemsSource="{Binding QueueList}" SelectionMode="Single"> <ListView x:Name="listPrograms" Margin="8 8 0 8" AllowDrop="True" ItemsSource="{Binding QueueList}" SelectionMode="Single">
<ListView.View> <ListView.View>
<GridView> <GridView>
<GridViewColumn Header="" Width="28">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<!--<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/play.png" Visibility="{Binding Path=Working, Converter={StaticResource boolToVisible}}" />-->
<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/application.png" Visibility="{Binding Path=Finished, Converter={StaticResource boolInvertedToVisible}}" />
<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/accept.png" Visibility="{Binding Path=Finished, Converter={StaticResource boolToVisible}}" />
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="File/Program" Width="{Binding Path=columnWidth1, Source={x:Static properties:Settings.Default}, Mode=TwoWay}"> <GridViewColumn Header="File/Program" Width="{Binding Path=columnWidth1, Source={x:Static properties:Settings.Default}, Mode=TwoWay}">
<GridViewColumn.CellTemplate> <GridViewColumn.CellTemplate>
<DataTemplate> <DataTemplate>
@ -51,75 +43,74 @@
</DataTemplate> </DataTemplate>
</GridViewColumn.CellTemplate> </GridViewColumn.CellTemplate>
</GridViewColumn> </GridViewColumn>
<GridViewColumn Header="Options" Width="{Binding Path=columnWidth2, Source={x:Static properties:Settings.Default}, Mode=TwoWay}"> <GridViewColumn Header="Status" Width="{Binding Path=columnWidth3, Source={x:Static properties:Settings.Default}, Mode=TwoWay}">
<GridViewColumn.CellTemplate> <GridViewColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Button Margin="0 0 6 0" BorderBrush="Transparent" Background="Transparent" Visibility="{Binding Path=Working, Converter={StaticResource boolInvertedToVisible}}" Click="buttonRemove_Click"> <TextBlock Margin="0 0 8 0" Visibility="{Binding Path=Finished, Converter={StaticResource boolToVisible}}" FontFamily="{StaticResource FontAwesomeSolid}" Text="&#xf00c;" Foreground="#17aa22" />
<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/remove.png" /> <TextBlock Text="{Binding Status}" />
</Button>
<Button Margin="0 0 6 0" BorderBrush="Transparent" Background="Transparent" Visibility="{Binding Path=Working, Converter={StaticResource boolToVisible}}" Click="buttonStopCurrent_Click">
<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/stop.png" />
</Button>
<Button Margin="0 0 6 0" BorderBrush="Transparent" Background="Transparent" Visibility="{Binding Path=Working, Converter={StaticResource boolInvertedToVisible}}" Click="buttonStartCurrent_Click">
<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/force_run.png" />
</Button>
<!--<Button Margin="0 0 6 0" BorderBrush="Transparent" Background="Transparent">
<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/window.png" />
</Button>-->
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</GridViewColumn.CellTemplate> </GridViewColumn.CellTemplate>
</GridViewColumn> </GridViewColumn>
<GridViewColumn Header="Status" Width="{Binding Path=columnWidth3, Source={x:Static properties:Settings.Default}, Mode=TwoWay}"> <GridViewColumn Header="Actions" Width="{Binding Path=columnWidth2, Source={x:Static properties:Settings.Default}, Mode=TwoWay}">
<GridViewColumn.CellTemplate> <GridViewColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding Status}" /> <StackPanel Orientation="Horizontal">
<Button FontFamily="{StaticResource FontAwesomeSolid}" ToolTip="Remove this job" BorderThickness="0" FontSize="16" Padding="8 8" Visibility="{Binding Path=Working, Converter={StaticResource boolInvertedToVisible}}" Click="buttonRemove_Click">&#xf2ed;</Button>
<Border Visibility="{Binding Path=Finished, Converter={StaticResource boolInvertedToVisible}}">
<Button FontFamily="{StaticResource FontAwesomeSolid}" ToolTip="Start this job immediately" BorderThickness="0" FontSize="16" Padding="8 8" Visibility="{Binding Path=Working, Converter={StaticResource boolInvertedToVisible}}" Click="buttonStartCurrent_Click">&#xf144;</Button></Border>
<Button FontFamily="{StaticResource FontAwesomeSolid}" ToolTip="Stop this job immediately" BorderThickness="0" FontSize="16" Padding="8 8" Visibility="{Binding Path=Working, Converter={StaticResource boolToVisible}}" Click="buttonStopCurrent_Click">&#xf28d;</Button>
<Button FontFamily="{StaticResource FontAwesomeSolid}" ToolTip="Reset status and queue again" BorderThickness="0" FontSize="16" Padding="8 8" Visibility="{Binding Path=Finished, Converter={StaticResource boolToVisible}}" Click="buttonResetCurrent_Click">&#xf01e;</Button>
<Button FontFamily="{StaticResource FontAwesomeSolid}" ToolTip="Mark as finished" BorderThickness="0" FontSize="16" Padding="8 8" Visibility="{Binding Path=Finished, Converter={StaticResource boolInvertedToVisible}}" Click="buttonMarkFinishedCurrent_Click">&#xf14a;</Button>
</StackPanel>
</DataTemplate> </DataTemplate>
</GridViewColumn.CellTemplate> </GridViewColumn.CellTemplate>
</GridViewColumn> </GridViewColumn>
</GridView> </GridView>
</ListView.View> </ListView.View>
</ListView> </ListView>
<StackPanel Grid.Column="1" Orientation="Vertical"> <StackPanel Grid.Column="1" Orientation="Vertical" Margin="0 8 8 8">
<Button Margin="0 6 6 6" BorderBrush="Transparent" Background="Transparent" Click="buttonAdd_Click" ToolTip="Add a Program to the batch"> <Button FontFamily="{StaticResource FontAwesomeSolid}" Click="buttonAdd_Click" ToolTip="Add a Program to the batch" BorderThickness="0" FontSize="20" Padding="16">&#xf0fe;</Button>
<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/add.png" /> <Button x:Name="buttonEmpty" Click="buttonClear_Click" FontFamily="{StaticResource FontAwesomeSolid}" ToolTip="Clear list" BorderThickness="0" FontSize="20" Padding="16">&#xf2ed;</Button>
</Button> <Popup HorizontalOffset="-180" VerticalOffset="0" Width="250" Height="Auto" x:Name="popupEmpty" PlacementTarget="{Binding ElementName=buttonEmpty}" StaysOpen="False">
<Button x:Name="buttonEmpty" Margin="0 6 6 6" BorderBrush="Transparent" Background="Transparent" Click="buttonClear_Click" ToolTip="Clear list"> <Border BorderBrush="{DynamicResource LighterBaseBrush}" BorderThickness="1">
<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/trash-icon.png" />
</Button>
<Popup HorizontalOffset="-228" VerticalOffset="0" Width="250" Height="Auto" x:Name="popupEmpty" PlacementTarget="{Binding ElementName=buttonEmpty}" StaysOpen="False">
<Border Background="White" BorderBrush="LightGray" BorderThickness="1">
<StackPanel> <StackPanel>
<Button BorderBrush="Transparent" Background="Transparent" Click="buttonClearFinished_Click">Remove Finished Entries</Button> <Button Click="buttonClearFinished_Click">Remove Finished Entries</Button>
<Button BorderBrush="Transparent" Background="Transparent" Click="buttonClearAll_Click" IsEnabled="{Binding Path=Working, Converter={StaticResource BooleanInverter}}">Remove All Entries</Button> <Button Click="buttonClearAll_Click" IsEnabled="{Binding Path=Working, Converter={StaticResource BooleanInverter}}">Remove All Entries</Button>
</StackPanel> </StackPanel>
</Border> </Border>
</Popup> </Popup>
</StackPanel> </StackPanel>
</Grid> </Grid>
<GridSplitter ResizeDirection="Rows" Grid.Row="1" BorderThickness="1" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" DragCompleted="GridSplitter_DragCompleted" /> <GridSplitter x:Name="gridSplitter" ResizeDirection="Rows" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" DragCompleted="GridSplitter_DragCompleted" />
<GroupBox Grid.Row="2" Margin="6 0 6 6" Padding="0 3 0 0"> <Expander Margin="8" x:Name="expanderStatus" Grid.Row="2" ExpandDirection="Down" IsExpanded="True" Expanded="expanderStatus_Expanded" Collapsed="expanderStatus_Collapsed" Header="Output">
<GroupBox.Header> <!--<Expander.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock>Output</TextBlock> <TextBlock>Output</TextBlock>
<CheckBox x:Name="checkboxOverrideOutput" Margin="6 2 0 0" IsChecked="{Binding Path=RedirectOutput, Mode=TwoWay}" IsEnabled="{Binding Path=Working, Converter={StaticResource BooleanInverter}}" Checked="checkboxOverrideOutput_Checked" Unchecked="checkboxOverrideOutput_Unchecked">Override Console Window</CheckBox> <CheckBox x:Name="checkboxOverrideOutput" Margin="6 2 0 0" IsChecked="{Binding Path=RedirectOutput, Mode=TwoWay}" IsEnabled="{Binding Path=Working, Converter={StaticResource BooleanInverter}}" Checked="checkboxOverrideOutput_Checked" Unchecked="checkboxOverrideOutput_Unchecked">Override Console Window</CheckBox>
<Button x:Name="buttonHelp" Margin="6 0 0 0" BorderBrush="Transparent" Background="#01FFFFFF" Cursor="Help" Visibility="{Binding Path=Working, Converter={StaticResource boolInvertedToVisible}}" Click="ButtonHelp_Click"> <Button x:Name="buttonHelp" Margin="6 0 0 0" Cursor="Help" Visibility="{Binding Path=Working, Converter={StaticResource boolInvertedToVisible}}" Click="ButtonHelp_Click">
<Image Height="16" Width="16" Source="/ProgramQueuer;component/Resources/help.png" /> What is this?
</Button> </Button>
<Popup HorizontalOffset="0" VerticalOffset="0" Width="350" Height="Auto" x:Name="popupHelp" PlacementTarget="{Binding ElementName=buttonHelp}" StaysOpen="False"> <Popup HorizontalOffset="0" VerticalOffset="0" Width="350" Height="Auto" x:Name="popupHelp" PlacementTarget="{Binding ElementName=buttonHelp}" StaysOpen="False">
<Border BorderBrush="DarkGray" BorderThickness="1" Background="White"> <Border BorderBrush="{DynamicResource LighterBaseBrush}" BorderThickness="1">
<TextBlock Margin="6" TextWrapping="Wrap">Controls whether the cmd (command line window) is displayed or not.<LineBreak /><LineBreak />If this is checked, ProgramQueuer will hide the window and transfer all output in the textbox below.<LineBreak /><LineBreak />If this is not checked, the original cmd window is displayed.</TextBlock> <TextBlock Margin="6" TextWrapping="Wrap">Controls whether the cmd (command line window) is displayed or not.<LineBreak /><LineBreak />If this is checked, ProgramQueuer will hide the window and transfer all output in the textbox below.<LineBreak /><LineBreak />If this is not checked, the original cmd window is displayed.</TextBlock>
</Border> </Border>
</Popup> </Popup>
</StackPanel> </StackPanel>
</GroupBox.Header> </Expander.Header>-->
<TextBox Height="{Binding Path=split_height, Source={x:Static properties:Settings.Default}, Mode=OneWay}" x:Name="textboxStatus" AcceptsReturn="True" IsReadOnly="True" Background="Black" Foreground="White" Text="{Binding Path=SelectedItem.Output, ElementName=listPrograms}" TextChanged="TextBox_TextChanged" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" FontFamily="Fixedsys Excelsior 2.00"> <ScrollViewer Background="Black" >
<TextBox x:Name="textboxStatus" BorderThickness="0" AcceptsReturn="True" IsReadOnly="True" Text="{Binding Path=SelectedItem.Output, ElementName=listPrograms}" TextChanged="TextBox_TextChanged" FontFamily="{StaticResource FixedSys}">
</TextBox> </TextBox>
</GroupBox> </ScrollViewer>
<Button x:Name="buttonExit" Grid.Row="3" HorizontalAlignment="Left" Margin="6 0 6 6" Width="120" Click="ButtonExit_Click">Close</Button> </Expander>
<Button x:Name="buttonStop" Grid.Row="3" HorizontalAlignment="Right" Margin="6 0 6 6" Width="120" Click="ButtonStop_Click" Visibility="{Binding Path=Working, Converter={StaticResource boolToVisible}}">Stop</Button> <Button Margin="8 0 8 8" x:Name="buttonExit" Grid.Row="3" HorizontalAlignment="Left" Width="120" Click="ButtonExit_Click">Close</Button>
<Button x:Name="buttonWork" Grid.Row="3" HorizontalAlignment="Right" Margin="6 0 6 6" Width="120" Click="ButtonWork_Click" Visibility="{Binding Path=Working, Converter={StaticResource boolInvertedToVisible}}">Start</Button> <Button Margin="8 0 8 8" x:Name="buttonStop" Grid.Row="3" HorizontalAlignment="Right" Width="120" Click="ButtonStop_Click" Visibility="{Binding Path=Working, Converter={StaticResource boolToVisible}}">Stop</Button>
<Button Margin="8 0 8 8" x:Name="buttonWork" Grid.Row="3" HorizontalAlignment="Right" Width="120" Click="ButtonWork_Click" Visibility="{Binding Path=Working, Converter={StaticResource boolInvertedToVisible}}">Start</Button>
</Grid> </Grid>
</Window> </Window>

View file

@ -18,7 +18,6 @@ using System.Windows.Threading;
using ProgramQueuer.Queuer; using ProgramQueuer.Queuer;
using WPF.JoshSmith.ServiceProviders.UI; using WPF.JoshSmith.ServiceProviders.UI;
using Microsoft.Win32; using Microsoft.Win32;
using NotifyIcon = System.Windows.Forms.NotifyIcon; using NotifyIcon = System.Windows.Forms.NotifyIcon;
namespace ProgramQueuer namespace ProgramQueuer
@ -45,6 +44,7 @@ namespace ProgramQueuer
this._icon.MouseClick += new System.Windows.Forms.MouseEventHandler(_icon_MouseClick); this._icon.MouseClick += new System.Windows.Forms.MouseEventHandler(_icon_MouseClick);
this.DataContext = _manager; this.DataContext = _manager;
this.listPrograms.ItemsSource = _manager.QueueList; this.listPrograms.ItemsSource = _manager.QueueList;
mainGrid.RowDefinitions[2].Height = new GridLength(ProgramQueuer.Properties.Settings.Default.split_height);
} }
void _icon_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) void _icon_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
@ -62,17 +62,27 @@ namespace ProgramQueuer
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
{ {
_manager.RedirectOutput = ProgramQueuer.Properties.Settings.Default.redirectOutput; _manager.RedirectOutput = ProgramQueuer.Properties.Settings.Default.redirectOutput;
_manager.Load();
new ListViewDragDropManager<ProgramEntry>(this.listPrograms); new ListViewDragDropManager<ProgramEntry>(this.listPrograms);
} }
private void GridSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) private void GridSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
{ {
ProgramQueuer.Properties.Settings.Default.split_height = textboxStatus.Height; ProgramQueuer.Properties.Settings.Default.split_height = mainGrid.RowDefinitions[2].ActualHeight;
} }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{ {
if (_manager.Working) bool working = false;
for (int i = 0; i < _manager.QueueList.Count; i++)
{
if (_manager.QueueList[i].Working)
{
working = true;
break;
}
}
if (working)
if (MessageBox.Show("Are you sure you want to stop current worker and batch and exit application?", "You sure you want to exit?", MessageBoxButton.YesNo) == MessageBoxResult.No) if (MessageBox.Show("Are you sure you want to stop current worker and batch and exit application?", "You sure you want to exit?", MessageBoxButton.YesNo) == MessageBoxResult.No)
{ {
e.Cancel = true; e.Cancel = true;
@ -83,7 +93,8 @@ namespace ProgramQueuer
this._icon.Visible = false; this._icon.Visible = false;
ProgramQueuer.Properties.Settings.Default.redirectOutput = _manager.RedirectOutput; ProgramQueuer.Properties.Settings.Default.redirectOutput = _manager.RedirectOutput;
ProgramQueuer.Properties.Settings.Default.lastPath = _openFile.InitialDirectory; ProgramQueuer.Properties.Settings.Default.lastPath = _openFile.InitialDirectory;
ProgramQueuer.Properties.Settings.Default.Save(); _manager.Save();
// ProgramQueuer.Properties.Settings.Default.Save();
} }
private void ButtonExit_Click(object sender, RoutedEventArgs e) private void ButtonExit_Click(object sender, RoutedEventArgs e)
@ -119,8 +130,9 @@ namespace ProgramQueuer
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);
foreach (string file in files) foreach (string file in files)
{ {
_manager.QueueList.Add(new ProgramEntry { Name = file , Status = "Queued"}); _manager.AddToQueue(new ProgramEntry { Name = file , Status = "Queued"});
_openFile.InitialDirectory = new FileInfo(file).DirectoryName; _openFile.InitialDirectory = new FileInfo(file).DirectoryName;
_manager.Save();
} }
} }
} }
@ -136,14 +148,14 @@ namespace ProgramQueuer
{ {
if (MessageBox.Show("Are you sure you want to kill this process and continue with the next one available?", "Stop current process?", MessageBoxButton.YesNo) == MessageBoxResult.Yes) if (MessageBox.Show("Are you sure you want to kill this process and continue with the next one available?", "Stop current process?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{ {
((sender as Control).DataContext as ProgramEntry).Process.Kill(); _manager.ForceStopEntry((sender as Control).DataContext as ProgramEntry);
} }
} }
else else
{ {
if (MessageBox.Show("Are you sure you want to kill this process?", "Stop selected process?", MessageBoxButton.YesNo) == MessageBoxResult.Yes) if (MessageBox.Show("Are you sure you want to kill this process?", "Stop selected process?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{ {
((sender as Control).DataContext as ProgramEntry).Process.Kill(); _manager.ForceStopEntry((sender as Control).DataContext as ProgramEntry);
} }
} }
} }
@ -160,7 +172,7 @@ namespace ProgramQueuer
{ {
foreach (string file in _openFile.FileNames) foreach (string file in _openFile.FileNames)
{ {
_manager.QueueList.Add(new ProgramEntry { Name = file, Status = "Queued" }); _manager.AddToQueue(new ProgramEntry { Name = file, Status = "Queued" });
_openFile.InitialDirectory = new FileInfo(file).DirectoryName; _openFile.InitialDirectory = new FileInfo(file).DirectoryName;
} }
} }
@ -180,7 +192,7 @@ namespace ProgramQueuer
private void ButtonHelp_Click(object sender, RoutedEventArgs e) private void ButtonHelp_Click(object sender, RoutedEventArgs e)
{ {
popupHelp.IsOpen = true; // popupHelp.IsOpen = true;
} }
private void buttonStartCurrent_Click(object sender, RoutedEventArgs e) private void buttonStartCurrent_Click(object sender, RoutedEventArgs e)
@ -204,14 +216,20 @@ namespace ProgramQueuer
private void buttonClearFinished_Click(object sender, RoutedEventArgs e) private void buttonClearFinished_Click(object sender, RoutedEventArgs e)
{ {
bool changed = false;
for (int i = 0; i < _manager.QueueList.Count; i++) for (int i = 0; i < _manager.QueueList.Count; i++)
{ {
if (_manager.QueueList[i].Finished == true) if (_manager.QueueList[i].Finished == true)
{ {
changed = true;
_manager.QueueList.Remove(_manager.QueueList[i]); _manager.QueueList.Remove(_manager.QueueList[i]);
i--; i--;
} }
} }
if (changed)
{
_manager.Save();
}
popupEmpty.IsOpen = false; popupEmpty.IsOpen = false;
} }
@ -228,8 +246,37 @@ namespace ProgramQueuer
if (MessageBox.Show("Are you sure you want to clear list?", "Clear list?", MessageBoxButton.YesNo) == MessageBoxResult.Yes) if (MessageBox.Show("Are you sure you want to clear list?", "Clear list?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{ {
_manager.QueueList.Clear(); _manager.QueueList.Clear();
_manager.Save();
} }
popupEmpty.IsOpen = false; popupEmpty.IsOpen = false;
} }
private void expanderStatus_Expanded(object sender, RoutedEventArgs e)
{
mainGrid.RowDefinitions[2].Height = new GridLength(ProgramQueuer.Properties.Settings.Default.split_height);
gridSplitter.Visibility = Visibility.Visible;
}
private void expanderStatus_Collapsed(object sender, RoutedEventArgs e)
{
mainGrid.RowDefinitions[2].Height = new GridLength(0, GridUnitType.Auto);
gridSplitter.Visibility = Visibility.Collapsed;
}
private void buttonResetCurrent_Click(object sender, RoutedEventArgs e)
{
var entry = (sender as Control).DataContext as ProgramEntry;
entry.Finished = false;
entry.Status = "Queued";
_manager.Save();
}
private void buttonMarkFinishedCurrent_Click(object sender, RoutedEventArgs e)
{
var entry = (sender as Control).DataContext as ProgramEntry;
entry.Finished = true;
entry.Status = "Marked finished";
_manager.Save();
}
} }
} }

View file

@ -0,0 +1,196 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ProgramQueuer">
<sys:Double x:Key="DefaultBorderThicknessNumber">1</sys:Double>
<Thickness x:Key="ButtonBorderThickness">1</Thickness>
<Thickness x:Key="ToolbarBorderThickness">1</Thickness>
<Thickness x:Key="DefaultBorderThickness">1</Thickness>
<Thickness x:Key="ComboBoxBorderThickness">1</Thickness>
<!-- The Top value has to be the negative of the BorderThickness. By setting this the (selected) TabItem-Header will exactly overlap with the border -->
<Thickness x:Key="TabTopContentPlacement" Top="-1"></Thickness>
<Thickness x:Key="TabBottomContentPlacement" Bottom="-1"></Thickness>
<Thickness x:Key="TabLeftContentPlacement" Left="-1"></Thickness>
<Thickness x:Key="TabRightContentPlacement" Right="-1"></Thickness>
<Thickness x:Key="TabHeaderTopThickness" Left="1" Top="1" Right="1"></Thickness>
<Thickness x:Key="TabHeaderBottomThickness" Left="1" Right="1" Bottom="1"></Thickness>
<Thickness x:Key="TabHeaderLeftThickness" Left="1" Top="1" Bottom="1"></Thickness>
<Thickness x:Key="TabHeaderRightThickness" Top="1" Right="1" Bottom="1"></Thickness>
<Thickness x:Key="TabHeaderTopThicknessInverted" Bottom="1"></Thickness>
<Thickness x:Key="TabHeaderBottomThicknessInverted" Top="1"></Thickness>
<Thickness x:Key="TabHeaderLeftThicknessInverted" Right="1"></Thickness>
<Thickness x:Key="TabHeaderRightThicknessInverted" Left="1"></Thickness>
<CornerRadius x:Key="ButtonCornerRadius">1</CornerRadius>
<CornerRadius x:Key="UpperInnerButtonCornerRadius">0</CornerRadius>
<CornerRadius x:Key="LowerInnerButtonCornerRadius">0</CornerRadius>
<CornerRadius x:Key="DefaultCornerRadius">1</CornerRadius>
<CornerRadius x:Key="ComboBoxCornerRadius">2</CornerRadius>
<CornerRadius x:Key="ComboBoxRightCornerRadius" TopRight="0" BottomRight="0"></CornerRadius>
<!-- Corner Radius for TabControl -->
<CornerRadius x:Key="TabTopCornerRadius" TopRight="0" BottomLeft="0" BottomRight="0"></CornerRadius>
<CornerRadius x:Key="TabBottomCornerRadius" TopLeft="0" TopRight="0" BottomRight="0"></CornerRadius>
<CornerRadius x:Key="TabLeftCornerRadius" TopRight="0" BottomLeft="0" BottomRight="0"></CornerRadius>
<CornerRadius x:Key="TabRightCornerRadius" TopLeft="0" BottomLeft="0" BottomRight="0"></CornerRadius>
<!-- CornerRadius for TabItem -->
<CornerRadius x:Key="TabTopHeaderCornerRadius" TopLeft="0" TopRight="0"></CornerRadius>
<CornerRadius x:Key="TabBottomHeaderCornerRadius" BottomLeft="0" BottomRight="0"></CornerRadius>
<CornerRadius x:Key="TabLeftHeaderCornerRadius" TopLeft="0" BottomLeft="0"></CornerRadius>
<CornerRadius x:Key="TabRightHeaderCornerRadius" TopRight="0" BottomRight="0"></CornerRadius>
<SolidColorBrush Color="{DynamicResource BaseColor}" x:Key="BaseBrush" />
<SolidColorBrush Color="{DynamicResource Base2Color}" x:Key="LighterBaseBrush" />
<SolidColorBrush Color="{DynamicResource Base4Color}" x:Key="VeryLighterBaseBrush" />
<SolidColorBrush Color="{DynamicResource Base6Color}" x:Key="PopupBorderBrush" />
<SolidColorBrush Color="{DynamicResource BaseM2Color}" x:Key="DarkerBaseBrush" />
<SolidColorBrush Color="{StaticResource TextColor}" x:Key="TextBrush" />
<SolidColorBrush Color="{DynamicResource Base2Color}" x:Key="BaseBorderBrush" />
<SolidColorBrush Color="{DynamicResource Base3TColor}" x:Key="SemiTransparentBaseBorderBrush" />
<SolidColorBrush Color="{DynamicResource ErrorColor}" x:Key="ErrorBrush" />
<SolidColorBrush Color="{DynamicResource DarkErrorColor}" x:Key="DarkerErrorBrush" />
<SolidColorBrush Color="{DynamicResource BaseM2TColor}" x:Key="SemiTransparentDarkerBaseBrush" />
<DropShadowEffect x:Key="ButtonHoverGlowEffect" BlurRadius="10" ShadowDepth="0" Color="Cyan" />
<DropShadowEffect x:Key="ButtonPressedGlowEffect" BlurRadius="10" ShadowDepth="0" Color="DarkCyan" />
<SolidColorBrush x:Key="ButtonGlowBrush" Color="Cyan" />
<Thickness x:Key="GlowBorderThickness">10</Thickness>
<Thickness x:Key="GlowBorderMargin">-11</Thickness>
<Thickness x:Key="GlowBorderMargin2">-10</Thickness>
<LinearGradientBrush x:Key="ToolBarTrayBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="{DynamicResource Base2Color}" Offset="0" />
<GradientStop Color="{DynamicResource BaseColor}" Offset="1" />
</LinearGradientBrush>
<SolidColorBrush x:Key="ButtonBackgroundBrush" Color="Transparent" />
<!--<LinearGradientBrush x:Key="ButtonBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="{DynamicResource Base3Color}" Offset="0" />
<GradientStop Color="{DynamicResource BaseColor}" Offset="1" />
</LinearGradientBrush>-->
<LinearGradientBrush x:Key="ButtonBackgroundBrush90D" StartPoint="0,0" EndPoint="1,0">
<GradientStop Color="{DynamicResource Base3Color}" Offset="0" />
<GradientStop Color="{DynamicResource BaseColor}" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="TabItemHeaderBrush" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#111" Offset="0" />
<GradientStop Color="{DynamicResource BaseM1Color}" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="HorizontalButtonBackgroundBrush" StartPoint="0,0" EndPoint="1,0">
<GradientStop Color="{DynamicResource Base2Color}" Offset="1" />
<GradientStop Color="{DynamicResource BaseColor}" Offset="0" />
</LinearGradientBrush>
<SolidColorBrush x:Key="ButtonBackgroundPressedBrush" Color="{DynamicResource SelectedColorLight}" />
<!--<LinearGradientBrush x:Key="ButtonBackgroundPressedBrush" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="{DynamicResource BaseColor}" Offset="0" />
<GradientStop Color="{DynamicResource Base3Color}" Offset="1" />
</LinearGradientBrush>-->
<LinearGradientBrush x:Key="LighterBaseGradientBrush" StartPoint="0,1" EndPoint="0,0">
<LinearGradientBrush.GradientStops>
<GradientStop Color="{DynamicResource Base2Color}" Offset="0" />
<GradientStop Color="{DynamicResource Base1Color}" Offset="0.1" />
<GradientStop Color="{DynamicResource Base1Color}" Offset="0.5" />
<GradientStop Color="{DynamicResource Base1Color}" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="ProgressBarBrush" StartPoint="0,1" EndPoint="0,0">
<LinearGradientBrush.GradientStops>
<GradientStop Color="{DynamicResource Base2Color}" Offset="0" />
<GradientStop Color="Transparent" Offset="0.2" />
<GradientStop Color="Transparent" Offset="0.8" />
<GradientStop Color="{DynamicResource Base2Color}" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="ProgressBarGlowBrush" StartPoint="1,0" EndPoint="0,0">
<LinearGradientBrush.GradientStops>
<GradientStop Color="Transparent" Offset="0" />
<GradientStop Color="Transparent" Offset="0.4" />
<GradientStop Color="{DynamicResource SelectedColor}" Offset="0.5" />
<GradientStop Color="Transparent" Offset="0.7" />
<GradientStop Color="Transparent" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="LighterBaseGradientHoverBrush"
StartPoint="0,0"
EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#50444444" Offset="0" />
<GradientStop Color="#50333333" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="LighterBaseGradientBrush2"
StartPoint="0,0"
EndPoint="0,1">
<GradientStop Color="{DynamicResource Base2Color}" Offset="0" />
<GradientStop Color="{DynamicResource Base1Color}" Offset="1" />
</LinearGradientBrush>
<SolidColorBrush Color="{DynamicResource SelectedColor}" x:Key="SelectedBrush" />
<SolidColorBrush Color="{DynamicResource DarkerSelectedColor}" x:Key="DarkerSelectedBrush" />
<SolidColorBrush x:Key="SelectedTabColorBrush" Color="{DynamicResource Base5Color}" />
<SolidColorBrush x:Key="HoverTabColorBrush" Color="{DynamicResource Base6Color}" />
<SolidColorBrush Color="Transparent" x:Key="TransparentBrush" />
<SolidColorBrush Color="{DynamicResource TextColor}" x:Key="GlyphBrush" />
<LinearGradientBrush x:Key="DisabledBrush" EndPoint="0,0" StartPoint="6,6" MappingMode="Absolute" SpreadMethod="Repeat">
<GradientStop Color="{DynamicResource Base2Color}" Offset="0" />
<GradientStop Color="{DynamicResource Base2Color}" Offset="0.5" />
<GradientStop Color="{DynamicResource Base3Color}" Offset="0.5" />
<GradientStop Color="{DynamicResource Base3Color}" Offset="1" />
</LinearGradientBrush>
<!-- <SolidColorBrush x:Key="DisabledBrush" Color="{StaticResource Base3Color}" />-->
<!-- <SolidColorBrush x:Key="DisabledBorderBrush" Color="{StaticResource Base3Color}" />-->
<LinearGradientBrush x:Key="DisabledBorderBrush" EndPoint="0,0" StartPoint="6,6" MappingMode="Absolute" SpreadMethod="Repeat">
<GradientStop Color="{DynamicResource Base2Color}" Offset="0" />
<GradientStop Color="{DynamicResource Base2Color}" Offset="0.5" />
<GradientStop Color="{DynamicResource Base3Color}" Offset="0.5" />
<GradientStop Color="{DynamicResource Base3Color}" Offset="1" />
</LinearGradientBrush>
<SolidColorBrush x:Key="SelectedTabItemHeaderBrush" Color="{DynamicResource BaseColor}" />
<!--<SolidColorBrush x:Key="TabItemHeaderBrush" Color="{DynamicResource Base1Color}" />-->
<Geometry x:Key="Checkmark">M 0,5.1 L 1.7,5.2 L 3.4,7.1 L 8,0.4 L 9.2,0 L 3.3,10.8 Z</Geometry>
<Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
<Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
<Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>
<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
<SolidColorBrush x:Key="MenuHoverBrush" Color="{DynamicResource Base3TColor}" />
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0" x:Key="ProgressbarAnimationBrush">
<GradientStop Color="Transparent" Offset="0" />
<GradientStop Color="#88FFFFFF" Offset="0.5" />
<GradientStop Color="Transparent" Offset="1" />
</LinearGradientBrush>
<BorderGapMaskConverter x:Key="BorderGapMaskConverter"/>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1" x:Key="ProgressBarIndicatorBackground">
<GradientStop Color="{DynamicResource Base3Color}" Offset="0" />
<GradientStop Color="{DynamicResource Base1Color}" Offset="0.5" />
<GradientStop Color="{DynamicResource Base3Color}" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0" x:Key="ProgressBarAnimationBackground">
<GradientStop Color="Transparent" Offset="0" />
<GradientStop Color="{DynamicResource Base1Color}" Offset="0.8" />
<GradientStop Color="Transparent" Offset="1" />
</LinearGradientBrush>
<Geometry x:Key="SliderThumbDisabledGeometry">M -5,-10.5 L 5,-10.5 L 5,10.5 L -5,10.5 Z</Geometry>
<Geometry x:Key="SliderPointedThumbDisabledGeometry">M 4.5,-8.5 L -4.5,-8.5 L -4.5,4.5 L -0.5,8.5 L 0.5,8.5 L 4.5,4.5 Z</Geometry>
<Geometry x:Key="SliderPointedThumbOuterBorderGeometry">M 4.5,-7.5 A 1 1 0 0 0 3.5,-8.5 L -3.5,-8.5 A 1 1 0 0 0 -4.5,-7.5 L -4.5,4.5 L -0.5,8.5 L 0.5,8.5 L 4.5,4.5 Z</Geometry>
<Geometry x:Key="SliderPointedThumbMiddleBorderGeometry">M 3.5,-7.5 L -3.5,-7.5 L -3.5,4.5 L 0,8 L 3.5,4.5 Z</Geometry>
<LinearGradientBrush x:Key="HorizontalSliderThumbNormalBackground" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="{DynamicResource Base3Color}" Offset="0"/>
<GradientStop Color="{DynamicResource Base1Color}" Offset=".8"/>
</LinearGradientBrush>
<Geometry x:Key="SliderThumbOuterBorderGeometry">M -5,-9.5 L 5,-9.5 L 5,9.5 L -5,9.5 Z</Geometry>
<Geometry x:Key="SliderThumbMiddleBorderGeometry">M -4,-8.5 L 4,-8.5 L 4,8.5 L -4,8.5 Z</Geometry>
<LinearGradientBrush x:Key="VerticalSliderThumbNormalBackground" EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource Base3Color}" Offset="0"/>
<GradientStop Color="{DynamicResource Base1Color}" Offset=".8"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="WindowTitleColorBrush" Color="{DynamicResource DarkerSelectedColor}" />
</ResourceDictionary>

View file

@ -0,0 +1,22 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ProgramQueuer">
<Color x:Key="BaseColor">#1f1f1f</Color>
<Color x:Key="Base1Color">#353535</Color>
<Color x:Key="Base2Color">#333</Color>
<Color x:Key="Base3Color">#606060</Color>
<Color x:Key="Base3TColor">#3300FFFF</Color>
<Color x:Key="SelectedColorLight">#0b6767</Color>
<Color x:Key="Base5Color">#999</Color>
<Color x:Key="Base4Color">#555</Color>
<Color x:Key="Base6Color">#BBB</Color>
<Color x:Key="BaseM1Color">#222</Color>
<Color x:Key="BaseM2Color">#1f1f1f</Color>
<Color x:Key="BaseM2TColor">#1f1f1f</Color>
<Color x:Key="TextColor">#ffffff</Color>
<Color x:Key="SelectedColor">Cyan</Color>
<Color x:Key="DarkerSelectedColor">DarkCyan</Color>
<Color x:Key="DarkerSelectedColorHover">#33008B8B</Color>
<Color x:Key="ErrorColor">#ff8888</Color>
<Color x:Key="DarkErrorColor">#aa4444</Color>
</ResourceDictionary>

3657
ProgramQueuer/Monotone.xaml Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@ -10,10 +10,27 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ProgramQueuer</RootNamespace> <RootNamespace>ProgramQueuer</RootNamespace>
<AssemblyName>ProgramQueuer</AssemblyName> <AssemblyName>ProgramQueuer</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
@ -24,6 +41,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
@ -33,15 +51,19 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>program.ico</ApplicationIcon> <ApplicationIcon>logo.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PresentationFramework.Aero" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@ -77,6 +99,18 @@
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Page Include="Monotone.Brushes.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Monotone.Colors.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Monotone.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
@ -102,42 +136,26 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
<AppDesigner Include="Properties\" /> <AppDesigner Include="Properties\" />
<Resource Include="Resources\fixedsys.ttf" />
<Resource Include="Resources\fontawesome-solid.otf" />
<Resource Include="Resources\fontawesome.otf" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\accept.png" /> <Resource Include="logo.ico" />
<Resource Include="Resources\remove.png" />
<Resource Include="Resources\window.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\application.png" /> <BootstrapperPackage Include=".NETFramework,Version=v4.6">
</ItemGroup> <Visible>False</Visible>
<ItemGroup> <ProductName>Microsoft .NET Framework 4.6 %28x86 and x64%29</ProductName>
<Resource Include="Resources\stop.png" /> <Install>true</Install>
</ItemGroup> </BootstrapperPackage>
<ItemGroup> <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Resource Include="Resources\warning.png" /> <Visible>False</Visible>
</ItemGroup> <ProductName>.NET Framework 3.5 SP1</ProductName>
<ItemGroup> <Install>false</Install>
<Resource Include="Resources\play.png" /> </BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\add.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Help.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\force_run.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\trash-icon.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="program.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Program.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -3,6 +3,7 @@ using System.Resources;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
using System.Windows.Markup;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.269 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -19,7 +19,7 @@ namespace ProgramQueuer.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
@ -60,6 +60,9 @@ namespace ProgramQueuer.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon program { internal static System.Drawing.Icon program {
get { get {
object obj = ResourceManager.GetObject("program", resourceCulture); object obj = ResourceManager.GetObject("program", resourceCulture);

View file

@ -112,13 +112,13 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="program" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="program" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\program.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
</root> </root>

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.269 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -12,7 +12,7 @@ namespace ProgramQueuer.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -73,7 +73,7 @@ namespace ProgramQueuer.Properties {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("75")] [global::System.Configuration.DefaultSettingValueAttribute("100")]
public double columnWidth2 { public double columnWidth2 {
get { get {
return ((double)(this["columnWidth2"])); return ((double)(this["columnWidth2"]));
@ -107,6 +107,18 @@ namespace ProgramQueuer.Properties {
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool rememberLast {
get {
return ((bool)(this["rememberLast"]));
}
set {
this["rememberLast"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")] [global::System.Configuration.DefaultSettingValueAttribute("")]
@ -118,5 +130,17 @@ namespace ProgramQueuer.Properties {
this["lastPath"] = value; this["lastPath"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string lastjobs {
get {
return ((string)(this["lastjobs"]));
}
set {
this["lastjobs"] = value;
}
}
} }
} }

View file

@ -15,7 +15,7 @@
<Value Profile="(Default)">300</Value> <Value Profile="(Default)">300</Value>
</Setting> </Setting>
<Setting Name="columnWidth2" Type="System.Double" Scope="User"> <Setting Name="columnWidth2" Type="System.Double" Scope="User">
<Value Profile="(Default)">75</Value> <Value Profile="(Default)">100</Value>
</Setting> </Setting>
<Setting Name="columnWidth3" Type="System.Double" Scope="User"> <Setting Name="columnWidth3" Type="System.Double" Scope="User">
<Value Profile="(Default)">200</Value> <Value Profile="(Default)">200</Value>
@ -23,8 +23,14 @@
<Setting Name="redirectOutput" Type="System.Boolean" Scope="User"> <Setting Name="redirectOutput" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value> <Value Profile="(Default)">True</Value>
</Setting> </Setting>
<Setting Name="rememberLast" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="lastPath" Type="System.String" Scope="User"> <Setting Name="lastPath" Type="System.String" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)" />
</Setting> </Setting>
<Setting Name="lastjobs" Type="System.String" Scope="User">
<Value Profile="(Default)"></Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View file

@ -6,6 +6,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Management;
namespace ProgramQueuer.Queuer namespace ProgramQueuer.Queuer
{ {
@ -13,15 +15,71 @@ namespace ProgramQueuer.Queuer
{ {
bool _working; bool _working;
bool _redirectOutput; bool _redirectOutput;
bool _changed;
ProgramEntry _currentEntry; ProgramEntry _currentEntry;
public EntryManager() public EntryManager()
{ {
QueueList = new ObservableCollection<ProgramEntry>(); QueueList = new ObservableCollection<ProgramEntry>();
_changed = false;
_currentEntry = null; _currentEntry = null;
_redirectOutput = true; _redirectOutput = true;
} }
public void Load()
{
var oldQueue = ProgramQueuer.Properties.Settings.Default.lastjobs;
if (oldQueue.Length == 0) return;
var items = oldQueue.Split(';');
for (int i = 0; i < items.Length; i++)
{
var values = items[i].Split('|');
var base64EncodedBytes = System.Convert.FromBase64String(values[2]);
var entry = new ProgramEntry {
Name = values[0],
Finished = values[1] == "true",
Status = values[1] == "true" ? "Finished" : "Queued",
Output = System.Text.Encoding.UTF8.GetString(base64EncodedBytes)
};
entry.Parent = this;
this.QueueList.Add(entry);
}
}
public void Save()
{
StringBuilder sb = new StringBuilder("");
for (int i = 0; i < this.QueueList.Count; i++)
{
if (i > 0)
{
sb.Append(';');
}
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(this.QueueList[i].Output != null ? this.QueueList[i].Output : "");
sb.Append(String.Format("{0}|{1}|{2}", this.QueueList[i].Name, this.QueueList[i].Finished ? "true" : "false", System.Convert.ToBase64String(plainTextBytes)));
}
ProgramQueuer.Properties.Settings.Default.lastjobs = sb.ToString();
ProgramQueuer.Properties.Settings.Default.Save();
_changed = false;
}
public void TriggerSave()
{
if (_changed) return;
_changed = true;
var task = new Task(async () =>
{
await Task.Delay(60000);
if (!_changed == false) return;
_changed = false;
this.Save();
});
task.Start();
}
public ObservableCollection<ProgramEntry> QueueList; public ObservableCollection<ProgramEntry> QueueList;
public event PropertyChangedEventHandler PropertyChanged = delegate { }; public event PropertyChangedEventHandler PropertyChanged = delegate { };
public event EventHandler OnEntryFinish = delegate { }; public event EventHandler OnEntryFinish = delegate { };
@ -55,14 +113,11 @@ namespace ProgramQueuer.Queuer
PropertyChanged(this, new PropertyChangedEventArgs("RedirectOutput")); PropertyChanged(this, new PropertyChangedEventArgs("RedirectOutput"));
} }
} }
public void RunQueuer() public void RunQueuer()
{ {
if (QueueList.Count > 0) var finished = RunNext();
{ Working = !finished;
Working = true;
_currentEntry = QueueList[0];
RunProgram(QueueList[0]);
}
} }
public void ForceStop() public void ForceStop()
@ -70,7 +125,55 @@ namespace ProgramQueuer.Queuer
this.Working = false; this.Working = false;
foreach (var entry in QueueList) foreach (var entry in QueueList)
if (entry.Working) if (entry.Working)
entry.Process.Kill(); {
ForceStopEntry(entry);
}
this.Save();
}
public void ForceStopEntry(ProgramEntry entry)
{
KillProcessAndChildren(entry.Process.Id);
entry.Output += "\n\n[Process was forcefully stopped]";
// entry.Process.CloseMainWindow();
// entry.Process.Kill();
}
/// <summary>
/// Kill a process, and all of its children, grandchildren, etc.
/// </summary>
/// <param name="pid">Process ID.</param>
private static void KillProcessAndChildren(int pid)
{
// Cannot close 'system idle process'.
if (pid == 0)
{
return;
}
ManagementObjectSearcher searcher = new ManagementObjectSearcher
("Select * From Win32_Process Where ParentProcessID=" + pid);
ManagementObjectCollection moc = searcher.Get();
foreach (ManagementObject mo in moc)
{
KillProcessAndChildren(Convert.ToInt32(mo["ProcessID"]));
}
try
{
Process proc = Process.GetProcessById(pid);
proc.Kill();
}
catch (ArgumentException)
{
// Process already exited.
}
}
public ProgramEntry AddToQueue(ProgramEntry entry)
{
entry.Parent = this;
this.QueueList.Add(entry);
this.Save();
return entry;
} }
public void RunProgram(ProgramEntry entry) public void RunProgram(ProgramEntry entry)
@ -94,6 +197,7 @@ namespace ProgramQueuer.Queuer
_currentEntry = null; _currentEntry = null;
this.Working = false; this.Working = false;
} }
this.Save();
} }
} }
@ -123,12 +227,14 @@ namespace ProgramQueuer.Queuer
break; break;
} }
} }
if (_redirectOutput) if (curr.Redirected)
curr.ProcessManager.StopMonitoringProcessOutput(); curr.ProcessManager.StopMonitoringProcessOutput();
curr.Working = false; curr.Working = false;
curr.Finished = true; curr.Finished = true;
curr.Status = "Finished"; curr.Status = "Finished";
this.Save();
OnEntryFinish(curr, new EventArgs()); OnEntryFinish(curr, new EventArgs());
if (curr == _currentEntry) if (curr == _currentEntry)

View file

@ -14,6 +14,7 @@ namespace ProgramQueuer.Queuer
bool _working; bool _working;
bool _finished; bool _finished;
bool _clearNext; bool _clearNext;
bool _redirected;
string _name; string _name;
string _output; string _output;
string _status; string _status;
@ -25,6 +26,7 @@ namespace ProgramQueuer.Queuer
{ {
Finished = false; Finished = false;
this.Parent = null;
_process = new Process(); _process = new Process();
_process.StartInfo.UseShellExecute = false; _process.StartInfo.UseShellExecute = false;
_process.EnableRaisingEvents = true; _process.EnableRaisingEvents = true;
@ -36,6 +38,13 @@ namespace ProgramQueuer.Queuer
public event PropertyChangedEventHandler PropertyChanged = delegate { }; public event PropertyChangedEventHandler PropertyChanged = delegate { };
public EntryManager Parent;
public bool Redirected
{
get => _redirected;
}
public string Name public string Name
{ {
get { return _name; } get { return _name; }
@ -118,6 +127,7 @@ namespace ProgramQueuer.Queuer
_process.Start(); _process.Start();
if (redirect) if (redirect)
{ {
_redirected = true;
_processManager.RunningProcess = _process; _processManager.RunningProcess = _process;
_processManager.StartProcessOutputRead(); _processManager.StartProcessOutputRead();
} }
@ -129,6 +139,10 @@ namespace ProgramQueuer.Queuer
if (!text.EndsWith("\r") && !text.EndsWith("\n") && _clearNext) if (!text.EndsWith("\r") && !text.EndsWith("\n") && _clearNext)
{ {
_buffer += text; _buffer += text;
if (this.Parent != null)
{
this.Parent.TriggerSave();
}
return; return;
} }
else else
@ -163,6 +177,11 @@ namespace ProgramQueuer.Queuer
_clearNext = true; _clearNext = true;
else else
_clearNext = false; _clearNext = false;
if (this.Parent != null)
{
this.Parent.TriggerSave();
}
} }
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,004 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 913 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -33,4 +33,4 @@
</setting> </setting>
</ProgramQueuer.Properties.Settings> </ProgramQueuer.Properties.Settings>
</userSettings> </userSettings>
</configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>

BIN
ProgramQueuer/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB