update
This commit is contained in:
parent
b23536aa4e
commit
8220e07fe6
35
Video.xaml
35
Video.xaml
@ -7,16 +7,31 @@
|
|||||||
xmlns:local="clr-namespace:VideoConcat"
|
xmlns:local="clr-namespace:VideoConcat"
|
||||||
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
|
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="视频" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" >
|
Title="视频" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Width="710" Height="400">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Margin="10" >
|
<Viewbox Margin="5">
|
||||||
<StackPanel Height="30" Margin="2" Orientation="Horizontal" HorizontalAlignment="Left" >
|
<Grid>
|
||||||
<Label Content="生成视频的个数:" VerticalContentAlignment="Center" Width="auto" BorderBrush="#0000EE" BorderThickness="1"></Label>
|
|
||||||
<TextBox Width="580" AutomationProperties.HelpText="输入要生成的视频个数" Margin="10,0,10,0" InputScope="Number"></TextBox>
|
|
||||||
<Button Content="开始拼接" Click="Button_Click" x:Name="startButton" Width="auto"/>
|
<Grid.ColumnDefinitions>
|
||||||
</StackPanel>
|
<ColumnDefinition Width="120"></ColumnDefinition>
|
||||||
<TextBox Margin="2" TextWrapping="Wrap" Text="" Height="auto" x:Name="outputTxt"/>
|
<ColumnDefinition Width="500"></ColumnDefinition>
|
||||||
</StackPanel>
|
<ColumnDefinition Width="80"></ColumnDefinition>
|
||||||
<ProgressBar x:Name="processVideoBar" Minimum="0" Maximum="100" Value="0" VerticalAlignment="Bottom" Height="10" Margin="5"/>
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"></RowDefinition>
|
||||||
|
<RowDefinition Height="300"></RowDefinition>
|
||||||
|
<RowDefinition Height="10"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Label Content="生成视频的个数:" VerticalContentAlignment="Center" BorderThickness="1" Padding="5,0,5,0"></Label>
|
||||||
|
<TextBox Grid.Column="1" wd:TextBoxHelper.AllowOnlyNumericInput="True" wd:TextBoxHelper.MinValue="1" ></TextBox>
|
||||||
|
<Button Grid.Column="2" Content="开始拼接" Click="Button_Click" x:Name="startButton" />
|
||||||
|
<ScrollViewer Grid.Row="1" Grid.ColumnSpan="3" VerticalScrollBarVisibility="Auto" x:Name="scrowText" Margin="0,10,0,0">
|
||||||
|
<TextBlock Text="" x:Name="outputTxt" OverridesDefaultStyle="True" TextWrapping="Wrap"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
<ProgressBar Grid.Row="2" Grid.ColumnSpan="3" x:Name="processVideoBar" Minimum="0" Maximum="100" Value="0" Margin="0,0,0,0" />
|
||||||
|
</Grid>
|
||||||
|
</Viewbox>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@ -27,7 +27,34 @@ namespace VideoConcat
|
|||||||
private async void Button_Click(object sender, RoutedEventArgs e)
|
private async void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
startButton.IsEnabled = false;
|
startButton.IsEnabled = false;
|
||||||
await Task.Run(() => ProcessVideo.RunTask(processVideoBar, startButton));
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
string text = "";
|
||||||
|
for (int i = 0; i <= 100; i++)
|
||||||
|
{
|
||||||
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
processVideoBar.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
processVideoBar.Value = i;
|
||||||
|
|
||||||
|
});
|
||||||
|
outputTxt.Dispatcher.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
text += "正在生成第" + i + "个视频\r\n";
|
||||||
|
outputTxt.Text = text;
|
||||||
|
scrowText.ScrollToEnd();
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
System.Threading.Thread.Sleep(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
startButton.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
startButton.IsEnabled = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
});//ProcessVideo.RunTask(processVideoBar, startButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user