프로젝트

일반

사용자정보

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

markus / KCOM / Controls / FavoritePanel.xaml.cs @ 751494ca

이력 | 보기 | 이력해설 | 다운로드 (12.5 KB)

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
            this.Loaded += FavoritePanel_Loaded;
33

    
34
        }
35

    
36
        private void FavoritePanel_Loaded(object sender, RoutedEventArgs e)
37
        {        
38
            //측정
39
            //Stopwatch sw = new Stopwatch();
40
            //sw.Start();
41
                InitializeComponent();
42
            //System.Diagnostics.Debug.WriteLine("FavoritePanel() : " + sw.ElapsedMilliseconds.ToString() + "ms");
43
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPCompleted += BaseClient_GetFavoriteVPCompleted;
44
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.EditFavoriteVPCompleted += BaseClient_EditFavoriteVPCompleted;
45
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted;
46

    
47
            if (!IsLoaded)
48
            {
49
                if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "")
50
                {
51
                    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
            
62
        }
63

    
64
        private void BaseClient_DeleteMarkupCompleted(object sender, ServiceDeepView.DeleteMarkupCompletedEventArgs e)
65
        {
66
            if (e.Error == null && e.Result != null)
67
            {
68
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
69
            }
70
            else
71
            {
72

    
73
            }
74
        }
75
        private void BaseClient_EditFavoriteVPCompleted(object sender, ServiceDeepView.EditFavoriteVPCompletedEventArgs e)
76
        {
77
            if (e.Error == null && e.Result != null)
78
            {
79
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
80
            }
81
        }
82

    
83
        private void BaseClient_GetFavoriteVPCompleted(object sender, ServiceDeepView.GetFavoriteVPCompletedEventArgs e)
84
        {
85
            if (e.Error == null && e.Result != null)
86
            {
87
                ViewerDataModel.Instance.FavoriteSelctedSet = e.Result;
88
                ViewerDataModel.Instance.FavoriteSet = ViewerDataModel.Instance.FavoriteSelctedSet;
89

    
90

    
91

    
92
                if (cbState.SelectedIndex != 0 && cbState.SelectedIndex > 0)
93
                {
94
                    ViewerDataModel.Instance.FavoriteSet = ViewerDataModel.Instance.FavoriteSelctedSet.Where(data => data.FLAG == cbState.SelectedIndex - 1).ToList();
95
                }
96

    
97
                lstFavoriteInternal.ItemsSource = ViewerDataModel.Instance.FavoriteSet;
98

    
99
                var InVp = ViewerDataModel.Instance.FavoriteSet.Where(data => data.PROJECT_NO == App.ViewInfo.ProjectNO && data.DOCUMENT_ID == App.ViewInfo.DocumentItemID).ToList();
100
                if (InVp.Count() > 0)
101
                {
102

    
103
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator._FavoriteSet = InVp;
104
                }
105
            }
106
        }
107

    
108
        private void cbState_Loaded(object sender, RoutedEventArgs e)
109
        {
110
            cbState.Items.Clear();
111
            Type typeFavorite = typeof(IKCOM.FAVORITE_FLAG);
112
            System.Reflection.FieldInfo[] arrFavoriteValues = typeFavorite.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
113

    
114
            //cbState.Items.Add("All");
115
            foreach (var item in arrFavoriteValues)
116
            {
117
                cbState.Items.Add(item.GetValue(null).ToString());
118
            }
119
            cbState.SelectedIndex = 0;
120
        }
121

    
122
        private void cbState_SelectionChanged(object sender, SelectionChangedEventArgs e)
123
        {
124
            if (cbState.SelectedItem != null)
125
            {
126

    
127
                if (cbState.SelectedItem.ToString() == IKCOM.FAVORITE_FLAG.ALL.ToString())
128
                {
129
                    Common.ViewerDataModel.Instance.FavoriteSet = Common.ViewerDataModel.Instance.FavoriteSelctedSet;
130

    
131
                }
132
                else
133
                {
134
                    //Common.ViewerDataModel.Instance.FavoriteSet = Common.ViewerDataModel.Instance.FavoriteSelctedSet.Where(data => data.FLAG == cbState.SelectedIndex - 1).ToList();
135
                    Common.ViewerDataModel.Instance.FavoriteSet = Common.ViewerDataModel.Instance.FavoriteSelctedSet.Where(data => data.FLAG == cbState.SelectedIndex).ToList();
136
                }
137
                lstFavoriteInternal.ItemsSource = ViewerDataModel.Instance.FavoriteSet;
138
            }
139
        }
140

    
141
        private void lstFavoriteInternal_ItemDoubleClickEvent(object sender, MouseButtonEventArgs e)
142
        {
143
            if (e.ClickCount == 2)
144
            {
145
                FAVORITE_DOC instanceFavoVP = lstFavoriteInternal.SelectedItem as FAVORITE_DOC;
146

    
147
                //if (instanceFavoVP.PROJECT_NO == App.ViewInfo.ProjectNO && instanceFavoVP.DOCUMENT_ID == App.ViewInfo.DocumentItemID)
148
                //{
149
                if (instanceFavoVP.PAGE_NO == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber)
150
                {
151
                    Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("You have selected the current page", "Notice");
152
                }
153
                else
154
                {
155
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(instanceFavoVP.PAGE_NO);
156
                }
157
                //}
158

    
159
                //else
160
                //{
161
                //    System.Diagnostics.Process.Start("kcom://eyJEb2N1bWVudEl0ZW1JRCI6IjMwMDAwMTc3IiwiYlBhcnRuZXIiOmZhbHNlLCJDcmVhdGVGaW5hbFBERlBlcm1pc3Npb24iOnRydWUsIk5ld0NvbW1lbnRQZXJtaXNzaW9uIjp0cnVlLCJQcm9qZWN0Tk8iOiIwMDAwMDAiLCJVc2VySUQiOiJhZG1pbiIsIk1vZGUiOjB9");
162
                //    //var chagePath = System.Windows.Browser.HtmlPage.Document.DocumentUri.AbsoluteUri.ToString();
163
                //    //var parameterCheck = chagePath.Split('&');
164

    
165
                //    //var export_ProjectNo = parameterCheck.Where(data => data.Contains("ProjectNo")).FirstOrDefault();
166
                //    //var export_UserID = parameterCheck.Where(data => data.Contains("UserID")).FirstOrDefault();
167
                //    //var export_SharepointItemID = parameterCheck.Where(data => data.Contains("SharepointItemID")).FirstOrDefault();
168
                //    //var export_bNewCommentPermission = parameterCheck.Where(data => data.Contains("bNewCommentPermission")).FirstOrDefault();
169
                //    //var export_bCreatFinalPDFPermission = parameterCheck.Where(data => data.Contains("bCreatFinalPDFPermission")).FirstOrDefault();
170

    
171
                //    //chagePath = chagePath.Replace(export_ProjectNo, "ProjectNo=" + instanceFavoVP.ProjectNo);
172
                //    //chagePath = chagePath.Replace(export_UserID, "UserID=" + instanceFavoVP.CreateUserID);
173
                //    //chagePath = chagePath.Replace(export_SharepointItemID, "SharepointItemID=" + instanceFavoVP.SharepointItemID + "_" + instanceFavoVP.PageNo);
174
                //    //chagePath = chagePath.Replace(export_bNewCommentPermission, "bNewCommentPermission=false");
175
                //    //chagePath = chagePath.Replace(export_bCreatFinalPDFPermission, "bCreatFinalPDFPermission=false");
176

    
177
                //    //System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(chagePath), "_blank");
178
                //}
179
            }
180
        }
181

    
182
        public void FavoriteInternel_Edit(object sen, RoutedEventArgs e)
183
        {
184
            if (lstFavoriteInternal.SelectedItem != null)
185
            {
186
                FAVORITE_DOC favoInstance = lstFavoriteInternal.SelectedItem as FAVORITE_DOC;
187
                if (App.ViewInfo.UserID.ToLower() == favoInstance.MEMBER_USER_ID.ToLower())
188
                {
189
                    addToFavoriteWindow_Internal addFavorite = new addToFavoriteWindow_Internal(favoInstance);
190
                    addFavorite.WindowStartupLocation = WindowStartupLocation.CenterScreen;
191
                    addFavorite.Topmost = true;
192
                    addFavorite.Show();                    
193
                    addFavorite.Closed += (s, eargs) =>
194
                    {
195
                        if (addFavorite.DialogResult == true)
196
                        {
197
                            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
198
                        }
199
                    };
200
                }
201
                else
202
                {
203
                    Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("You are not item creator", "Notice");
204
                }
205
            }
206
            //if (lstFavoriteInternal.SelectedItem != null)
207
            //{
208
            //    ServiceDeepView.FavoriteVP favoInstance = lstFavoriteInternal.SelectedItem as ServiceDeepView.FavoriteVP;
209

    
210

    
211
            //    if (App.ViewInfo.UserID.ToLower() == favoInstance.CreateUserID)
212
            //    {
213
            //        editToFavoriteWindow_Internal editFavorite = new editToFavoriteWindow_Internal(BaseClient, favoInstance);
214

    
215
            //        editFavorite.Show();
216
            //        editFavorite.Closed += (s, eargs) =>
217
            //        {
218
            //            if (editFavorite.DialogResult == true)
219
            //            {
220
            //                BaseClient_SaveLoad.GetFavoriteVPAsync(_ViewInfo.ProjectNO, _ViewInfo.UserID, _ViewInfo.SharepointItemID);
221
            //            }
222
            //        };
223
            //    }
224
            //    else
225
            //    {
226
            //        this.ParentOfType<MainWindow>().DialogMessage_Alert("You are not item creator", "Warning");
227
            //    }
228
            //}
229
        }
230

    
231

    
232

    
233
        public void FavoriteInternel_Del(object sen, RoutedEventArgs e)
234
        {
235
            if (lstFavoriteInternal.SelectedItem != null)
236
            {
237
                FAVORITE_DOC favoInstance = lstFavoriteInternal.SelectedItem as FAVORITE_DOC;
238
                //BaseClient_SaveLoad.DelFavoriteVPAsync(_ViewInfo.ProjectNO, _ViewInfo.UserID, pageNavigator.CurrentPage.PageNumber,
239
                //    _VendorItem.sharepoint_itemid, 
240

    
241

    
242
                if (favoInstance.MEMBER_USER_ID == App.ViewInfo.UserID)
243
                {
244
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DelFavoriteVPAsync(favoInstance.PROJECT_NO, favoInstance.MEMBER_USER_ID, favoInstance.PAGE_NO,
245
                        favoInstance.ID);
246
                }
247
                else
248
                {
249
                    Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("You are not item creator", "Notice");
250
                }
251

    
252

    
253

    
254

    
255
                //BaseClient_SaveLoad(_ViewInfo.ProjectNO, _ViewInfo.UserID);
256
            }
257
        }
258

    
259
        public void FavoriteInternel_Save(object sen, RoutedEventArgs e)
260
        {
261

    
262
            addToFavoriteWindow_Internal addFavorite = new addToFavoriteWindow_Internal(null, cbState.SelectedIndex);
263
            addFavorite.WindowStartupLocation = WindowStartupLocation.CenterScreen;
264
            addFavorite.Topmost = true;
265
            addFavorite.Show();
266
            addFavorite.Closed += (s, eargs) =>
267
            {
268
                if (addFavorite.DialogResult == true)
269
                {
270
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
271
                }
272
            };
273
        }
274
    }
275
}
클립보드 이미지 추가 (최대 크기: 500 MB)