프로젝트

일반

사용자정보

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

markus / KCOM / Controls / FavoritePanel.xaml.cs @ 2a824927

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