99using System . Net ;
1010using System . Net . Http ;
1111using System . Net . Http . Headers ;
12+ using System . Runtime . InteropServices ;
1213using System . Threading . Tasks ;
1314using System . Windows . Forms ;
1415
1516namespace ThemePacker
1617{
1718 public partial class ThemePacker : Form
1819 {
20+
21+ [ DllImport ( "user32.dll" , CharSet = CharSet . Unicode ) ]
22+ static extern uint SendMessage ( IntPtr hWnd , uint Msg , uint wParam , uint lParam ) ;
23+
1924 private List < string > _likeds ;
2025 private Dictionary < string , Image > _pictures ;
2126 private string _path ;
2227 private int _currentPic ;
2328 private bool _isFolderBased ;
2429
30+ private CustomProgressBar pbProgression ;
31+
2532 private EventHandler _btnNextClick ;
2633
2734 private ImageList _imageList ;
2835
2936 public ThemePacker ( )
3037 {
3138 InitializeComponent ( ) ;
39+ pbProgression = new CustomProgressBar ( ) ; pbProgression . Location = new Point ( 69 , 496 ) ;
40+ pbProgression . MarqueeAnimationSpeed = 0 ;
41+ pbProgression . Name = "pbProgression" ;
42+ pbProgression . Size = new Size ( 400 , 28 ) ;
43+ pbProgression . Style = ProgressBarStyle . Continuous ;
44+ pbProgression . TabIndex = 16 ;
45+ pbProgression . DisplayStyle = ProgressBarDisplayText . CustomText ;
46+ Controls . Add ( pbProgression ) ;
3247 }
3348
3449 private void ThemePacker_Load ( object sender , EventArgs e )
@@ -152,7 +167,9 @@ private void BtnPrevious_Click(object sender, EventArgs e)
152167 private void UpdatePic ( )
153168 {
154169 pbWallpaper . Image = _pictures . ElementAt ( _currentPic ) . Value ;
155- pbProgression . Value = ( int ) Math . Ceiling ( ( _currentPic * 100 ) / ( decimal ) ( _pictures . Count ) ) ;
170+ pbProgression . Value = ( int ) Math . Ceiling ( ( ( _currentPic + 1 ) * 100 ) / ( decimal ) ( _pictures . Count ) ) ;
171+ pbProgression . CustomText = $ "{ _currentPic + 1 } / { _pictures . Count } ";
172+ pbProgression . Refresh ( ) ;
156173 }
157174
158175 private void BtnNext_Click ( object sender , EventArgs e )
@@ -252,7 +269,7 @@ private void CreateDirectory(string path)
252269
253270 private void PicturesLsv_Click ( object sender , EventArgs e )
254271 {
255- if ( picturesLsv . SelectedItems . Count > 0 )
272+ if ( picturesLsv . SelectedItems . Count > 0 )
256273 {
257274 pbWallpaper . Image = _pictures [ picturesLsv . SelectedItems [ 0 ] . ImageKey ] ;
258275 }
@@ -330,17 +347,12 @@ private async Task GetImageFromInspirobot()
330347 private void ThemePacker_FormClosed ( object sender , FormClosedEventArgs e )
331348 {
332349 ClearPictures ( ) ;
333- if ( Directory . Exists ( "temp" ) )
350+ if ( Directory . Exists ( "temp" ) )
334351 {
335352 Directory . Delete ( "temp" , true ) ;
336353 }
337354 }
338355
339- ~ ThemePacker ( )
340- {
341- ClearPictures ( ) ;
342- }
343-
344356 private void ImportThemepackToolStripMenuItem_Click ( object sender , EventArgs e )
345357 {
346358
@@ -350,5 +362,10 @@ private void AsImageFolderToolStripMenuItem_Click(object sender, EventArgs e)
350362 {
351363
352364 }
365+
366+ ~ ThemePacker ( )
367+ {
368+ ClearPictures ( ) ;
369+ }
353370 }
354371}
0 commit comments