프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Controls / FavoritePanel.xaml.cs @ 190248a5

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