Skip to content

Commit

Permalink
进度条回归,设置-1为无限进度条,否则为普通进度条
Browse files Browse the repository at this point in the history
  • Loading branch information
zsh2401 committed May 30, 2019
1 parent d4127cf commit db163f2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public abstract class DeviceOwnerSetter : LeafExtensionBase
/// 入口函数
/// </summary>
[LMain]
public void EntryPoint()
public void EntryPoint(ITemporaryFloder tmp,IEmbeddedFileManager emb)
{
using (UI)
{
Expand Down Expand Up @@ -135,7 +135,7 @@ public void EntryPoint()
executor.To(e => UI.WriteOutput(e.Text));

//构造一个dpmpro的控制器
var dpmpro = new DpmPro(executor, CoreLib.Current, Device);
var dpmpro = new DpmPro(executor,emb,tmp, Device);

//将dpmpro提取到临时目录
SetProgress("Extract", 0);
Expand Down
2 changes: 1 addition & 1 deletion AutumnBox.GUI/View/Windows/LeafWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<DockPanel>
<StackPanel DockPanel.Dock="Top" Margin="5" VerticalAlignment="Top">
<controls:LoadingLine Visibility="{Binding LoadingLineVisibility}"/>
<!--<ProgressBar BorderBrush="Transparent" Background="Transparent" Value="{Binding Progress}" Style="{DynamicResource ProgressBarPlayer}"/>-->
<ProgressBar Visibility="{Binding ProgressBarVisibility}" BorderBrush="Transparent" Background="Transparent" Value="{Binding Progress}"/>
<TextBlock Margin="10" Text="{Binding Tip}" FontSize="25" />
</StackPanel>
<DockPanel Margin="3,0,3,3" DockPanel.Dock="Bottom">
Expand Down
32 changes: 19 additions & 13 deletions AutumnBox.GUI/ViewModel/VMLeafUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public Visibility LoadingLineVisibility
}
private Visibility lv;

public Visibility ProgressBarVisibility
{
get => _pbv; set
{
_pbv = value;
RaisePropertyChanged();
}
}
private Visibility _pbv = Visibility.Hidden;

private State CurrentState { get; set; } = State.Initing;

public FlexiableCommand Copy
Expand All @@ -51,15 +61,6 @@ public FlexiableCommand Copy
}
private FlexiableCommand _copy;

public bool IsIndeterminate
{
get => _isIndeterminate; set
{
_isIndeterminate = value;
RaisePropertyChanged();
}
}
private bool _isIndeterminate;

public LeafWindow View
{
Expand Down Expand Up @@ -103,16 +104,21 @@ public int Progress
ThrowIfNotRunning();
if (value == -1)
{
IsIndeterminate = true;
_progress = 0;
LoadingLineVisibility = Visibility.Visible;
ProgressBarVisibility = Visibility.Hidden;
RaisePropertyChanged();
return;
}
if (value == 100)
else if(value < 100)
{
LoadingLineVisibility = Visibility.Hidden;
ProgressBarVisibility = Visibility.Visible;
}
if (value == 100)
{
LoadingLineVisibility = Visibility.Collapsed;
}
IsIndeterminate = false;
_progress = value;
RaisePropertyChanged();
}
Expand Down Expand Up @@ -422,7 +428,7 @@ public bool DoYN(string message, string btnYes = null, string btnNo = null)
return (bool)task.Result;
}

public string InputString(string hint = null,string _default=null)
public string InputString(string hint = null, string _default = null)
{
Task<object> task = null;
App.Current.Dispatcher.Invoke(() =>
Expand Down

0 comments on commit db163f2

Please sign in to comment.