Skip to content

Commit

Permalink
the final commit for hawk5
Browse files Browse the repository at this point in the history
  • Loading branch information
ferventdesert committed Jan 12, 2019
1 parent 03fbdd0 commit af66ada
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Hawk.Core/Utils/MVVM/PropertyChangeNotifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public virtual void OnPropertyChanged(string propName)
//this.VerifyPropertyName(propName);
if (null != PropertyChanged)
{
PropertyChanged(this, new PropertyChangedEventArgs(propName));
ControlExtended.UIInvoke(() => PropertyChanged(this, new PropertyChangedEventArgs(propName)));

}
}

Expand Down
67 changes: 67 additions & 0 deletions Hawk.ETL.Controls/Controls/ETLTempTaskWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using Hawk.Core.Utils;
using Hawk.Core.Utils.MVVM;
using Hawk.Core.Utils.Plugins;

namespace Hawk.ETL.Controls.Controls
{
[XFrmWork("etl_temp_window")]
public class ETLTempTaskWindow : PopupWindowBase, ICustomView
{
static ETLTempTaskWindow()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ETLTempTaskWindow), new FrameworkPropertyMetadata(typeof(ETLTempTaskWindow)));

}

public ETLTempTaskWindow()
{
var item = Application.Current.Resources["ETLTempTaskWindow"];
this.DataContext = this;
this.Style = item as Style;
Refresh = false;
}

public bool Refresh { get; set; }
public FrmState FrmState { get; }

public override ReadOnlyCollection<ICommand> Commands
{
get
{
return CommandBuilder.GetCommands(
this,
new[]
{

new Command(GlobalHelper.Get( "key_172"), obj=>ButtonClick1(),obj=>AllowOK) { Icon = "check" },
new Command(GlobalHelper.Get("key_142"),obj=>ButtonClick2(),obj=>AllowCancel) { Icon = "redo" },
new Command(GlobalHelper.Get("key_293"),obj=>ButtonClick3(),obj=>true) { Icon = "cancel" },
});
}
}
protected override void ButtonClick3()
{
this.DialogResult = false;
this.Close();

}
protected override void ButtonClick2()
{
this.token.Cancel();
Refresh = true;
this.Close();

}


}
}
8 changes: 4 additions & 4 deletions Hawk.ETL.Controls/Controls/PopupWindowBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public int Progress
DependencyProperty.Register("Progress", typeof(int), typeof(PopupWindowBase), new PropertyMetadata(0));
[Category("SetProperty")]
public int MaxProgress { get; set; }
public void ShowDialogAdvance()
public virtual void ShowDialogAdvance()
{

this.Progress = 0;
Expand Down Expand Up @@ -183,15 +183,15 @@ protected virtual void ButtonClick3()

}

private readonly CancellationTokenSource token = new CancellationTokenSource();
private void ButtonClick1()
protected readonly CancellationTokenSource token = new CancellationTokenSource();
protected virtual void ButtonClick1()
{
this.token.Cancel();
this.DialogResult = true;
this.Close();
}

protected void ButtonClick2()
protected virtual void ButtonClick2()
{
this.token.Cancel();
this.DialogResult = false;
Expand Down
1 change: 1 addition & 0 deletions Hawk.ETL.Controls/Hawk.ETL.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\AutoSaveWindow.cs" />
<Compile Include="Controls\ETLTempTaskWindow.cs" />
<Compile Include="Controls\PopupWindowBase.cs" />
<Compile Include="DataViewers\FlowDocumentViewer.cs" />
<Compile Include="Themes\MetroConverter.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Hawk.ETL.Controls/SmartETLUI.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
</DataTemplate.Triggers>
</DataTemplate>
<DataTemplate x:Key="DataTemplateIcon">
<StackPanel Height="70" Margin="4" Width="60" ToolTip="{Binding Descrption}">
<StackPanel Height="70" Margin="4" Width="60" ToolTip="{Binding Description}">
<Rectangle Width="30" ToolTip="{Binding Description}" Height="30" HorizontalAlignment="Center"
VerticalAlignment="Center">
<Rectangle.Fill>
Expand Down
41 changes: 41 additions & 0 deletions Hawk.ETL.Controls/Themes/Theme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,47 @@
<Setter Property="DisplayTime" Value="0:0:5"/>
<Setter Property="Progress" Value="100"/>
</Style>
<Style x:Key="ETLTempTaskWindow" TargetType="{x:Type Controls3:ETLTempTaskWindow}" >

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls3:ETLTempTaskWindow}">
<Grid d:DesignWidth="510.4" d:DesignHeight="327.347" Background="{DynamicResource NormalBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.202*"/>
<RowDefinition Height="0.598*"/>

