프로젝트

일반

사용자정보

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

markus / KCOM / MainWindow.xaml.cs @ 0c997b99

이력 | 보기 | 이력해설 | 다운로드 (9.83 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
            InitializeComponent();
57
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
58
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
59
            //this.Width += 40;
60
            double windowWidth = this.Width;
61
            double windowHeight = this.Height;
62
            this.Left = (screenWidth / 2) - (windowWidth / 2);
63
            this.Top = (screenHeight / 2) - (windowHeight / 2);
64

    
65

    
66
            ViewerDataModel.Instance.SystemMain = this;
67

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

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

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

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

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

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

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

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

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

    
189
                    }
190
                    break;
191
            }
192
        }
193

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

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

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

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