|
@@ -29,8 +29,10 @@ |
29 |
29 |
|
{ |
30 |
30 |
|
FileOpenPicker filePicker; |
31 |
31 |
|
CoreApplicationView view; |
32 |
|
- |
public ObservableCollection<StorageFile> images; |
33 |
|
- |
public ObservableCollection<object> initialImages; |
|
32 |
+ |
public ObservableCollection<StorageFile> pickedImages; |
|
33 |
+ |
private ObservableCollection<Uri> initialImages; |
|
34 |
+ |
public List<Uri> initialRemovedImaged; |
|
35 |
+ |
|
34 |
36 |
|
ErrorHandler errorHandler; |
35 |
37 |
|
ResourceLoader resourceLoader; |
36 |
38 |
|
|
|
@@ -38,11 +40,11 @@ |
38 |
40 |
|
public MultipleImagePicker() |
39 |
41 |
|
{ |
40 |
42 |
|
this.InitializeComponent(); |
41 |
|
- |
this.images = new ObservableCollection<StorageFile>(); |
42 |
|
- |
this.initialImages = new ObservableCollection<object>(); |
|
43 |
+ |
this.pickedImages = new ObservableCollection<StorageFile>(); |
|
44 |
+ |
this.initialRemovedImaged = new List<Uri>(); |
43 |
45 |
|
errorHandler = new ErrorHandler(); |
44 |
46 |
|
|
45 |
|
- |
this.PreviewList.ItemsSource = images; |
|
47 |
+ |
this.PreviewList.ItemsSource = pickedImages; |
46 |
48 |
|
filePicker = new FileOpenPicker(); |
47 |
49 |
|
filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; |
48 |
50 |
|
filePicker.ViewMode = PickerViewMode.Thumbnail; |
|
@@ -69,7 +71,7 @@ |
69 |
71 |
|
StorageFile storageFile = args.Files[0]; |
70 |
72 |
|
|
71 |
73 |
|
|
72 |
|
- |
images.Add(storageFile); |
|
74 |
+ |
pickedImages.Add(storageFile); |
73 |
75 |
|
} |
74 |
76 |
|
} |
75 |
77 |
|
private void AppBarButton_Tapped(object sender, TappedRoutedEventArgs e) |
|
@@ -77,22 +79,24 @@ |
77 |
79 |
|
Control c = sender as Control; |
78 |
80 |
|
StorageFile dc = c.DataContext as StorageFile; |
79 |
81 |
|
|
80 |
|
- |
images.Remove(dc); |
|
82 |
+ |
pickedImages.Remove(dc); |
81 |
83 |
|
} |
82 |
84 |
|
|
83 |
85 |
|
private void AppBarButton_Tapped2(object sender, TappedRoutedEventArgs e) |
84 |
86 |
|
{ |
85 |
87 |
|
Control c = sender as Control; |
86 |
|
- |
object dc = c.DataContext as object; |
|
88 |
+ |
Uri dc = new Uri(c.DataContext as String); |
87 |
89 |
|
|
88 |
90 |
|
initialImages.Remove(dc); |
|
91 |
+ |
initialRemovedImaged.Add(dc); |
|
92 |
+ |
|
89 |
93 |
|
} |
90 |
94 |
|
|
91 |
95 |
|
private async void AddImagesButton_Tapped(object sender, TappedRoutedEventArgs e) |
92 |
96 |
|
{ |
93 |
97 |
|
this.resourceLoader = ResourceLoader.GetForCurrentView("Resources"); |
94 |
98 |
|
int max = int.Parse(await Config.Instance.getConfigValueByKey("maxSiteImageNumber")); |
95 |
|
- |
if (this.images.Count >= 8) |
|
99 |
+ |
if (this.pickedImages.Count >= 8) |
96 |
100 |
|
{ |
97 |
101 |
|
await errorHandler.ShowError(this.resourceLoader.GetString("MaximumNumberOfPhotosMessage")); |
98 |
102 |
|
} |
|
@@ -112,17 +116,17 @@ |
112 |
116 |
|
|
113 |
117 |
|
private void Image_Flyout_Tapped(object sender, TappedRoutedEventArgs e) |
114 |
118 |
|
{ |
115 |
|
- |
this.ImagePreviewFlyout.Hide(); |
|
119 |
+ |
this.ImagePreviewFlyout2.Hide(); |
|
120 |
+ |
this.ImagePreviewFlyout3.Hide(); |
116 |
121 |
|
} |
117 |
122 |
|
|
118 |
123 |
|
public void setInitialImages(List<Uri> paths) |
119 |
124 |
|
{ |
120 |
|
- |
for (int i = 0; i < paths.Count; i++) |
121 |
|
- |
{ |
122 |
|
- |
initialImages.Add(new { Path = paths[i]}); |
123 |
|
- |
} |
124 |
125 |
|
|
|
126 |
+ |
this.initialImages = new ObservableCollection<Uri>(paths); |
|
127 |
+ |
this.initialRemovedImaged = new List<Uri>(); |
125 |
128 |
|
this.InitialPreviewList.ItemsSource = initialImages; |
|
129 |
+ |
|
126 |
130 |
|
} |
127 |
131 |
|
} |
128 |
132 |
|
} |