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