<RowDefinition Height="0.2*"/>

</Grid.RowDefinitions>
<Border BorderThickness="5" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" CornerRadius="20" Background="{DynamicResource NormalBrush}" d:LayoutOverrides="GridBox">
<Border.Effect>
<DropShadowEffect/>
</Border.Effect>
</Border>
<TextBlock TextWrapping="Wrap" Text="{DynamicResource long_etl_task}" Margin="10,0,0,0" Foreground="White" FontWeight="Bold" Grid.ColumnSpan="2" Grid.Row="1"/>
<ProgressBar VerticalAlignment="Bottom" Value="{Binding BindingSource.Percent}" Grid.Row="1" Margin="6,0" Maximum="100" Grid.ColumnSpan="3" Height="10"/>
<Button Style="{DynamicResource middleButton}" DataContext="{Binding Commands[0]}" Width="Auto"
Height="35" HorizontalAlignment="Center" Grid.Row="2" />
<Button Style="{DynamicResource middleButton}" DataContext="{Binding Commands[1]}" Width="35"
Height="35" HorizontalAlignment="Center" Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" />
<Button Style="{DynamicResource middleButton}" DataContext="{Binding Commands[2]}" Width="35"
Height="35" HorizontalAlignment="Center" Grid.Column="2" Grid.Row="2" VerticalAlignment="Center" />
<TextBlock TextWrapping="Wrap" Text="{DynamicResource etl_temp_window}" Margin="10,0,0,0" Foreground="White" FontWeight="Bold" Grid.ColumnSpan="2" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" FontSize="29.333"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Width" Value="500"/>
<Setter Property="Height" Value="200"/>
<Setter Property="Progress" Value="100"/>
</Style>




Expand Down
5 changes: 5 additions & 0 deletions Hawk.ETL/Managements/TemporaryTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ public void DictDeserialize(IDictionary<string, object> docu, Scenario scenario
tempTask.CheckWait();
foreach (var r in source)
{
if (tempTask.CheckCancel())
{
tempTask.WasCanceled = true;
break;
}
foreach (var item in func != null ? func(r) : new List<T> { r })
{
tempTask.CheckWait();
Expand Down
29 changes: 28 additions & 1 deletion Hawk.ETL/Process/SmartETLTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,6 @@ public void RefreshSamples(bool canGetDatas = true)
return;
SmartGroupCollection.Clear();
Documents.Clear();
shouldUpdate = false;

shouldUpdate = true;
if (!MainDescription.IsUIForm)
Expand Down Expand Up @@ -1191,7 +1190,35 @@ public void RefreshSamples(bool canGetDatas = true)
, SampleMount);
temptask.Publisher = this;
AttachTask(temptask);

dynamic tempwindow = PluginProvider.GetObjectInstance<ICustomView>(GlobalHelper.Get("etl_temp_window"));
SysProcessManager.CurrentProcessTasks.Add(temptask);
temptask.PropertyChanged += (s, e) =>
{
if (temptask.IsCanceled == true || temptask.IsPause)
{
tempwindow.Close();
}
};

tempwindow.DataContext = tempwindow;
tempwindow.BindingSource = temptask;

tempwindow.ShowDialog();

if (tempwindow.DialogResult == false)
{

temptask.Remove();
if (tempwindow.Refresh)
{
RefreshSamples(true);
}
}



}

private void AttachTask(TemporaryTask<IFreeDocument> temptask)
Expand Down
Binary file modified Includes/System.Windows.Controls.WpfPropertyGrid.dll
Binary file not shown.

0 comments on commit af66ada

Please sign in to comment.