parent
42a99e775b
commit
159a9a4da2
@ -0,0 +1,15 @@ |
|||||||
|
<Window x:Class="smx_config.ProgressWindow" |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||||
|
mc:Ignorable="d" |
||||||
|
Icon="Resources/window icon.png" |
||||||
|
Background="#DDD" |
||||||
|
Height="100" Width="325" ResizeMode="NoResize"> |
||||||
|
<ProgressBar Name="ProgressBar" |
||||||
|
Width="300" Height="50" |
||||||
|
Value="0" |
||||||
|
Maximum="100" |
||||||
|
/> |
||||||
|
</Window> |
@ -0,0 +1,45 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Interop; |
||||||
|
|
||||||
|
namespace smx_config |
||||||
|
{ |
||||||
|
public partial class ProgressWindow: Window |
||||||
|
{ |
||||||
|
private const int GWL_STYLE = -16; |
||||||
|
private const int WS_SYSMENU = 0x80000; |
||||||
|
[DllImport("user32.dll", SetLastError = true)] |
||||||
|
private static extern int GetWindowLong(IntPtr hWnd, int nIndex); |
||||||
|
[DllImport("user32.dll")] |
||||||
|
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); |
||||||
|
|
||||||
|
public ProgressWindow() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
|
||||||
|
// Hide the window close button, since we can't easily cancel. |
||||||
|
Loaded += delegate(object sender, RoutedEventArgs e) { |
||||||
|
var hwnd = new WindowInteropHelper(this).Handle; |
||||||
|
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU); |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
public void SetTotal(int total) |
||||||
|
{ |
||||||
|
ProgressBar.Maximum = total; |
||||||
|
} |
||||||
|
|
||||||
|
public void SetProgress(int progress) |
||||||
|
{ |
||||||
|
ProgressBar.Value = progress; |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
base.OnApplyTemplate(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue