1
|
using System;
|
2
|
using System.Collections.Generic;
|
3
|
using System.Linq;
|
4
|
using System.Text;
|
5
|
using System.Windows;
|
6
|
using System.Windows.Controls;
|
7
|
using System.Windows.Data;
|
8
|
using System.Windows.Documents;
|
9
|
using System.Windows.Input;
|
10
|
using System.Windows.Media;
|
11
|
using System.Windows.Media.Imaging;
|
12
|
using System.Windows.Navigation;
|
13
|
using System.Windows.Shapes;
|
14
|
using System.Data.Entity;
|
15
|
using Telerik.Windows.Controls;
|
16
|
using System.Net;
|
17
|
using KCOM.Common;
|
18
|
using KCOMDataModel.DataModel;
|
19
|
using System.Diagnostics;
|
20
|
|
21
|
namespace KCOM.Controls
|
22
|
{
|
23
|
/// <summary>
|
24
|
/// FavoritePanel.xaml에 대한 상호 작용 논리
|
25
|
/// </summary>
|
26
|
public partial class FavoritePanel : UserControl
|
27
|
{
|
28
|
new bool IsLoaded = false;
|
29
|
public FavoritePanel()
|
30
|
{
|
31
|
//InitializeComponent();
|
32
|
App.splashString(ISplashMessage.FAVORITEPANEL);
|
33
|
this.Loaded += FavoritePanel_Loaded;
|
34
|
|
35
|
}
|
36
|
|
37
|
private void FavoritePanel_Loaded(object sender, RoutedEventArgs e)
|
38
|
{
|
39
|
//측정
|
40
|
//Stopwatch sw = new Stopwatch();
|
41
|
//sw.Start();
|
42
|
InitializeComponent();
|
43
|
//System.Diagnostics.Debug.WriteLine("FavoritePanel() : " + sw.ElapsedMilliseconds.ToString() + "ms");
|
44
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPCompleted += BaseClient_GetFavoriteVPCompleted;
|
45
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.EditFavoriteVPCompleted += BaseClient_EditFavoriteVPCompleted;
|
46
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted;
|
47
|
if (!IsLoaded)
|
48
|
{
|
49
|
if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "")
|
50
|
{
|
51
|
Logger.sendReqLog("GetFavoriteVPAsync: ", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1);
|
52
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
|
53
|
//autoSearchSymbol.Visibility = Visibility.Visible;
|
54
|
}
|
55
|
else
|
56
|
{
|
57
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.FavoritePane.Visibility = System.Windows.Visibility.Collapsed;
|
58
|
}
|
59
|
|
60
|
IsLoaded = true;
|
61
|
}
|
62
|
|
63
|
}
|
64
|
|
65
|
private void BaseClient_DeleteMarkupCompleted(object sender, ServiceDeepView.DeleteMarkupCompletedEventArgs e)
|
66
|
{
|
67
|
if (e.Error == null && e.Result == false)
|
68
|
{
|
69
|
Logger.sendReqLog("GetFavoriteVPAsync: ", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1);
|
70
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
|
71
|
}
|
72
|
else
|
73
|
{
|
74
|
|
75
|
}
|
76
|
Logger.sendResLog("DeleteMarkupCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
|
77
|
}
|
78
|
private void BaseClient_EditFavoriteVPCompleted(object sender, ServiceDeepView.EditFavoriteVPCompletedEventArgs e)
|
79
|
{
|
80
|
if (e.Error == null && e.Result != false)
|
81
|
{
|
82
|
Logger.sendReqLog("GetFavoriteVPAsync: ", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1);
|
83
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
|
84
|
}
|
85
|
Logger.sendResLog("EditFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
|
86
|
}
|
87
|
|
88
|
private void BaseClient_GetFavoriteVPCompleted(object sender, ServiceDeepView.GetFavoriteVPCompletedEventArgs e)
|
89
|
{
|
90
|
if (e.Error == null && e.Result != null)
|
91
|
{
|
92
|
ViewerDataModel.Instance.FavoriteSelctedSet = e.Result;
|
93
|
ViewerDataModel.Instance.FavoriteSet = ViewerDataModel.Instance.FavoriteSelctedSet;
|
94
|
|
95
|
|
96
|
|
97
|
if (cbState.SelectedIndex != 0 && cbState.SelectedIndex > 0)
|
98
|
{
|
99
|
ViewerDataModel.Instance.FavoriteSet = ViewerDataModel.Instance.FavoriteSelctedSet.Where(data => data.FLAG == cbState.SelectedIndex - 1).ToList();
|
100
|
}
|
101
|
|
102
|
lstFavoriteInternal.ItemsSource = ViewerDataModel.Instance.FavoriteSet;
|
103
|
|
104
|
var InVp = ViewerDataModel.Instance.FavoriteSet.Where(data => data.PROJECT_NO == App.ViewInfo.ProjectNO && data.DOCUMENT_ID == App.ViewInfo.DocumentItemID).ToList();
|
105
|
if (InVp.Count() > 0)
|
106
|
{
|
107
|
|
108
|
ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator._FavoriteSet = InVp;
|
109
|
}
|
110
|
}
|
111
|
Logger.sendResLog("GetFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
|
112
|
}
|
113
|
|
114
|
private void cbState_Loaded(object sender, RoutedEventArgs e)
|
115
|
{
|
116
|
cbState.Items.Clear();
|
117
|
Type typeFavorite = typeof(IKCOM.FAVORITE_FLAG);
|
118
|
System.Reflection.FieldInfo[] arrFavoriteValues = typeFavorite.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
|
119
|
|
120
|
//cbState.Items.Add("All");
|
121
|
foreach (var item in arrFavoriteValues)
|
122
|
{
|
123
|
cbState.Items.Add(item.GetValue(null).ToString());
|
124
|
}
|
125
|
cbState.SelectedIndex = 0;
|
126
|
}
|
127
|
|
128
|
private void cbState_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
129
|
{
|
130
|
if (cbState.SelectedItem != null)
|
131
|
{
|
132
|
|
133
|
if (cbState.SelectedItem.ToString() == IKCOM.FAVORITE_FLAG.ALL.ToString())
|
134
|
{
|
135
|
Common.ViewerDataModel.Instance.FavoriteSet = Common.ViewerDataModel.Instance.FavoriteSelctedSet;
|
136
|
|
137
|
}
|
138
|
else
|
139
|
{
|
140
|
//Common.ViewerDataModel.Instance.FavoriteSet = Common.ViewerDataModel.Instance.FavoriteSelctedSet.Where(data => data.FLAG == cbState.SelectedIndex - 1).ToList();
|
141
|
Common.ViewerDataModel.Instance.FavoriteSet = Common.ViewerDataModel.Instance.FavoriteSelctedSet.Where(data => data.FLAG == cbState.SelectedIndex).ToList();
|
142
|
}
|
143
|
lstFavoriteInternal.ItemsSource = ViewerDataModel.Instance.FavoriteSet;
|
144
|
}
|
145
|
}
|
146
|
|
147
|
private void lstFavoriteInternal_ItemDoubleClickEvent(object sender, MouseButtonEventArgs e)
|
148
|
{
|
149
|
if (e.ClickCount == 2)
|
150
|
{
|
151
|
FAVORITE_DOC instanceFavoVP = lstFavoriteInternal.SelectedItem as FAVORITE_DOC;
|
152
|
|
153
|
//if (instanceFavoVP.PROJECT_NO == App.ViewInfo.ProjectNO && instanceFavoVP.DOCUMENT_ID == App.ViewInfo.DocumentItemID)
|
154
|
//{
|
155
|
if (instanceFavoVP.PAGE_NO == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber)
|
156
|
{
|
157
|
Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("You have selected the current page", "Notice");
|
158
|
}
|
159
|
else
|
160
|
{
|
161
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(instanceFavoVP.PAGE_NO);
|
162
|
}
|
163
|
//}
|
164
|
|
165
|
//else
|
166
|
//{
|
167
|
// System.Diagnostics.Process.Start("kcom://eyJEb2N1bWVudEl0ZW1JRCI6IjMwMDAwMTc3IiwiYlBhcnRuZXIiOmZhbHNlLCJDcmVhdGVGaW5hbFBERlBlcm1pc3Npb24iOnRydWUsIk5ld0NvbW1lbnRQZXJtaXNzaW9uIjp0cnVlLCJQcm9qZWN0Tk8iOiIwMDAwMDAiLCJVc2VySUQiOiJhZG1pbiIsIk1vZGUiOjB9");
|
168
|
// //var chagePath = System.Windows.Browser.HtmlPage.Document.DocumentUri.AbsoluteUri.ToString();
|
169
|
// //var parameterCheck = chagePath.Split('&');
|
170
|
|
171
|
// //var export_ProjectNo = parameterCheck.Where(data => data.Contains("ProjectNo")).FirstOrDefault();
|
172
|
// //var export_UserID = parameterCheck.Where(data => data.Contains("UserID")).FirstOrDefault();
|
173
|
// //var export_SharepointItemID = parameterCheck.Where(data => data.Contains("SharepointItemID")).FirstOrDefault();
|
174
|
// //var export_bNewCommentPermission = parameterCheck.Where(data => data.Contains("bNewCommentPermission")).FirstOrDefault();
|
175
|
// //var export_bCreatFinalPDFPermission = parameterCheck.Where(data => data.Contains("bCreatFinalPDFPermission")).FirstOrDefault();
|
176
|
|
177
|
// //chagePath = chagePath.Replace(export_ProjectNo, "ProjectNo=" + instanceFavoVP.ProjectNo);
|
178
|
// //chagePath = chagePath.Replace(export_UserID, "UserID=" + instanceFavoVP.CreateUserID);
|
179
|
// //chagePath = chagePath.Replace(export_SharepointItemID, "SharepointItemID=" + instanceFavoVP.SharepointItemID + "_" + instanceFavoVP.PageNo);
|
180
|
// //chagePath = chagePath.Replace(export_bNewCommentPermission, "bNewCommentPermission=false");
|
181
|
// //chagePath = chagePath.Replace(export_bCreatFinalPDFPermission, "bCreatFinalPDFPermission=false");
|
182
|
|
183
|
// //System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(chagePath), "_blank");
|
184
|
//}
|
185
|
}
|
186
|
}
|
187
|
|
188
|
public void FavoriteInternel_Edit(object sen, RoutedEventArgs e)
|
189
|
{
|
190
|
if (lstFavoriteInternal.SelectedItem != null)
|
191
|
{
|
192
|
FAVORITE_DOC favoInstance = lstFavoriteInternal.SelectedItem as FAVORITE_DOC;
|
193
|
if (App.ViewInfo.UserID.ToLower() == favoInstance.MEMBER_USER_ID.ToLower())
|
194
|
{
|
195
|
addToFavoriteWindow_Internal addFavorite = new addToFavoriteWindow_Internal(favoInstance);
|
196
|
addFavorite.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
197
|
addFavorite.Topmost = true;
|
198
|
addFavorite.Show();
|
199
|
addFavorite.Closed += (s, eargs) =>
|
200
|
{
|
201
|
if (addFavorite.DialogResult == true)
|
202
|
{
|
203
|
Logger.sendReqLog("GetFavoriteVPAsync: ", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1);
|
204
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
|
205
|
}
|
206
|
};
|
207
|
}
|
208
|
else
|
209
|
{
|
210
|
Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("You are not item creator", "Notice");
|
211
|
}
|
212
|
}
|
213
|
//if (lstFavoriteInternal.SelectedItem != null)
|
214
|
//{
|
215
|
// ServiceDeepView.FavoriteVP favoInstance = lstFavoriteInternal.SelectedItem as ServiceDeepView.FavoriteVP;
|
216
|
|
217
|
|
218
|
// if (App.ViewInfo.UserID.ToLower() == favoInstance.CreateUserID)
|
219
|
// {
|
220
|
// editToFavoriteWindow_Internal editFavorite = new editToFavoriteWindow_Internal(BaseClient, favoInstance);
|
221
|
|
222
|
// editFavorite.Show();
|
223
|
// editFavorite.Closed += (s, eargs) =>
|
224
|
// {
|
225
|
// if (editFavorite.DialogResult == true)
|
226
|
// {
|
227
|
// BaseClient_SaveLoad.GetFavoriteVPAsync(_ViewInfo.ProjectNO, _ViewInfo.UserID, _ViewInfo.SharepointItemID);
|
228
|
// }
|
229
|
// };
|
230
|
// }
|
231
|
// else
|
232
|
// {
|
233
|
// this.ParentOfType<MainWindow>().DialogMessage_Alert("You are not item creator", "Warning");
|
234
|
// }
|
235
|
//}
|
236
|
}
|
237
|
|
238
|
|
239
|
|
240
|
public void FavoriteInternel_Del(object sen, RoutedEventArgs e)
|
241
|
{
|
242
|
if (lstFavoriteInternal.SelectedItem != null)
|
243
|
{
|
244
|
FAVORITE_DOC favoInstance = lstFavoriteInternal.SelectedItem as FAVORITE_DOC;
|
245
|
//BaseClient_SaveLoad.DelFavoriteVPAsync(_ViewInfo.ProjectNO, _ViewInfo.UserID, pageNavigator.CurrentPage.PageNumber,
|
246
|
// _VendorItem.sharepoint_itemid,
|
247
|
|
248
|
|
249
|
if (favoInstance.MEMBER_USER_ID == App.ViewInfo.UserID)
|
250
|
{
|
251
|
Logger.sendReqLog("DelFavoriteVPAsync: ", favoInstance.PROJECT_NO + "," + favoInstance.MEMBER_USER_ID + "," + favoInstance.PAGE_NO, 1);
|
252
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DelFavoriteVPAsync(favoInstance.PROJECT_NO, favoInstance.MEMBER_USER_ID, favoInstance.PAGE_NO,
|
253
|
favoInstance.ID);
|
254
|
}
|
255
|
else
|
256
|
{
|
257
|
Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("You are not item creator", "Notice");
|
258
|
}
|
259
|
|
260
|
|
261
|
|
262
|
|
263
|
//BaseClient_SaveLoad(_ViewInfo.ProjectNO, _ViewInfo.UserID);
|
264
|
}
|
265
|
}
|
266
|
|
267
|
public void FavoriteInternel_Save(object sen, RoutedEventArgs e)
|
268
|
{
|
269
|
|
270
|
addToFavoriteWindow_Internal addFavorite = new addToFavoriteWindow_Internal(null, cbState.SelectedIndex);
|
271
|
addFavorite.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
272
|
addFavorite.Topmost = true;
|
273
|
addFavorite.Show();
|
274
|
addFavorite.Closed += (s, eargs) =>
|
275
|
{
|
276
|
if (addFavorite.DialogResult == true)
|
277
|
{
|
278
|
Logger.sendReqLog("GetFavoriteVPAsync: ", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1);
|
279
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
|
280
|
}
|
281
|
};
|
282
|
}
|
283
|
}
|
284
|
}
|