-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathItemInList.xaml.cs
59 lines (57 loc) · 1.75 KB
/
ItemInList.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace UnlockMusicUI
{
/// <summary>
/// UserControl1.xaml 的交互逻辑
/// </summary>
public partial class ItemInList : UserControl
{
private string Textstr;
public string Description { get; set; }
public bool IsComplete { get; set; }
public ItemInList(string Text)
{
InitializeComponent();
this.Text.Text = Text;
this.Textstr = Text;
this.Img.Source = (DrawingImage)FindResource("Wait");
this.Description = string.Empty;
this.ShowError.IsEnabled = false;
this.IsComplete = false;
}
public void SetState(bool hasError, string description)
{
if (hasError)
{
this.Description = description;
this.ShowError.IsEnabled = true;
this.Img.Source = (DrawingImage)FindResource("Alert");
}
else
{
this.Img.Source = (DrawingImage)FindResource("OK");
this.IsComplete = true;
}
}
private void ShowError_Click(object sender, RoutedEventArgs e)
{
_ = MessageBox.Show("Error from file:\"" + this.Text.Text + "\"\r\n" + Description,
"Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
public string GetText()
{
return this.Textstr;
}
}
}