FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
MapWindow5/src/MW5.UI/Menu/StatusBar.cs at develop · MapWindow/MapWindow5 · GitHub
MapWindow
/
MapWindow5
Public
Notifications
You must be signed in to change notification settings
Fork
102
Star
308
Code
Issues
14
Pull requests
12
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
MapWindow5
/
src
/
MW5.UI
/
Menu
/
StatusBar.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
240 lines (205 loc) · 6.46 KB
Breadcrumbs
MapWindow5
/
src
/
MW5.UI
/
Menu
/
StatusBar.cs
Copy path
File metadata and controls
240 lines (205 loc) · 6.46 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Linq
;
using
System
.
Text
;
using
System
.
Threading
.
Tasks
;
using
System
.
Windows
.
Forms
;
using
MW5
.
Plugins
;
using
MW5
.
Plugins
.
Concrete
;
using
MW5
.
Plugins
.
Enums
;
using
MW5
.
Plugins
.
Interfaces
;
using
MW5
.
Shared
;
using
Syncfusion
.
Windows
.
Forms
.
Tools
;
using
Syncfusion
.
Windows
.
Forms
.
Tools
.
XPMenus
;
namespace
MW5
.
UI
.
Menu
{
internal
class
StatusBar
:
IStatusBar
{
private
readonly
StatusStripEx
_bar
;
private
readonly
IMenuIndex
_menuIndex
;
private
ToolStripItem
_progressMessage
;
private
ToolStripProgressBar
_progressBar
;
private
MainFrameBarManager
_menuManager
;
public
const
string
ProgressMsg
=
"statusProgressMsg"
;
public
const
string
ProgressBar
=
"statusProgressBar"
;
public
const
string
CustomInfo
=
"statusSelectedCount"
;
internal
StatusBar
(
object
bar
,
IMenuIndex
menuIndex
,
PluginIdentity
identity
)
{
_bar
=
bar
as
StatusStripEx
;
_menuIndex
=
menuIndex
;
if
(
_bar
==
null
)
throw
new
ArgumentNullException
(
"bar"
)
;
if
(
_menuIndex
==
null
)
throw
new
ArgumentNullException
(
"menuIndex"
)
;
_bar
.
Tag
=
new
MenuItemMetadata
(
identity
,
"statusbar"
)
;
#if
STYLE2010
_bar
.
VisualStyle
=
StatusStripExStyle
.
Default
;
#else
_bar
.
VisualStyle
=
StatusStripExStyle
.
Metro
;
#endif
}
public
string
Name
{
get
;
set
;
}
public
IStatusItemCollection
Items
{
get
{
return
new
StatusItemCollection
(
_bar
.
Items
,
_menuIndex
,
true
)
;
}
}
public
void
RemoveItemsForPlugin
(
PluginIdentity
identity
)
{
_menuIndex
.
RemoveItemsForPlugin
(
identity
)
;
ItemCollectionBase
.
RemoveItems
(
Items
,
identity
)
;
}
public
void
ShowInfo
(
string
message
)
{
var
item
=
FindItem
(
CustomInfo
,
PluginIdentity
.
Default
)
;
if
(
item
!=
null
)
{
item
.
Text
=
message
;
_bar
.
Refresh
(
)
;
}
}
IMenuItemCollection
IToolbar
.
Items
{
get
{
return
Items
;
}
}
public
bool
Visible
{
get
{
return
_bar
.
Visible
;
}
set
{
_bar
.
Visible
=
value
;
}
}
public
object
Tag
{
get
{
return
Metadata
.
Tag
;
}
set
{
Metadata
.
Tag
=
value
;
}
}
public
string
Key
{
get
{
return
Metadata
.
Key
;
}
}
private
MenuItemMetadata
Metadata
{
get
{
var
metadata
=
_bar
.
Tag
as
MenuItemMetadata
;
if
(
metadata
==
null
)
{
throw
new
ApplicationException
(
"Tag must have an instance of MenuItemMetadata class."
)
;
}
return
metadata
;
}
}
public
ToolbarDockState
DockState
{
get
{
return
ToolbarDockState
.
Bottom
;
}
set
{
;
}
}
public
PluginIdentity
PluginIdentity
{
get
{
return
Metadata
.
PluginIdentity
;
}
}
// don't do anything
public
bool
Enabled
{
get
;
set
;
}
public
void
Update
(
)
{
for
(
int
i
=
0
;
i
<
Items
.
Count
;
i
++
)
{
if
(
Items
[
i
]
.
BeginGroup
&&
i
>
0
)
{
var
item
=
_bar
.
Items
[
i
-
1
]
as
IStatusItem
;
if
(
item
!=
null
)
{
item
.
EndOfGroup
=
true
;
}
else
{
var
stripItem
=
_bar
.
Items
[
i
-
1
]
as
ToolStripStatusLabel
;
if
(
stripItem
!=
null
)
{
stripItem
.
BorderSides
=
ToolStripStatusLabelBorderSides
.
Right
;
}
}
}
}
}
public
void
Refresh
(
)
{
_bar
.
Refresh
(
)
;
}
private
bool
FindProgressBar
(
)
{
if
(
_progressMessage
!=
null
&&
_progressBar
!=
null
)
{
return
true
;
}
var
item
=
FindItem
(
ProgressBar
,
PluginIdentity
.
Default
)
;
if
(
item
!=
null
)
{
_progressBar
=
item
.
GetInternalObject
(
)
as
ToolStripProgressBar
;
}
item
=
FindItem
(
ProgressMsg
,
PluginIdentity
.
Default
)
;
if
(
item
!=
null
)
{
_progressMessage
=
item
.
GetInternalObject
(
)
as
ToolStripItem
;
}
return
_progressMessage
!=
null
&&
_progressBar
!=
null
;
}
public
void
ShowProgress
(
string
message
,
int
percent
)
{
if
(
!
FindProgressBar
(
)
)
{
return
;
}
_progressMessage
.
Text
=
message
;
if
(
percent
>
_progressBar
.
Maximum
||
percent
<
_progressBar
.
Minimum
)
{
Logger
.
Current
.
Warn
(
"Invalid progress value: {0}; Message: {1}"
,
null
,
percent
,
message
)
;
return
;
}
System
.
Action
action
=
(
)
=>
{
_progressBar
.
Value
=
percent
;
if
(
!
_progressMessage
.
Visible
)
{
_progressMessage
.
Visible
=
true
;
_progressBar
.
Visible
=
true
;
_bar
.
Refresh
(
)
;
}
}
;
_bar
.
SafeInvoke
(
action
)
;
}
public
void
HideProgress
(
)
{
if
(
!
FindProgressBar
(
)
)
{
return
;
}
System
.
Action
action
=
(
)
=>
{
_progressMessage
.
Visible
=
false
;
_progressBar
.
Visible
=
false
;
}
;
_bar
.
SafeInvoke
(
action
)
;
}
public
IMenuItem
FindItem
(
string
key
,
PluginIdentity
identity
)
{
return
_menuIndex
.
GetItem
(
identity
.
GetUniqueKey
(
key
)
)
;
}
public
bool
AlignNewItemsRight
{
get
{
var
coll
=
Items
as
StatusItemCollection
;
if
(
coll
!=
null
)
{
return
coll
.
AlignRight
;
}
return
false
;
}
set
{
var
coll
=
Items
as
StatusItemCollection
;
if
(
coll
!=
null
)
{
coll
.
AlignRight
=
value
;
}
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL