프로젝트

일반

사용자정보

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

markus / KCOM / MainWindow.xaml.cs @ 6707a5c7

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

1
using KCOM.Common;
2
using KCOMDataModel;
3
using KCOMDataModel.DataModel;
4
using System;
5
using System.Collections.Generic;
6
using System.IO;
7
using System.Linq;
8
using System.Text;
9
using System.Windows;
10
using System.Windows.Controls;
11
using System.Windows.Data;
12
using System.Windows.Documents;
13
using System.Windows.Input;
14
using System.Windows.Media;
15
using System.Windows.Media.Imaging;
16
using System.Windows.Navigation;
17
using System.Windows.Shapes;
18
using System.Xml;
19
using Telerik.Windows.Controls;
20

    
21
namespace KCOM
22
{
23
    /// <summary>
24
    /// MainWindow.xaml에 대한 상호 작용 논리
25
    /// </summary>
26
    public partial class MainWindow : Window
27
    {
28
        
29
        public MainWindow()
30
        {
31
            InitializeComponent();
32
            this.Loaded += MainWindow_Loaded;
33
            this.KeyDown += new KeyEventHandler(KeyEventDownAction);
34
            this.KeyUp += new KeyEventHandler(KeyEventUpAction);
35
        }
36
        public void DialogMessage_Alert(string content, string header)
37
        {
38
            var box = new TextBlock();
39
            box.MinWidth = 400;
40
            box.FontSize = 12;
41
            box.Text = content;
42
            box.TextWrapping = System.Windows.TextWrapping.Wrap;
43

    
44
            Telerik.Windows.Controls.DialogParameters parameters = new Telerik.Windows.Controls.DialogParameters()
45
            {
46
                Content = box,
47
                Header = header,
48
                Theme = new Telerik.Windows.Controls.VisualStudio2013Theme(),
49
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
50
            };
51
            Telerik.Windows.Controls.RadWindow.Alert(parameters);
52
        }
53
                
54
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
55
        {
56
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
57
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
58
            //this.Width += 40;
59
            double windowWidth = this.Width;
60
            double windowHeight = this.Height;
61
            this.Left = (screenWidth / 2) - (windowWidth / 2);
62
            this.Top = (screenHeight / 2) - (windowHeight / 2);
63

    
64

    
65
            ViewerDataModel.Instance.SystemMain = this;
66

    
67
            if (!App.ParameterMode)
68
            {
69
                //App.ViewInfo = new IKCOM.ViewInfo
70
                //{
71
                //    DocumentItemID = "11111112",
72
                //    //DocumentItemID = "10001",
73
                //    bPartner = false,
74
                //    CreateFinalPDFPermission = true,
75
                //    NewCommentPermission = true,
76
                //    ProjectNO = "000000",
77
                //    UserID = "H2011357",
78
                //    //UserID = "H2009115",
79
                //    //Mode = 0 , 1 , 2
80
                //};
81
                //DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
82

    
83
//#if DEBUG
84
//                App.ViewInfo = new IKCOM.ViewInfo
85
//                {
86
//                    DocumentItemID = "11111112",
87
//                    //DocumentItemID = "10001",
88
//                    bPartner = false,
89
//                    CreateFinalPDFPermission = true,
90
//                    NewCommentPermission = true,
91
//                    ProjectNO = "000000",
92
//                    UserID = "H2011357",
93
//                    //UserID = "H2009115",
94
//                    //Mode = 0 , 1 , 2
95
//                };
96
//                App.ParameterMode = true;
97
//                this.dzMainMenu.ServiceOn();
98
//                this.dzMainMenu.SetView(App.ViewInfo);
99
//#else
100

    
101
                DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
102
                this.dzMainMenu.pageNavigator.Visibility = Visibility.Collapsed;
103
                this.dzMainMenu.historyPane.Visibility = Visibility.Collapsed;
104
                this.dzMainMenu.infoListPane.Visibility = Visibility.Collapsed;
105
                this.dzMainMenu.searchPane.Visibility = Visibility.Collapsed;
106
                this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed;
107
//#endif
108
            }
109
            else
110
            {
111
                this.dzMainMenu.ServiceOn();
112

    
113
                if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
114
                {
115
                    this.dzTopMenu.radRibbonView.HelpButtonVisibility = Visibility.Collapsed;
116
                    var list = this.dzTopMenu.ChildrenOfType<RadRibbonTab>().ToList();
117
                    list.ForEach(item => item.Visibility = Visibility.Collapsed);
118
                    this.dzTopMenu.ribbontab_ReadOnly.Visibility = Visibility.Visible;
119
                    this.dzTopMenu.radRibbonView.SelectedItem = this.dzTopMenu.ribbontab_ReadOnly;
120
                    this.dzMainMenu.SymbolPane.Visibility = Visibility.Collapsed;
121
                    this.dzMainMenu.FavoritePane.Visibility = Visibility.Collapsed;
122
                    this.dzMainMenu.drawingRotateCanvas.IsHitTestVisible = false;
123
                }
124
                this.dzMainMenu.SetView(App.ViewInfo);
125
                this.dzMainMenu.HubSet();              
126
            }
127

    
128
            //App.ViewInfo = new IKCOM.ViewInfo
129
            //{
130
            //    DocumentItemID = "11111112",
131
            //    //DocumentItemID = "10001",
132
            //    bPartner = false,
133
            //    CreateFinalPDFPermission = true,
134
            //    NewCommentPermission = true,
135
            //    ProjectNO = "000000",
136
            //    UserID = "H2011357",
137
            //    //UserID = "H2009115",
138
            //    //Mode = 0 , 1 , 2
139
            //};
140

    
141
            //this.dzMainMenu.ServiceOn();
142
            //this.dzMainMenu.SetView(App.ViewInfo);
143
        }
144

    
145
        private void WindowDragEvent(object sender, MouseButtonEventArgs e)
146
        {
147
            if (e.ClickCount >= 2)
148
            {
149
                switch (this.WindowState)
150
                {
151
                    case WindowState.Normal:
152
                        this.WindowState = WindowState.Maximized;
153
                        break;
154
                    case WindowState.Minimized:
155
                        break;
156
                    case WindowState.Maximized:
157
                        this.WindowState = WindowState.Normal;
158
                        break;
159
                    default:
160
                        break;
161
                }
162
            }
163
            else
164
            {
165
                this.DragMove();
166
            }
167
        }
168

    
169
        private void RadButton_Click(object sender, RoutedEventArgs e)
170
        {
171
            Telerik.Windows.Controls.RadButton button = sender as Telerik.Windows.Controls.RadButton;
172

    
173
            switch (button.CommandParameter.ToString())
174
            {
175
                case ("Min"):
176
                    {
177
                        WindowState = WindowState.Minimized;
178
                    }
179
                    break;
180
                case ("Max"):
181
                    {
182
                        WindowState = WindowState.Maximized;
183
                    }
184
                    break;
185
                case ("Exit"):
186
                    {
187

    
188
                    }
189
                    break;
190
            }
191
        }
192

    
193
        private void WinState(object sender, MouseButtonEventArgs e)
194
        {
195
            switch ((e.Source as Image).Name)
196
            {
197
                case ("Win_min"):
198
                    {
199
                        WindowState = WindowState.Minimized;
200
                    }
201
                    break;
202
                case ("Win_max"):
203
                    {
204
                        if (WindowState == WindowState.Maximized)
205
                        {
206
                            WindowState = WindowState.Normal;
207
                        }
208
                        else
209
                        {
210
                            WindowState = WindowState.Maximized;
211
                        }
212
                    }
213
                    break;
214
                case ("Win_Close"):
215
                    {
216
                        if (ViewerDataModel.Instance.UndoDataList.Count > 0)
217
                        {
218
                            DateTime undoTime = ViewerDataModel.Instance.UndoDataList.OrderByDescending(order => order.EventTime).FirstOrDefault().EventTime;
219
                            DateTime updatetime = DateTime.Now.AddDays(-1);
220
                            if (ViewerDataModel.Instance._markupInfoList.Count > 0)
221
                            {
222
                                updatetime = ViewerDataModel.Instance._markupInfoList.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime;
223
                            }
224

    
225
                            if (undoTime > updatetime)
226
                            {
227
                                var box = new TextBlock();
228
                                box.MinWidth = 400;
229
                                box.FontSize = 11;
230
                                box.Text = "저장되지 않은 코멘트가 있습니다. 저장 하시겠습니까?";
231
                                box.TextWrapping = System.Windows.TextWrapping.Wrap;
232

    
233
                                DialogParameters parameters = new DialogParameters()
234
                                {
235
                                    Content = box,
236
                                    Header = "Confirm",
237
                                    Theme = new VisualStudio2013Theme(),
238
                                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
239
                                    Closed = Onclose,
240
                                };
241
                                RadWindow.Confirm(parameters);
242
                            }
243
                        }
244
                        this.Close();
245
                    }
246
                    break;
247
            }
248
        }
249

    
250
        private void Onclose(object sender, WindowClosedEventArgs e)
251
        {
252
            if (e.DialogResult == true)
253
            {
254
                dzTopMenu.SaveEvent(null, null);
255
            }
256
        }
257
    }
258
}
클립보드 이미지 추가 (최대 크기: 500 MB)