-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMadeOperationsList.cs
123 lines (109 loc) · 3.74 KB
/
MadeOperationsList.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Markup;
namespace photoCuter
{
using OperationsOnImageList = List<tools.OperationOnImage>;
public class ListViewItem
{
public string operation{ get; set;}
public string value { get; set; }
}
internal class MadeOperationsList
{
byte quantityOfOperationOnImage = 3;
OperationsOnImageList[] operationsOnImages;
OperationsOnImageList tempOperationsList = new OperationsOnImageList();
public int TempListLength
{
get
{
return tempOperationsList.Count;
}
}
ListView operationsListView;
ListView tempOperationsListView;
ObservableCollection<ListViewItem> Items = new ObservableCollection<ListViewItem>();
ObservableCollection<ListViewItem> tempItems = new ObservableCollection<ListViewItem>();
public OperationsOnImageList this[int photoNumber]
{
get { return operationsOnImages[photoNumber]; }
}
public MadeOperationsList(byte quantityOfOperationOnImage, ListView operationsListView, ListView tempOperationsListView, int photosQuantity)
{
this.quantityOfOperationOnImage = quantityOfOperationOnImage;
this.operationsListView = operationsListView;
this.tempOperationsListView = tempOperationsListView;
tempOperationsListView.ItemsSource = tempItems;
operationsOnImages = new OperationsOnImageList[photosQuantity];
for (int i = 0; i < photosQuantity; i++)
{
operationsOnImages[i] = new OperationsOnImageList();
}
tempOperationsList.Capacity = quantityOfOperationOnImage;
operationsListView.ItemsSource = Items;
}
public void AddTempOpearation(tools.OperationOnImage operation)
{
tempOperationsList.Add(operation);
tempItems.Add(new ListViewItem()
{
operation = operation.OperationType,
value = operation.StrValue
});
}
public void RemoveTempOperations()
{
tempOperationsList.Clear();
tempItems.Clear();
}
public void ClearTempOperations()
{
/*
int itemsOnOperationList = operationsListView.Items.Count;
for (byte i = 1; i <= tempOperationsList.Count; i++)
{
Items.RemoveAt(itemsOnOperationList - i);
}*/
tempItems.Clear();
RemoveTempOperations();
}
public void ClearOperations(int image)
{
Items.Clear();
tempItems.Clear();
tempOperationsList.Clear();
operationsOnImages[image].Clear();
}
public void ClearOperations()
{
for(int i = 0; i < operationsOnImages.Length; i++)
{
ClearOperations(i);
}
}
public void MigrateToMainImageOperation(int imageNumber)
{
if(imageNumber < operationsOnImages.Length)
{
for (int j = 0; j < tempOperationsList.Count; j++)
{
operationsOnImages[imageNumber].Add(tempOperationsList[j]);
Items.Add(tempItems[j]);
}
}
}
public void MigrateToMainImageOperation()
{
for (int i = 0; i < operationsOnImages.Length; i++)
{
MigrateToMainImageOperation(i);
}
}
}
}